File: seq.py

package info (click to toggle)
solfege 3.16.4-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 34,472 kB
  • ctags: 5,287
  • sloc: python: 22,642; xml: 14,196; ansic: 4,682; makefile: 621; sh: 287
file content (43 lines) | stat: -rwxr-xr-x 1,112 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/python2.3

import sys, os
if os.getcwdu()[-4:] == "test":
    sys.path.insert(0, "..")
else:
    sys.path.insert(0, ".")
import soundcard
soundcard.initialise_devicefile("/dev/sequencer2", 2)

s = soundcard.solfege_c_midi

devnum = soundcard.synth.m_devnum
chan = 0
s.seq_start_timer()
#s.seq_set_patch(devnum, chan, 48)

# these two lines are necessary to make the first tone stop.
#s.seq_start_note(devnum, chan, 60, 90)
#s.seq_stop_note(devnum, chan, 60, 90)

#for i in range(500):
#        s.seq_start_note(devnum, chan, 60 + i % 10, 90)
#        s.seq_delta_time(25)
#        s.seq_stop_note(devnum, chan, 60 + i % 10, 90)
s.seq_set_patch(0, 0, 63)
s.seq_set_patch(0, 1, 63)
for i in range(500):
        s.seq_start_note(devnum, 0, 60 + (i*2) % 10, 90)
        s.seq_delta_time(25)
        s.seq_stop_note(devnum, 0, 60 + (i*2) % 10, 90)
        s.seq_start_note(devnum, 1, 60 + (i*2) % 10 + 1, 90)
        s.seq_delta_time(25)
        s.seq_stop_note(devnum, 1, 60 + (i*2) % 10 + 1, 90)



s.seqbuf_dump()

import sys
print "press ENTER to continue"
sys.stdin.readline()
soundcard.synth.close()