article

elstryan@Amazon avatar image
elstryan@Amazon posted

Ensuring your iOS app records in the correct format

Here's a code snipet that you can use to ensure that your AVAudioRecorder is initialized to save in raw LPCM format. [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSettings error:&error]; Where you specify the outputFileURL to be a along the lines of “something.wav”. And also make sure that you use the below for your recorder settings: [recordSettings setValue :[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey]; [recordSettings setValue :[NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey]; [recordSettings setValue :[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey]; [recordSettings setValue :[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey]; [recordSettings setValue :[NSNumber numberWithBool:YES] forKey:AVLinearPCMIsBigEndianKey]; [recordSettings setValue :[NSNumber numberWithBool:YES] forKey:AVLinearPCMIsFloatKey];
alexa voice service
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Article

Contributors

elstryan contributed to this article