Question

Est-il possible en utilisant Core Audio sur Mac OS X pour extraire un ensemble d'images dans un fichier AIFF dans un tableau de 32 bits flotteurs adaptés pour effectuer une FFT sur?

Était-ce utile?

La solution

Oui. La meilleure façon de le faire est d'utiliser l'API ExtAudioFile. Il y a un excellent exemple dans le code ConvertFile échantillon. Jetez un oeil à UseExtAF.cpp.

Pour un taux d'échantillonnage de 44,1 kHz, la AudioStreamBasicDescription pour LPCM à virgule flottante 32 bits ressemblerait à ceci:

AudioStreamBasicDescription fmt;
fmt.mSampleRate = 44100;
fmt.mFormatID = kAudioFormatLinearPCM;
fmt.mFormatFlags = kLinearPCMFormatFlagIsFloat;
fmt.mBitsPerChannel = sizeof(Float32) * 8;
fmt.mChannelsPerFrame = 1; // set this to 2 for stereo
fmt.mBytesPerFrame = fmt.mChannelsPerFrame * sizeof(Float32);
fmt.mFramesPerPacket = 1;
fmt.mBytesPerPacket = fmt.mFramesPerPacket * fmt.mBytesPerFrame;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top