[SDL] AMR playback

chris.2.dobbs at bt.com chris.2.dobbs at bt.com
Wed Jun 14 15:19:51 PDT 2006


which is desined to handle both AMR(NB) and G711 codecs. I am using SDL to provide us with access to the audio hardware(have also got microphone input working using a patch I recvd from this news group). The VoIP app currrenly receives the AMR or G711 RTP frames (via RTP/UDP), each rtp payload contains 6 AMR encoded speech frames at AMR encode mode 7 i.e each speech frame is 31 bytes. Each speech frame represents 20ms of speech. When decoded to PCM is results in 160 bytes per frame. I now need to present this PCM data to the audio output callback but am wondering how to do this with regards to the frequency that it is expecting data? I have currently opened the audio device with a 30250 frequency as this seems to work best with the microphone but my AMR was recorded at 8000, or should I just feed the audio callback with as much data as it asks for when is ask for it?

Currently I am just dumping the 6 speech frames (160*6=960 bytes) into the audio callback buffer as they arrive but the playback sounds far too quick but I can just make out the actual speech so I know the decode is working.

Sorry if my q's seem obvious but I have only really used SDL before to playback sound data from supported formats like .wav
Any help is appreciated and many thanks for a great product.
Regards,
-Chris Dobbs
~             


More information about the SDL mailing list