Next Previous Contents

3. MUSIC 2 RAW

3.1 collect Music

First of all data is needed. The best way to get data is to download or rip and encode yourself some MP3 File. A good address to get some MP3 files is to visit AudioGalaxy.com.

3.2 Filenames Preprocessing

After you have created you personal music collection changes in filenames are necessary. Copy all music files to one directory.

Filename should not have other characters than [a-z] and [0-9]. The following script is applied that all files meets this condition:

#! /bin/bash
# changes Filenames for next Steps
# output: deletes all except: a-z0-9.
#
for file in *.mp3
do
  mv "$file" `echo "$file" | sed -e s/[^A-Za-z0-9\.]//g | tr "[:upper:]" "[:lower:]"`
done

Be careful: Linux is case-sensitive. If there are *.MP3 files, they will not be recognized.

In a second step Filenames are trimmed to a length of 15 characters.

#! /bin/bash
# shorts filenames to given length
# call this with *.mp3 to change mp3 Filenames
#
LENGTH=15

for i in "$@"; do
  extension=${i##*.}
  prefix=${i%%.*}
  new_name=`echo "$prefix" | cut -c -$LENGTH`.$extension
  echo [$new_name]
  mv $i $new_name
done

3.3 create RAW files

After this Preprocessing you have to run XMMS with a special plugin to get RAW file which are used for further processing.

Install this special Version of XMMS or get XMMS and the source code of anafile and merge both archives and compile your own version of XMMS.

After you successfully installed XMMS with anafile run XMMS.

Now enable the "Dump 2 File" (anafile) Visualisation Plugin and close XMMS again.

After that step you can now start XMMS with the music file you want to convert. Find resulting PCM and FRQ data for both channels in /tmp.

To convert the large Musiccollection we acquired the step before run the following two scripts in the directory.

#! /bin/bash
# this file is called: "music2raw.help.sjb"
# script is called by do.raw to end xmms
# parameters: $1 (Seconds after which xmms is killed)
#
sleep $1
killall xmms

Script 2:

#! /bin/bash
# runs XMMS with all files in current directory
# output: filename.pcm/frq.links/rechts.bz2
# (355 is max length of music file in seconds)

mkdir ./raw

for FILE in *.mp3
do
  music2raw.help.sjb 355 &
  xmms $FILE
  cat /tmp/temp.frq.links | bzip2 >../raw/$FILE.frq.links.bz2
##  cat /tmp/temp.pcm.links | bzip2 >../raw/$FILE.pcm.links.bz2
#  cat /tmp/temp.frq.rechts | bzip2 >../raw/$FILE.frq.rechts.bz2
#  cat /tmp/temp.pcm.rechts | bzip2 >../raw/$FILE.pcm.rechts.bz2
done

rm /tmp/temp.frq.*
rm /tmp/temp.pcm.*

First edit script 2 and adjust the extension in the for-loop. Now change the parameter of "music2raw.help.sjb" and set it to the longest period of a music file. The Help script is needed, because XMMS has no command-line command to quit, so the process has to be killed after a specified time. Call Script 2 out from your music files directory within an xterm and have a cup of coffee :-) Find resulting RAW files in folder "./raw"


Next Previous Contents