Sedsongs: Difference between revisions

From XPUB & Lens-Based wiki
Line 28: Line 28:
}
}
</source>
</source>
To prepare the midi file, you'd type the following command (assuming the above is called "song.mg":
midge song.mg
This produces an output file (if there were no errors), called "a.mid.out". You can choose a nicer name with the -o option:
midge song.mg -o song.mid


== Shell ==
== Shell ==

Revision as of 00:26, 9 October 2010

tiMIDIty

MIDI is a file format (and general protocol for communication between keyboards and synthesizers) that became popular in the 1980s. Timidity is a good program to play midi files. File:I.mid Play with:

timidity I.mid

Midge

Midge is a program that tranlates a text file in a particular markup language, into a playable (binary) midi file.

A Simple song template:

@head {
    $time_sig 4/4
    $tempo 120
}
@body {

    @channel 1 {
        $patch 1
        $octave 4
        $length 16
        
        # notes here!
        c e g
        
    }
}

To prepare the midi file, you'd type the following command (assuming the above is called "song.mg":

midge song.mg

This produces an output file (if there were no errors), called "a.mid.out". You can choose a nicer name with the -o option:

midge song.mg -o song.mid

Shell

cat <<EOF
@head {
    \$time_sig 4/4
    \$tempo 120
}
@body {
 
    @channel 1 {
        \$patch 1
        \$octave 4
        \$length 16

        # notes here!
EOF

cat

cat <<EOF
    }
}
EOF

sed

s/[^0123456789]//g
s/1/c /g
s/2/c+ /g
s/3/d /g
s/4/d+ /g
s/5/e /g
s/6/f+ /g
s/7/g /g
s/8/g+ /g
s/9/a /g
s/0/a+ /g

pipeline

date | sed -f digits.sed | bash wrap.sh | midge -o sed.mid
timidity sed.mid

Sedsongs.png

File:Date.ogg