• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
SampleRate Conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SampleRate Conversion


  • Subject: SampleRate Conversion
  • From: Anthony Myatt <email@hidden>
  • Date: Thu, 19 Jun 2014 11:55:03 +1000

Hi,

I am trying to do a conversion using AudioConverterFillComplexBuffer but am getting ‘insz’ errors.
Integer -> Float
Stereo -> Mono
44100 -> 16000

The code worked with everything except for sample rate conversion, as soon as I added that I began getting the errors.

Below is my two format descriptions:

———————
/* Setup input format */
    size_t bytesPerSample = sizeof (AudioUnitSampleType);
    inputStreamFormat.mFormatID          = kAudioFormatLinearPCM;
    inputStreamFormat.mFormatFlags       = kAudioFormatFlagsAudioUnitCanonical;
    inputStreamFormat.mBytesPerPacket    = bytesPerSample;
    inputStreamFormat.mFramesPerPacket   = 1;
    inputStreamFormat.mBytesPerFrame     = bytesPerSample;
    inputStreamFormat.mChannelsPerFrame  = 2;
    inputStreamFormat.mBitsPerChannel    = 8 * bytesPerSample;
    inputStreamFormat.mSampleRate        = 44100;

    

    /* Setup float format */
    floatAudioDescription.mFormatID          = kAudioFormatLinearPCM;
    floatAudioDescription.mFormatFlags       = kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved;
    floatAudioDescription.mChannelsPerFrame  = stereo() ? 2 : 1;
    floatAudioDescription.mBytesPerPacket    = sizeof(float);
    floatAudioDescription.mFramesPerPacket   = 1;
    floatAudioDescription.mBytesPerFrame     = sizeof(float);
    floatAudioDescription.mBitsPerChannel    = 8 * sizeof(float);
    floatAudioDescription.mSampleRate        = samplerate();
———————

Can anyone see what I am doing wrong?


Regards,

Anthony
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: SampleRate Conversion
      • From: Anthony Myatt <email@hidden>
  • Prev by Date: Re: Get number of used busses before render begins
  • Next by Date: Re: Get number of used busses before render begins
  • Previous by thread: Re: Get number of used busses before render begins
  • Next by thread: Re: SampleRate Conversion
  • Index(es):
    • Date
    • Thread