Question

I am trying to record a wave file and then convert this file to flac in iOS. However, the libflac library always give me the following error:

invalid/unsupported WAVE file, only 16bps stereo WAVE in canonical form allowed

How can I record the file with this kind of properties? These are the properties that I am currently using:

AVFormatIDKey = kAudioFormatLinearPCM
AVSampleRateKey = 16000
AVNumberOfChannelsKey = 2
AVLinearPCMBitDepthKey = 16
AVLinearPCMIsBigEndianKey = NO
AVLinearPCMIsFloatKey = NO

How should I change these properties in order to use libflac?

Était-ce utile?

La solution

It turned out that the settings are correct after all. The problem was with the wav file format and libflac. Apple creates a format that is slightly different than the know wave format. That is the reason of the problems that appeared in my case

Autres conseils

Apple's wave format has a slightly different header. Check out Jason Hurt's code for converting Apple's waves to FLAC: https://github.com/jhurt/wav_to_flac.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top