Existe-t-il un moyen d'utiliser Core Audio sur OS X pour extraire un ensemble d'images dans un fichier AIFF dans un tableau de fichiers flottants 32 bits permettant d'effectuer une FFT?Utilisation de Core Audio pour extraire des fichiers flottants à partir d'AIFF
0
A
Répondre
3
Oui. La façon la plus simple de le faire est d'utiliser l'API ExtAudioFile. Il y a un bon exemple dans l'exemple de code ConvertFile d'Apple. 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;