#!/usr/bin/env python
import sys, os
if os.getcwd()[-4:] == "test":
    sys.path.insert(0, "..")
else:
    sys.path.insert(0, ".")
import soundcard
import sys
soundcard.initialise("/dev/sequencer", 0)
#soundcard.initialise("/hom/tom/src/playmidi-2.4/playmidi -a %s")


def f():
        t = soundcard.Track()
        t.start_note(1, 50, 100);
        t.notelen_time(4)
        t.stop_note(1, 50, 100);
        t.start_note(1, 51, 100);
        t.notelen_time(4)
        t.stop_note(1, 51, 100);
        return t
def f2():
        t = soundcard.Track()
        t.set_patch(0, 66)
        t.set_patch(1, 66)
        t.start_note(0, 60, 100)
        t.notelen_time(4)
        t.start_note(0, 60, 100)
        t.notelen_time(4)
        t.stop_note(0, 60, 100)
        t.notelen_time(4)
        t.stop_note(0, 60, 100)
        return t
t = f2()
print "starter og spille"
soundcard.synth.play_track(t)
print "press ENTER to continue"
sys.stdin.readline()
soundcard.synth.close()
