From 9cf767abb45d641b832ed0960d53d7bdd4055031 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 18 Sep 2014 16:37:23 -0300 Subject: Initial import --- README.md | 0 TODO.md | 0 cdrecord | 23 +++++++++++++++++++++ wav2dao | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 README.md create mode 100644 TODO.md create mode 100755 cdrecord create mode 100755 wav2dao diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..e69de29 diff --git a/cdrecord b/cdrecord new file mode 100755 index 0000000..50cd977 --- /dev/null +++ b/cdrecord @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Record an audio cd based on wav files in a folder +# + +if [ -z "$1" ] && [ -d "$1" ]; then + CWD="`pwd`" + cd $1 +fi + +echo CD_DA > toc + +for file in *.wav; do + echo >> toc + echo TRACK AUDIO >> toc + echo FILE \"$file\" 0 >> toc +done + +cdrdao write --speed 8x --device /dev/cdrom1 toc + +if [ ! -z "$CWD" ]; then + cd $CWD +fi diff --git a/wav2dao b/wav2dao new file mode 100755 index 0000000..910aed6 --- /dev/null +++ b/wav2dao @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +use strict 'subs'; +use strict 'refs'; + +@dev = ('--device', '/dev/pg0:0,0'); + +sub help { + print "Syntax: $0 [-H] [options] audiofiles\n"; + print <<"EOF" ; +Use cdrdao on the wav audio file arguments, making an appropriate toc file. +-d cdrw Use cdrw as the CDRW device (default: $dev[1]). +-o file Output the toc file on this file - do not use a temporary file. +-p Perform a 'print-size' cdrdao command. +-i Perform a 'toc-info' cdrdao command. +-c Perform a 'show-toc' cdrdao command. +-t Perform a 'read-test' cdrdao command. +-w Write the CD in DAO mode (default, if no other action is specified). +-s Simulate writing only ('simulate' instead of 'write' command). +-j Do not eject the CD after writing it. +-n Print the cdrdao commands, instead of executing them. +EOF +} + +require 'getopts.pl'; +&Getopts('o:pictwsjnH'); +if ($opt_H) { &help ; exit } +$dev[1] = $opt_d if $opt_d; +$opt_w = 1 unless $opt_p || $opt_i || $opt_c || $opt_t || $opt_w || $opt_s || $opt_o ne ""; + +die "Usage: $0 [options] audiofiles" unless @ARGV; + +$fname = $opt_o ne "" ? $opt_o : "/tmp/toc$$"; +open(F, "> $fname") || die "open($fname): $!, stopped"; +print F "CD_DA\n"; + +foreach (@ARGV) { + print F "\nTRACK AUDIO\nNO COPY\n"; +# print F "NO PRE_EMPHASIS\nTWO_CHANNEL_AUDIO\n"; + print F "FILE \"$_\" 0\n"; +# print F "START 00:02:00\n" if $no++; +} +close F; + +if ($opt_p) { + if ($opt_n) { print "cdrdao print-size $fname\n" } + else { system 'cdrdao', 'print-size', $fname} +} + +if ($opt_i) { + if ($opt_n) { print "cdrdao toc-info $fname\n" } + else { system 'cdrdao', 'toc-info', $fname} +} + +if ($opt_c) { + if ($opt_n) { print "cdrdao show-toc $fname\n" } + else { system 'cdrdao', 'show-toc', $fname} +} +if ($opt_t) { + if ($opt_n) { print "cdrdao read-test $fname\n" } + else { system 'cdrdao', 'read-test', $fname} +} + +if ($opt_w || $opt_s) { + unshift @dev, $opt_s ? 'simulate' : 'write'; + push @dev, '--eject' unless $opt_s || $opt_j; + push @dev, $fname; + if ($opt_n) { print "cdrdao @dev\n" } else { system 'cdrdao', @dev } +} +unlink $fname unless $opt_o ne ""; +__END__ -- cgit v1.2.3