iPhone COM pressed音频格式,将在Windows Media Player播放 [英] iPhone compressed audio formats that will play on Windows Media player
问题描述
我要记录在iPhone上,将播放Windows媒体播放器,不使用非标准codeCS音频;也就是说,不使用codeCS不已经与WMP发货。 (公司要求。)音频已去基地-64到服务器,所以我需要获得音频尺寸尽可能小。即使在录制的8Kb频率,AIFF文件需要极大的相量的空间。我似乎无法找到pssed AIFF格式,WMP会吞下一个COM $ P $。
I have to record audio on an iPhone that will play back on Windows Media Player, using no non-standard codecs; that is, using no codecs that don't already ship with WMP. (Corporate requirement.) The audio has to go base-64 to a server, so I need to get the audio size as small as possible. Even at 8Kb recording frequency, AIFF files take ginormous amounts of space. I can't seem to find a compressed AIFF format that WMP will swallow.
推荐答案
最好的办法是写与ULAW WAV文件或阿劳COM pression(的 mFormatId
你的 AudioStreamBasicDescription
是 kAudioFormatULaw
或 kAudioFormatALaw
。测试以查看哪一个给你最小的文件大小为您的应用程序。
Best bet is to write WAV files with ulaw or alaw compression (the mFormatId
of your AudioStreamBasicDescription
would be kAudioFormatULaw
or kAudioFormatALaw
. Test to see which one gives you the smallest file sizes for your application.
下面是一些code设立ExtAudioFile实例来写ULAW:
Here's some code to set up an ExtAudioFile instance to write ulaw:
NSArray * docs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * docDir = [docs objectAtIndex:0];
NSURL * outFile = [NSURL fileURLWithPath:[docDir stringByAppendingPathComponent:@"OutFile.wav"]];
AudioStreamBasicDescription asbd;
bzero(&asbd, sizeof(asbd));
asbd.mSampleRate = 11025; // or whatever
asbd.mFramesPerPacket = 1;
asbd.mChannelsPerFrame = 1;
asbd.mFormatID = kAudioFormatULaw; //or kAudioFormatALaw
ExtAudioFileRef theFile;
err = ExtAudioFileCreateWithURL((CFURLRef)outFile,
kAudioFileWAVEType,
&asbd,
0,
kAudioFileFlags_EraseFile,
&theFile);
希望有所帮助。
---附加---
下面是修改到code SpeakHere样品拿到ULAW COM pression:
Here are modifications to the SpeakHere sample code to get ulaw compression:
SpeakHereController.mm:116
SpeakHereController.mm:116
recordFilePath = (CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: @"recordedFile.wav"];
SpeakHereController.mm:158
SpeakHereController.mm:158
recorder->startRecord(CFSTR("recordedFile.wav"));
AQRecorder.mm:192
AQRecorder.mm:192
SetupAudioFormat(kAudioFormatULaw);
AQRecorder.mm:215
AQRecorder.mm:215
XThrowIfError(AudioFileCreateWithURL(url, kAudioFileWAVEType, &mRecordFormat, kAudioFileFlags_EraseFile,
&mRecordFile), "AudioFileCreateWithURL failed");
这篇关于iPhone COM pressed音频格式,将在Windows Media Player播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!