Re: GSM <-> PCM converter




alanglloyd@xxxxxxx :
On May 22, 5:02?pm, Galian <galicia.developmentgr...@xxxxxxxxx> wrote:
Hi all. I need some help with GSM-PCM converter implementation.
This is my code, all ACM functions return MMSYSERR_NOERROR, but data,
that I receive from destination buffer is wrong ( I hear in earphone
only comfort noise, and some sibilant ).It's application under Windows
Mobile 5.0. I don't know what's wrong. If some body can help me, it
will be excellent.
<snip>

I don't do Windows Mobile or C but apart from thr buffer sizes it
looks OK to me. I presume that the conversion code is called multiple
times in a loop. As so there is no need to Prepare & UnPrepare the
header for each converted frame. Unles you are increasing the
specified memory you can use the same Prepared header throught.

Your buffer sizing appears correct, but while you've got the correct
relationship, the calculation appears "magical". Basically 320 samples
of PCM convert to 1 block of GSM. PCM (Mono 16 bits/sample) uses 2
bytes per block (sample). GSM uses 65 bytes / block. So 640 PCM bytes
convert to 65 bytes of GSM.

So the calculations are ...

GSMBytesPerBuffer = GSMBytesPerGSMBlock * GSMBlocksPerBuffer
(I thinkPreferredFramesPerPacket are GSMBlocksPerBuffer)

260 = 65 * 4

PCMBytesPerBuffer = PCMBytesPerPCMBlock * PCMBlocksPerGSMBlock *
GSMBlocksPerBuffer
(I think PCMBlocksPerGSMBlock are PCMSamplesPerGSMBlock)

2560 = 2 * 320 * 4

... or 130 and 1280 with only 2 GSMBlocksPerBuffer.

Alan Lloyd

Hi Alan!
Thank you for your answer.

I already found an error, It was ( as usually ) small logical error,
which I doesn't seen.
About calculating buffer sizes:

if I right understand two GSM frames, haves a size 65 bytes ( 32,5
bytes - one GSM frame )
So, for 4 PCM frames buffer size = 320 * 4 = 1280 bytes
and for 4 GSM frames buffer size = 65 * ( 4 / 2 ) = 130 bytes
I thing you missed " / 2 " in my code for calculating GSM buffer size

Thank you again for focus attention.

.



Relevant Pages

  • Re: Curved space-time?
    ... and how can spacetime be curved? ... dimensional space on the surface of a sphere. ... dimensional Euclidean geometry does not apply in this ... It is a mathematical concept, but no more so than 3-dimensional ...
    (sci.physics)
  • Re: Damn you, FEDEX! or Nikon D40 lost in Springfield, MO blackhole.
    ... the 2 mp Mavica he had been using with a Nikon D40. ... After shopping around, he got me to order one for him. ... The shipper had it insured, but from what I have read it could take weeks to sort this crap out. ... You may get your insurance from FedEx and a couple weeks later they find it and deliver it. ...
    (alt.photography)
  • Re: A beginner in DirectX - A question about DrawIndexedPrimitive
    ... made the DirectX API know best about what the actual value should become. ... It however does leave the question what the calculation should exactly be: ... An indication so the function can buffer as many triangles as the indices ... why does the function talk about primitives instead of vertices ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: saa7134 broken in 2.6.15-rc2
    ... I've found the cause of this oops: ... that the length of the buffer is calculated wrongly. ... But "instructions" is calculated wrong. ... The other mistake in the buffer size calculation, and the one that hits me, is ...
    (Linux-Kernel)
  • Re: Pointer arithmetic question
    ... > end of the object that ptr1 points into. ... I was wondering if the mere calculation would ... since I will never actually dereference the bad pointer. ... >>What if n is greater than the size of the buffer to which ptr1 points? ...
    (comp.lang.c)