[MP3 ENCODER] LAME encoder
Hi, I need to play a 128bit stereo mp3 file. Im tryng to use lame library to do, but I obtain a noised pcm frames. what's wrong? #include stdio.h #includefcntl.h #includestdlib.h #includeunistd.h #include sys/ioctl.h #include linux/soundcard.h #include lame.h FILE *rec; FILE *raw; mp3data_struct mp3str; mp3data_struct *mp3data; short int pcm_l[1152],pcm_r[1152]; unsigned char buf[200]; int ret,len,ARG; int audio; int main() { mp3data=mp3str; rec=fopen(test.mp3,r); raw=fopen(raw.raw,w); audio=open(/dev/dsp,O_RDWR); if (audio 0) { perror(open of /dev/dsp failed); exit(1); } lame_decode_init(); while(mp3data-header_parsed!=1) { len=fread(buf,1,sizeof(buf),rec); ret=lame_decode1_headers(buf, len, pcm_l, pcm_r, mp3data); } printf (stereo=%i\nsamlpr=%i\nbitrate=%i\nmode%i\nmode_ext=%i\nframesize%i\nnsamp=%d\ntotalfr=%i,mp3data-stereo,mp3data-samplerate,mp3data-bitrate,mp3data-mode,mp3data-mode_ext,mp3data-framesize,mp3data-nsamp,mp3data-totalframes,mp3data-framenum); mp3data-header_parsed=0; ARG=mp3data-samplerate/2; ioctl(audio,SOUND_PCM_WRITE_RATE,ARG); ioctl(audio,SOUND_PCM_READ_RATE,ARG); printf(\nrate = %i\n,ARG); ARG=mp3data-stereo; ioctl(audio, SOUND_PCM_WRITE_CHANNELS, ARG); ARG=16; ioctl(audio, SOUND_PCM_WRITE_BITS,ARG); write(audio,pcm_l,ret); write(audio,pcm_r,ret); fwrite(pcm_l,sizeof(short),ret,raw); fwrite(pcm_r,sizeof(short),ret,raw); do{ while((len0)(ret1)) { len=fread(buf,1,sizeof(buf),rec); ret=lame_decode(buf, len, pcm_l, pcm_r); } printf(ret=%i,ret); mp3data-header_parsed=0; write(audio,pcm_l,ret); write(audio,pcm_r,ret); fwrite(pcm_l,sizeof(short),ret,raw); fwrite(pcm_r,sizeof(short),ret,raw); ret=0; }while (len0); lame_decode_exit(); fclose(rec); fclose(raw); return 0; } thank's __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] lame encoder
--- Damian Pitcon [EMAIL PROTECTED] wrote: Hi all, I have a question that I'd love if someone could help me with. I'm using cool edit pro 2 on windows XP and have installed the lame cooledit plugin into the main CE directory. But when I try to encode it says invalid file or format'. Any ideas whats up? Please e-mail me at: [EMAIL PROTECTED] thanks! Damian __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder Damien I believe the Cool Edit plugins are on a seperate directory for plugins and data libraries only. I'll double check that when I get back to work in a couple days, but I think it's the same as sound forge or vegas, with a plugins directory, possibly in another options or accessories directory off the main. Check your windows registry too, to make sure it shows up in the local_machine,software area. Sometimes .dll files can end up attached to other software and cause conflicts. Sorry Mister Gates... Microsoft is not an exact science. B$ _ The more you disapprove, the more fun it is for us. Sign up for FREE email from Kiss My Ass at http://www.kissmyass.com _ Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, POP more! http://www.everyone.net/selectmail?campaign=tag ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
[MP3 ENCODER] lame encoder
Hi all, I have a question that I'd love if someone could help me with. I'm using cool edit pro 2 on windows XP and have installed the lame cooledit plugin into the main CE directory. But when I try to encode it says invalid file or format'. Any ideas whats up? Please e-mail me at: [EMAIL PROTECTED] thanks! Damian __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] lame encoder
sorry mp3encoder
Re: [MP3 ENCODER] Lame Encoder!
I have found that lame encoder (lame.exe) can't encode wav file that have spaces in its' filename/folder. For examples: C:\My Music\Wav 01.wav (both have spaces in folder filename) C:\My Music\Wav01.wav (have space in folder name) C:\MyMusic\Wav 01.wav (have space in filename) It is the common behaviour of win32 console applications. You have either to use the short name, or to put the filename between double quotes. Regards, Gabriel Bouvigne www.mp3-tech.org personal page: http://gabriel.mp3-tech.org ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Antwort: [MP3 ENCODER] Lame Encoder!
hi there put it in C:\My Music\Wav 01.wav regards d. bieritz [EMAIL PROTECTED] Jutawan Muda [EMAIL PROTECTED] Gesendet von: [EMAIL PROTECTED] 09.12.2002 13:19 Bitte antworten an mp3encoder An: [EMAIL PROTECTED] Kopie: Thema: [MP3 ENCODER] Lame Encoder! Hi Hello, I have found that lame encoder (lame.exe) can't encode wav file that have spaces in its' filename/folder. For examples: C:\My Music\Wav 01.wav (both have spaces in folder filename) C:\My Music\Wav01.wav (have space in folder name) C:\MyMusic\Wav 01.wav (have space in filename) Please fix these in the next version. Thanks Mr.Bean _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
[MP3 ENCODER] Lame Encoder!
Hi Hello, I have found that lame encoder (lame.exe) can't encode wav file that have spaces in its' filename/folder. For examples: C:\My Music\Wav 01.wav (both have spaces in folder filename) C:\My Music\Wav01.wav (have space in folder name) C:\MyMusic\Wav 01.wav (have space in filename) Please fix these in the next version. Thanks Mr.Bean _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] Lame encoder input- Help needed
On Mon, 3 Dec 2001, Mark Taylor wrote: 2. I encoded a file in two ways. One - using the lame encoder command line options and the other by writing a small program to read data from a file and then using libmp3lame functions to encode. In both cases I used the ABR (average bitrate mode) at 12kbps. The only difference being that in the second case the encoder doesnt know the filesize( and hence doesnt know the total number of samples to be encoded either). When playing back on WinAmp the command line encoded mp3 file bitrate keeps switching between 8 and 16kbps (as displayed in the player window). But the player shows a bitrate of 13kbps for the second file. Am I doing something wrong or does the encoder need to know the filesize beforehand? play the files with lame --decode and see what it does. One difference might be that the libmp3lame version will not have the Xing VBR tag unless you specifically called the routine from the LAME API to add the tag. Maybe someone who uses WinAmp will know if it treats VBR files with and without the VBR tag differently? Yes it does. For files with VBR tag it shows the /current/ bitrate of the stream as it changes, but for files without the tag it shows the /average/ bitrate so far. /Stefan -- [ Stefan Ohlsson ] · http://www.cixit.se/ · [ 020-4702019 / +46-709-561314 ] ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] Lame encoder input- Help needed
On 3 Dez, Manoj Palki wrote: 2. I encoded a file in two ways. One - using the lame encoder command line options and the other by writing a small program to read data from a file and then using libmp3lame functions to encode. In both cases I used the ABR (average bitrate mode) at 12kbps. The only difference being that in the second case the encoder doesnt know the filesize( and hence doesnt know the total number of samples to be encoded either). Have a look at slame (= simple lame) in http://www.leidinger.net/lame/py-lame.tar.bz2 (python bindings for libmp3lame, still a lot to do (no ID3 yet, only output to a file and only encoding of 16bit interleaved stereo at the moment)), it does the right thing in this case (set the total number of samples of the input). Bye, Alexander. -- Loose bits sink chips. http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7 ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
RE: [MP3 ENCODER] Lame encoder input- Help needed
Thanks a lot Mark. I have some more questions and would be very grateful if someone can answer them. 1. When lame combines standard bitrates to get the required average, over what range is this average achieved? ( For ex : does lame achieve the average over a specified number of frames or is it over a specified time or is it the entire file) 2. I encoded a file in two ways. One - using the lame encoder command line options and the other by writing a small program to read data from a file and then using libmp3lame functions to encode. In both cases I used the ABR (average bitrate mode) at 12kbps. The only difference being that in the second case the encoder doesnt know the filesize( and hence doesnt know the total number of samples to be encoded either). When playing back on WinAmp the command line encoded mp3 file bitrate keeps switching between 8 and 16kbps (as displayed in the player window). But the player shows a bitrate of 13kbps for the second file. Am I doing something wrong or does the encoder need to know the filesize beforehand? Thanks -Original Message- From: Mark Taylor [mailto:[EMAIL PROTECTED]] Sent: Friday, November 30, 2001 2:07 PM To: [EMAIL PROTECTED] Subject: Re: [MP3 ENCODER] Lame encoder input- Help needed Hi, I want to encode mp3's at 12kbps (constant bit rate). Lame presently only supports 8, 16, 32kbps and upwards. Does anyone know of the amount of effort which would be involved in modifying the code to support 12kbps? Any help on how to go about it would be greatly appreciated. Thanks Manoj You have two choices: lame --freeformat 12 which will make all frames 12kbps, but only a few fully complient decoders will be able to handle it, or: lame --abr 12 which will use a combination of standard bitrate frames to get an average of 12kbps. Mark ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] Lame encoder input- Help needed
Thanks a lot Mark. I have some more questions and would be very grateful if someone can answer them. 1. When lame combines standard bitrates to get the required average, over what range is this average achieved? ( For ex : does lame achieve the average over a specified number of frames or is it over a specified time or is it the entire file) the average is not guaranteed. I think it usually comes within 95%, and almost always on the low side. It's an easy fix to tweak the algorithm to get this to come out exact, but right now it is close enough no one has bothered to fix it. 2. I encoded a file in two ways. One - using the lame encoder command line options and the other by writing a small program to read data from a file and then using libmp3lame functions to encode. In both cases I used the ABR (average bitrate mode) at 12kbps. The only difference being that in the second case the encoder doesnt know the filesize( and hence doesnt know the total number of samples to be encoded either). When playing back on WinAmp the command line encoded mp3 file bitrate keeps switching between 8 and 16kbps (as displayed in the player window). But the player shows a bitrate of 13kbps for the second file. Am I doing something wrong or does the encoder need to know the filesize beforehand? Thanks play the files with lame --decode and see what it does. One difference might be that the libmp3lame version will not have the Xing VBR tag unless you specifically called the routine from the LAME API to add the tag. Maybe someone who uses WinAmp will know if it treats VBR files with and without the VBR tag differently? Mark ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [MP3 ENCODER] Lame encoder input- Help needed
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
Re: [MP3 ENCODER] Lame encoder input- Help needed
Hi, I want to encode mp3's at 12kbps (constant bit rate). Lame presently only supports 8, 16, 32kbps and upwards. Does anyone know of the amount of effort which would be involved in modifying the code to support 12kbps? Any help on how to go about it would be greatly appreciated. Thanks Manoj You have two choices: lame --freeformat 12 which will make all frames 12kbps, but only a few fully complient decoders will be able to handle it, or: lame --abr 12 which will use a combination of standard bitrate frames to get an average of 12kbps. Mark ___ mp3encoder mailing list [EMAIL PROTECTED] http://minnie.tuhs.org/mailman/listinfo/mp3encoder