1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/python2.2
import sys
sys.path.insert(0, ".")
import soundcard
# This works nice with ALSA and OSS emulation with SB Live card:
soundcard.initialise_devicefile("/dev/music", 2)
# ("/dev/music", 0) fails because the last tone does not stop.
#soundcard.initialise("drvmidi -i d %s")
print """
You should here three major triads:
G G G
E E E_E
C C C_C_C C
(piano) (flute) (strings ens)
Press enter when the sounds are finished.
"""
t = soundcard.Track()
t.set_bpm(120, 4)
t.set_patch(1, 73)
t.set_patch(2, 48)
t.note(4, 0, 60, 100)
t.note(4, 0, 64, 100)
t.note(4, 0, 67, 100)
t.note(4, 1, 60, 100)
t.note(4, 1, 64, 100)
t.note(4, 1, 67, 100)
t.start_note(2, 60, 100)
t.notelen_time(4)
t.start_note(2, 64, 100)
t.notelen_time(4)
t.start_note(2, 67, 100)
t.notelen_time(4)
t.stop_note(2, 60, 100)
t.stop_note(2, 64, 100)
t.stop_note(2, 67, 100)
t.note(2, 2, 60, 100)
soundcard.synth.play_track(t)
import sys
print "press <enter>"
sys.stdin.readline()
#soundcard.synth.close()
|