ASIC/FPGA Design and Verification Out Source Services
Converting Audio Streams
This guide will describe how to convert audio streams. You may want to record a WEB based radio station. In order to do that just follow the following steps: 
- Record the stream - mplayer -dumpstream mms://s67wm.castup.net/990310001-52.wmv
- Convert the output wmv string to wav - mplayer stream.dump -ao pcm:file=1.wav
- convert the wav to mp3 - lame -h -b 192 1.wav 1.mp3
Editing The MP3 FileOnce you got your MP3 audio file, you may want to extract some songs or to remove some data. It might be a song, which you don't like or any other part of the MP3 file.
- Play the MP3, listen to it and write down the time of the parts you want to extract : starting time and ending time per each one. Also note the entire time of all the MP3 - you'll need it later.
- On my system the output of the player looks like what is shown below: The total time is 3*60 + 11 seconds. The starting point is at 60+8 seconds. In a similar way you find the ending point.
And now for the perl script, which does the extraction.
- First run it without start and end points, just to get the entire MP3 time.perl mp3_pr.pl CharlesAznavourIlFautSavoir.mp3 ex_CharlesAznavourIlFautSavoir.mp3
- When the program finishes, it also displays the total number of frames:frame count=7950.
- So now you know that 198 seconds (3:11) is 7950 frames. The starting point is (68:198)*7950=~2730. Suppose you calculate the end point to be 5000 (frames).
- Now re-invoke the perl script, this time with the parameters of start and end points:perl mp3_pr.pl CharlesAznavourIlFautSavoir.mp3 ex_CharlesAznavourIlFautSavoir.mp3 2730 5000
- This time expect ex_CharleAznavourIlFautSavoir.mp3 to be the extraction you wished to get.
Playing CharlesAznavourIlFautSavoir.mp3.
Audio file file format detected.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
mpg123: Can't rewind stream by 1203 bits!
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
alsa-init: using device default
alsa: 44100 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 68.1 (01:08.0) of 191.0 (03:11.0) 3.3%
- perl script
- An Example of the editeded MP3

- You may want to share your thoughts and add your comments. Feedback This Site
Please let me know what you think on my site.
Contact me now at: |