[SDL] AMR playback

chris.2.dobbs at bt.com chris.2.dobbs at bt.com
Thu Jun 15 03:28:57 PDT 2006


Sorry but please ignore my last message as our useless mail router seems
to have buggered it up and chopped half of it out!

All, 
I am currently working on a project to design a cross-platform (linux
and WIN32) VoIP API for both audio and video. I am planning to handle
both AMR(NB) and G711 audio codecs and 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 320 bytes per frame (160*2). 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)*2= 1920 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