hi. i am new to this list. i use lame for a while now as the encoder for an icecast at a local club. ( http://vienna.mp3.at:8000/flex or directly on http://flxmp3.flex.at:8000 ). (this weekend i will set the stream to 40 or 48kbit since a radio (a real readio) station at the other and of austria wants to broadcast the signal.. most of the time i broadcast with 24kbit so that people with slow modem connections have a chance to listen to the stream. i find the quality of 24kbit good but the audio technican at the club always hears some "metalic chirp" in the signal which he says is not there in any other of the stations on yp.icecast.org which broadcast with 24kbit/s. i thought that the chirp could evntually be an aliasing effect where frequencis in the range above 11khz are mirroed into lower bands by the sampling process. in order to rule that out i did some testing with encoding a short wav file.. i implemented a downsample by 2 quick hack into the lame source (takes the avearge value between 2 samples..) so you can write: lame -b 24 -s 44.1 --resample 22.05 -a waits.wav waits24.mp3 (but only if the resample frequency is exactly half of the input frequency.) i will try to pacht liveice so it understands that option and see what the audio technican thinks about the quality now.. has any of you some comparision of lame encoder vs. comercial encoders at low bitrates? here is the quick downsampling patch: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- lame3.51/lame.c Thu Oct 28 00:14:58 1999 +++ lame3.51a/lame.c Fri Nov 26 02:22:52 1999 @@ -1241,7 +1241,8 @@ #ifndef _BLADEDLL int lame_readframe(short int Buffer[2][1152]) { - int iread,ifreq,ofreq; + int iread,ifreq,ofreq,i,ch; + static short int helpbuffer[2][1152]; static int eof; if (frameNum==0) eof=0; @@ -1263,8 +1264,23 @@ #endif if (resample_ratio>0) { - fprintf(stderr,"Error: resample code not yet written! \n"); - exit(1); +/* printf("doing resampling by a factor of %g\n",resample_ratio); */ + if ( abs((resample_ratio - 2.0)) < 1e-5) { + for(ch=0;ch < fr_ps.stereo; ch++) { + for(i=0;i<iread/2;i++) { + Buffer[ch][i]=(short int)(((int)Buffer[ch][2*i]+(int)Buffer[ch][2*i+1])/2); + } + } + iread = get_audio(helpbuffer,fr_ps.stereo,fr_ps.header); + for(ch=0;ch < fr_ps.stereo; ch++) { + for(i=0;i<iread/2;i++) { + Buffer[ch][i+iread/2]=(short +int)(((int)helpbuffer[ch][2*i]+(int)helpbuffer[ch][2*i+1])/2); + } + } + } else { + fprintf(stderr,"Error: resample code not yet written! \n"); + exit(1); + } } /* check to see if we overestimated/underestemated totalframes */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~~~~~~~~~ greetings from vienna, austria. mond. -- MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )
