Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: [acmStreamConvert] Converting files encoded with Philips CELP to P

99 views
Skip to first unread message

Francois PIETTE

unread,
Oct 23, 2009, 4:56:08 AM10/23/09
to
Hi !

I have a little bit progressed. But need more help.
I found the values in Philips SpeechMagic SDK:

typedef struct PHILIPSCELPWAVEFORMAT_tag
{
WAVEFORMATEX wfx;
BYTE extraFormatInfo[32];
} PHILIPSCELPWAVEFORMAT;
typedef PHILIPSCELPWAVEFORMAT FAR *LPPHILIPSCELPWAVEFORMAT;

LPPHILIPSCELPWAVEFORMAT srcFormat =
(LPPHILIPSCELPWAVEFORMAT)LocalAlloc(LPTR, maxFormatSize);
ZeroMemory(srcFormat, maxFormatSize);
srcFormat->wfx.cbSize = 2;
srcFormat->wfx.wFormatTag = WAVE_FORMAT_PHILIPS_CELP;
srcFormat->wfx.nChannels = 1;
srcFormat->wfx.nAvgBytesPerSec = 2400;
srcFormat->wfx.wBitsPerSample = 0;
srcFormat->wfx.nSamplesPerSec = 16000;
srcFormat->wfx.nBlockAlign = 24;
srcFormat->extraFormatInfo[0] = (BYTE)0x0;
srcFormat->extraFormatInfo[1] = (BYTE)0x0;

Witk those values, all ACM functions are happy (acmStreamOpen,
acmStreamSize, acmStreamConvert, acmStreamClose), convertion seems to take
place. But the resulting PCM file is pure garbage. Remember the same code
work for MP3 files.

There is one value which remains unknow for me: the source file is read
block by block to feed acmStreamConvert. With MP3 the block size is 522 bytes
(no idea why, btw). I don't know which value use for CELP files. I tried
various without success.

Any hint about what could be wrong ?
Complete source code is available upon request.

Regards,
--
Francois PIETTE

"Francois PIETTE" wrote:

> Hello,
>
> I have the need to convert files from Philips dictation system (Philips CELP
> codec) to PCM wave files.
> I know how to use the ACM API (acmStreamOpen, acmStreamConvert and the
> likes) to convert from one format to another, for example from MP3 to PCM.
> I'm almost sure I can use the exact same programming to use Philips CELP
> codec instead of MP3 codec. Of course Philips CELP codec is installed on my
> system.
>
> Below is an extract from a MP3 to PCM converter : // define MP3 input format
> LPMPEGLAYER3WAVEFORMAT mp3format = (LPMPEGLAYER3WAVEFORMAT)
> LocalAlloc(LPTR, maxFormatSize);
> mp3format->wfx.cbSize = MPEGLAYER3_WFX_EXTRA_BYTES;
> mp3format->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
> mp3format->wfx.nChannels = 2;
> mp3format->wfx.nAvgBytesPerSec = 128 * (1024 / 8); // not
> really used but must be one of 64, 96, 112, 128, 160kbps
> mp3format->wfx.wBitsPerSample = 0; // MUST BE
> ZERO
> mp3format->wfx.nBlockAlign = 1; // MUST BE
> ONE
> mp3format->wfx.nSamplesPerSec = 44100; // 44.1kHz
> mp3format->fdwFlags = MPEGLAYER3_FLAG_PADDING_OFF;
> mp3format->nBlockSize = MP3_BLOCK_SIZE; // voodoo
> value #1
> mp3format->nFramesPerBlock = 1; // MUST BE
> ONE
> mp3format->nCodecDelay = 1393; // voodoo
> value #2
> mp3format->wID = MPEGLAYER3_ID_MPEG;
>
> I have no idea where to find MPEGLAYER3WAVEFORMAT adapted for Philips codec.
> MMReg.h contains a lot of structures for many kind of codec, I can't find
> one for Philips codec.
>
> The question is: Where can I find the information ?
>
> Thanks in advance,
> --
> Francois Piette
> http://www.overbyte.be
>

alang...@aol.com

unread,
Oct 25, 2009, 6:28:41 PM10/25/09
to

I presume you are doing all the other things you need to do to convert
(prepare headers etc, etc). Have you monitored the values in the
acmStreamHeader to give you suggestions for the buffer sizes etc. Also
giving ACM_STREAMCONVERTF_BLOCKALIGN & ACM_STREAMCONVERTF_START as
appropriate. You may also have to add odd bytes to the PCM stream to
make a block align. The extra bytes may need particular values to
start with.

You seem to suggest that there is a codec to convert Philips directly
to MP3. I think the only way to convert is to convert CELP -> PCM ->
MP3.

Alan Lloyd

0 new messages