original in nl
nl to en
Soon, he will get his Ph.D. at the University of Nijmegen on the subject of chemometrics. He enjoys working with Linux and writes down his experiences on a regular basis.
In short, you need a program that is capable of editing the mp3-files THEMSELVES! Such programs do exist, but not (for the moment) for Linux. Quite a number of such Windows programs are available, but most of these programs have one big problem: they cannot handle an mp3-file with a size of 650 MB! I have found one program that is able to do the job, if you are patient: 'Manns' mp3 edit'. I use this program in Windows98. In the graphical interface, you can indicate the begin and the end of the desired piece from the original mp3-file. You can copy this piece to a new file with the 'trim' command. This program is 'donationware', which means that you are not obliged to pay for it, but you are kindly asked to do so if the program suits your needs. This program has two drawbacks: it is awful SLOW on a 650 MB file and it can only handle CONSTANT bit-rates!!! Searching the beginning of the final hour, e.g. in an mp3-recording of 24 hours, takes a long time and includes heavy disk access. Trimming the desired piece of mp3-file, on the other hand, is very fast (without losing mp3-quality). Until now, I have not encountered any problem with mp3-file playback after using this editor. Nevertheless, I always check the final trimmed files by loading them in the mp3-editor. If loading works correctly, the trimmed files are O.K. During my first experiments with this editor, I already clicked on the 'trim'-button while still heavy disk access occurred. This resulted in damaged mp3-files that cannot be played back! To give you an indication: editing a 650 MB file takes me roughly 1 hour, mainly caused by waiting (which can be quite frustrating sometimes)!
The benefit of this approach is the limited processor usage, needed for creating the mp3-CDs. The images already exist! You can automate the whole procedure by using a script: mounting the images, starting the mp3-recording, finishing the mp3-recording and unmounting of the image after 12 hours of recording, mounting a second image and continuing the mp3-recording, and so on. I burned the CDs by hand, just in case problems occured (which was true once, due to faulty media). For this reason, I created 4 images: 3 spare images in case I encountered CD burning problems (giving me maximally 36 hours to solve the problem). The script I used looks like this:
#!/bin/sh echo "loading modules for sound support..." modprobe -k snd-card-sb16 modprobe -k snd-pcm-oss modprobe -k snd-mixer-oss echo "setting mixer..." amixer set Line 31 unmute capture; amixer set Master 31; amixer set PCM 31 cd /where/ever/you/stored/the/images/ for i in 1 2 3; do for ii in 1 2 3 4; do echo "mounting image_$ii on /mnt ..." mount -t ext2 -o loop=/dev/loop1 image_$ii /mnt echo "starting mpegrec ..." mpegrec -b 128 -x -mj -o /mnt/top2000_$ii.mp3 echo "umount /mnt" umount /mnt done done
I did everything WITHOUT XWindows, using the Bash-prompt. I loaded the sound support by hand, as well as the OSS emulation (necessary to get correctly functioning ALSA-drivers) and the mixer driver (of course you can automate this by using a pre-install/post-install trigger in /etc/conf.modules). T The 4th line configures the mixer correctly: recording source is 'line-in' and the volume has been maximally opened. After setting these options, the script handles the mounting and unmounting of the images. Concerning the mpegrec options: '-mj' indicates a joined stereo recording. I did this because I expected smaller mp3-files using this option (it should all fit on 670-680 MB). This appeared to be untrue: it does not matter if you use stereo or joined-stereo recordings! When I make new recordings, I will use ordinary stereo, The 'mpegrec' program should stop after 12 hours. To achieve this task, I adapted the source code and changed the maximally 24 hours (which is simply stated in the source code) to 12 hours. Unfortunately, this approach did not work: the program continued recording after 12 hours! I had to break the recording every 12 hours (you won't get it for free...). The script took care for the remaining parts. I do not understand a thing from 'mpegrec' anymore: I should study the source code carefully...
Note:
The most recent version of cdrecord (cdrecord-1.9) caused me problems with creating the CDs. The previous version, cdrecord-1.8.1, operated without any problem. I solved these problems by upgrading the firmware of my CD recorder, a Philips CDD 3610, from version 3.02 to version 3.09. Initially, I expected that the CD burning problems were caused by kernel 2.4.3, but this appeared to be untrue!
Summarizing the most important facts:
#!/bin/bash echo "record $1 named ($3) for $2 seconds" aumix -f ~/.aumixrc /usr/bin/yes x | /usr/bin/radio $1 >/dev/null 2>/dev/null sox -V -r 44100 -c 2 -t ossdsp -w -s /dev/dsp -t wav - 2>/dev/null | lame - ~/$3.`/bin/date "+%H%M.%m-%d-%y"`.mp3 --resample 16 -b 8 -a -m m -h --lowpass 4 --highpass .12 --voice& sleep $2 kill -9 $! # copy the output to a different direcory. If you want you can # replace cp by rcp or scp and copy it to a different computer: cp $3.*`/bin/date "+.%m-%d-%y"`.mp3 /tmp/outputdir
The script's main goal is to obtain understandable radio recordings that only need 3.5 megabyte/hour diskspace! With understandable I mean that one should be able to interpret the recorded speech. Off course, the quality of the music is awful! The first line in the script configures the mixer and starts a radio-card program and 'sox'. The 'trick' resides in the 'lame'-options, which we will investigate now:
--resample 16 | Redefine the sampling frequency from the output file from 44 kHz to 16 kHz. |
-b 8 | Set the sampling rate on 8 kbit/s (gasp!). |
-a | Combine the stereo stream to a mono recording. |
-m m | Force mono mp3 encoding. |
-h | An option to use high-quality mp3-encoding (slower). |
--lowpass 4 | Set the lowpass filter on a value of 4 kHz. All signals (frequencies) higher than 4 kHz are removed. |
--highpass .12 | Set the highpass filter on a value of .12 kHz. All signals (frequencies) below .12 kHz are removed. |
--voice | Use an mp3-compression technique optimized for speech. |
It is clear that a high compression can be obtained for speech. Most of the times, this will be undesired. Now, at least the possibility is indicated!
#!/bin/sh /usr/local/bin/mpegrec \ -l 5400 \ -x '--preset fm \ --tt "Computers in Your Life" \ --tl "Open Line with Tom Wieble" \ --ta "Tom Wieble" --ty `date +%Y` \ --tg "Speech" \ --tc "Copyright (c) 1997 - `date +%Y` WOSU" -c' \ -o open_line_`date +%d%b%y`_`date +%H%M`.mp3
The option '-l 5400' sets the recording time on 90 minutes. All options after '-x' are directly piped to 'lame' (lines 4 to 9) and the '-o' option saves the file as 'date_and_time.mp3'. These lines can be adapted as one likes. For this purpose, it might be useful to consider the 'lame'-options more closely. The current options are explained in the table below:
--preset fm | Lame knows some standard settings. 'fm' is meant for making fm-broadcasts recordings, but I dislike the recording-quality compared to the standard sampling rate of 128 kbit/s. The main cause are the applied filters in 'lame'. |
--tt "Computers in Your Life" | '--tt' define the title of the recording (30 characters max). |
--tl "Open Line with Tom Wieble" | '--tl': album, or: original source (30 characters max). |
--ta "Tom Wieble" --ty `date +%Y` | '--ta': artist (30 characters max). |
--tg "Speech" | '--tg': genre (name or number). |
--tc "Copyright (c) 1997 - `date +%Y` WOSU" -c" | '--tc': comment (additional information; 30 characters max). |
In short: a nice way of creating an mp3-file, including recording date and time and incorporating all kinds of additional information. It requires some time to write everything down into a script, but it is nice to see that all these things are possible!