ios - 如何在GitHub上使用此代码POVoiceHUD将.caf文件转换为.wav或.wma文件

标签 ios iphone audio github

我正在录音。我能够以.caf(核心音频格式)录制音频,后来需要将其转换为.wav或.wma以便将文件上传到FTP服务器。如何在iOS中将文件转换为.wav或.wma格式?使用来自GitHub的POVoiceHUD代码。谁能帮助我解决我的问题。

最佳答案

如果您想将.caf转换为.wav,那么您也可以引用this SO post,就像我在评论中提到的那样。

但是,如果您希望将音频作为.wav或.wma格式发送到服务器或出于任何目的,那么为什么从一开始就不以.wav或.wma格式录制音频。如果您愿意,则无​​需进行转换。

第二件事,您可以仅将extension作为.wav.wma提供给存储视频并传递给path对象的urlAVAudioRecorder,就可以将.wav或.wma格式的音频记录下来。

例如,

 NSString *folderPath = NSTemporaryDirectory();


    NSString *soundFilePath = [folderPath
                               stringByAppendingPathComponent:[NSString stringWithFormat: @"%.0f%@", [NSDate timeIntervalSinceReferenceDate] *1000.0, @"audio.wav"]];

    NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];

    NSLog(@"Using File called: %@",soundFileURL);

    audioRecorder = [[ AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSetting error:&error];
    [audioRecorder setDelegate:self];
    [audioRecorder prepareToRecord];

更新:

我访问过POVoiceHUd

只需尝试替换下面的行
 [self.voiceHud startForFilePath:[NSString stringWithFormat:@"%@/Documents/MySound.caf", NSHomeDirectory()]];


   [self.voiceHud startForFilePath:[NSString stringWithFormat:@"%@/Documents/MySound.wav", NSHomeDirectory()]];

我认为它将以.wav格式存储音频!

关于ios - 如何在GitHub上使用此代码POVoiceHUD将.caf文件转换为.wav或.wma文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38790408/

相关文章:

iphone - iOS - EXC 错误访问,以前在 iOS 4 上工作

iphone - 从 uitableviewcell 拖放到 ios 中的 uiimage View

javascript - HTML5 持久跟踪地理位置

audio - 音频流中的歌曲标题编码

ios - 如何计算UIImageView的大小?

ios - 根据第二个数组对 NSManagedObject 数组进行排序

objective-c - 如何更改 UIPageViewController 分页 curl 动画的方向

iphone - SKProductsRequest 委托(delegate)方法永远不会被调用

ios - 在 iOS 设备上产生超声波

flash - AS3麦克风的电平会随着时间的推移而下降-内置噪声补偿?