Date: Wed, 8 Sep 2004 01:41:09 -0700 From: Miles Keaton <mileskeaton@gmail.com> To: brianfinniff@unixforge.org, questions@freebsd.org Subject: Re: MP3 Audio CD Burning Message-ID: <59b2d39b04090801411c5af974@mail.gmail.com> In-Reply-To: <200409072225.02425.brianfinniff@unixforge.org> References: <200409072225.02425.brianfinniff@unixforge.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 7 Sep 2004 22:25:02 -0500, Brian Finniff <brianfinniff@unixforge.org> wrote: > Is it possible to burn a CD from an .MP3 file? If so, how would I do that? You need to install sox: cd /usr/ports/audio/sox ; make install clean Then I wrote this little PHP script that seems to work well: # go through each file in directory $d = dir($directory); while($file = $d->read()) { # switch file extention (mp3, wav, flac) $ext = substr(strrchr($file, '.'), 1); $file = shellescape($file); switch($ext) { # lame + sox to decode mp3 case 'mp3': $cmd = 'lame --decode ' . $directory . $file . ' ' . $directory . $file . '.wav'; exec($cmd); $cmd = 'sox ' . $directory . $file . '.wav -t raw -s -w -c 2 ' . $directory . $file . '.raw'; exec($cmd); $cmd = 'rm ' . $directory . $file . '.wav'; exec($cmd); break; # flac + sox to decode flac case 'flac': $cmd = 'flac --decode ' . $directory . $file . ' -o ' . $directory . $file . '.wav'; exec($cmd); $cmd = 'sox ' . $directory . $file . '.wav -t raw -s -w -c 2 ' . $directory . $file . '.raw'; exec($cmd); $cmd = 'rm ' . $directory . $file . '.wav'; exec($cmd); break; # wav is ready to sox case 'wav': $cmd = 'sox ' . $directory . $file . ' -t raw -s -w -c 2 ' . $directory . $file . '.raw'; exec($cmd); break; } } $d->close(); # list them in order, to make burncd command-line $rawfiles = shell_exec('ls -l1 ' . $directory . '*.raw'); $filenames = explode("\n", trim($rawfiles)); # escape 'em all foreach($filenames as $key=>$value) { $filenames[$key] = shellescape($value); } print_r($filenames); # burn (and eject) $cmd = 'burncd -dne -f /dev/acd0c -s max audio ' . join(' ', $filenames); exec($cmd);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?59b2d39b04090801411c5af974>