> 
> Hi,
>    I am trying to encode raw PCM files into mp3 using the libmp3lame
> library.
> The PCM files are sampled at 8000khz, 16bit mono.
> My rather basic questions are
> 
> 1) Should I read from the PCM file into an unsigned or a signed buffer?
> 2) When I call the function 'lame_encode_buffer_int' should I input 576
> samples or 1152 samples?
> 

#2: 
The input buffer can be any size you are willing to allocate memory
for.  I would use whatever buffer you already have to input the data.
Just make sure the mp3 output buffer is large enough to
handle the output.  see the file API for details. 

#1:  
There are 3 possible routines, all of which take signed data
but the scaling differs depending on the input type.  This
is tersely documented in lame.h.  


                               input           data range

lame_encode_buffer()         short int          +/- 32768
lame_encode_buffer_float()     float            +/- 32768
lame_encode_buffer_long()      long             +/- 32768
lame_encode_buffer_int()        int             +/- 2^(8*size(int)-1)


The scaling used by lame_encode_buffer_long() is a mistake,
since I believe long is usually 4 bytes, so we dont allow
for the full range.  This should probably be fixed.

Internally, the data is only used as 'float', so if you are
doing any type of DSP and have converted to float, dont 
quantize back to an integer before calling lame.


Mark

_______________________________________________
mp3encoder mailing list
[EMAIL PROTECTED]
http://minnie.tuhs.org/mailman/listinfo/mp3encoder

Reply via email to