title: How to populate AudioStreamBasicDescription for AMR playback
body: <p>source data is AMR-NB 5.9kbit/s (AMR_5.90)</p>
  
  <p>I've tried the below settings (and a dozen variations) but I'm getting nothing more than garbage audio.  Does anyone know the correct settings for AMR?</p>
  
  <pre><code> AudioStreamBasicDescription asbd;
   asbd.mSampleRate = 8000.0;
   asbd.mFormatID = kAudioFormatAMR;
   asbd.mFormatFlags = 0;
   asbd.mBytesPerPacket = 15;  // (118&gt;&gt;3)
   asbd.mFramesPerPacket = 1;
   asbd.mBytesPerFrame = 15;
   asbd.mChannelsPerFrame = 1;
   asbd.mBitsPerChannel = 118;  //tried also 0 and 13
   asbd.mReserved = 0;
  </code></pre>
  
  <p>Based on info from wikipedia for AMR:</p>
  
  <p>Sampling frequency 8 kHz/13-bit (160 samples for 20 ms frames)</p>
  
  <p>Generates frame length of 95, 103, 118, 134, 148, 159, 204, or 244 bits for bit rates 4.75, 5.15, 5.90, 6.70, 7.40, 7.95, 10.2, or 12.2 kbit/s, respectively</p>
  
  <p>And the data structure description from here:</p>
  
  <p><a href="http://developer.apple.com/iphone/library/documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/c_ref/AudioStreamBasicDescription" rel="nofollow noreferrer">http://developer.apple.com/iphone/library/documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/c_ref/AudioStreamBasicDescription</a></p>