باستخدام الصوت الأساسي لاستخراج العوامات من AIFF

StackOverflow https://stackoverflow.com/questions/1965148

  •  21-09-2019
  •  | 
  •  

سؤال

هل هناك طريقة باستخدام الصوت الأساسي على OS X لاستخراج مجموعة من الإطارات في ملف AIFF في مجموعة من العوامات 32 بت مناسبة لأداء FFT؟

هل كانت مفيدة؟

المحلول

نعم. أسهل طريقة للقيام بذلك هي استخدام API Extaudiofile. هناك مثال رائع في Apple's ConvertFile عينة من الرموز. إلقاء نظرة على usextaf.cpp.

بالنسبة لمعدل عينة قدره 44.1 كيلو هرتز ، فإن AudioStreamBasicDescription لنقطة عائمة 32 بت تبدو هكذا:

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;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top