如何调整录制的声音的音调
1)我想制作一个像会说话的汤姆猫一样的Iphone应用程序。我已经从以下位置下载了示例示例:--> https://github.com/zoul/Finch 网站。它可以很好地播放给定的音频文件。但我想用音调效果来播放我录制的文件。我的问题是,当我传递录制的文件(使用 AVAudioRecorder 录制)时,会出现类似“无法读取声音数据”的错误。请帮助我为什么会出现这个错误。使用AVAudioRecorded录制文件时是否存在文件格式问题或任何设置问题? 我的设置代码在这里......
NSArray *dirPaths;
NSString *docsDir;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.caf"];
soundFileURL = [NSURL fileURLWithPath:soundFilePath];
NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: AVAudioQualityMedium],AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],AVNumberOfChannelsKey,
[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,
[NSNumber numberWithBool:YES],AVLinearPCMIsBigEndianKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&error];
if(error)
{
NSLog(@"error in AudioRecorder Initializing...: %@", [error localizedDescription]);
}
else
{
//audioRecorder.meteringEnabled = YES;
[audioRecorder prepareToRecord];
}
2)我从 http://dirac.dspdimension> 找到了另一个示例.com/Dirac3_Technology_Home_Page/Dirac3_Technology.html 网站。 在这个例子中,我可以播放我录制的文件,但干扰太多。 播放完后声音一直在播放,无法停止。有时,当音高发生变化时,应用程序会崩溃。在此示例中,他们使用“libDIRAC_iOS4-fat.a”库。那么我们可以使用这个库吗?我们怎样才能停止声音播放。
有什么办法可以轻松地使用它吗?
提前致谢。
1) I want to make an Iphone app like Talking Tom. I have downloaded the sample example from :--> https://github.com/zoul/Finch site. It plays fine with given audio file. But I want to play my recorded file with pitch effect. My problem is when I pass my recorded file (Recorded using AVAudioRecorder) the error comes like "Failed to read sound data." please help me why this error occurs. Is there any file format problem when recording file using AVAudioRecorded or any setting problem?
my Setting code is here....
NSArray *dirPaths;
NSString *docsDir;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.caf"];
soundFileURL = [NSURL fileURLWithPath:soundFilePath];
NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: AVAudioQualityMedium],AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],AVNumberOfChannelsKey,
[NSNumber numberWithFloat: 44100.0],AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,
[NSNumber numberWithBool:YES],AVLinearPCMIsBigEndianKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&error];
if(error)
{
NSLog(@"error in AudioRecorder Initializing...: %@", [error localizedDescription]);
}
else
{
//audioRecorder.meteringEnabled = YES;
[audioRecorder prepareToRecord];
}
2)I found another example from http://dirac.dspdimension.com/Dirac3_Technology_Home_Page/Dirac3_Technology.html site.
In this example I can Play my recorded file but too much disturbance comes.
The sound is continuously playing after playing and not able to stop it. Sometimes app crashes when pitch changed.In this example they are using "libDIRAC_iOS4-fat.a" library. so can we use this library ? And how can we stop sound playing.
Is there any way to do this using easily ?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论