Thanks for your reply. I knew that the output is raw PCM data. And the Sound Forge can play raw PCM data no matter what extsion filename is. I can hear the PCM data via Sound Forge, just the quality is not good, too much nosie. As the decription of scale( ) in minimad.c, there is no noise shaping for scaling. It that the reason about the quality issue ?
Could be, but in my experience even something as simple as:
signed int MAD_SimpleScale( mad_fixed_t sample ) { // Round sample += ( 1L << (MAD_F_FRACBITS - 16) ) ;
// Clip if ( sample >= MAD_F_ONE ) sample = MAD_F_ONE - 1 ; else if ( sample < -MAD_F_ONE ) sample = -MAD_F_ONE ;
// Quantise return sample >> (MAD_F_FRACBITS + 1 - 16) ; }
... already produces nice results. If you forget about the clipping though, the quality s#cks! I'm not sure, but I believe the standard mad-example 'forgets' the clipping. (Could be wrong though!) I don't know what minimad.c uses ...
If that is not it, check the compiler settings. Some very agressive optimisations may cause rounding-errors, although this usually occures with floating point numbers, and MAD's strength is that it doesn't use them ...
I know, I'm just quessing, but maybe this helps somehow.
Regards,
Armin