research/opl/novoices/gen-sequence5

92 lines
2.9 KiB
Text
Raw Normal View History

#!/usr/bin/env ruby
def note_on(delay, channel, note, volume)
# note on
putc delay * 6
putc 0x90 + channel
putc note
putc volume
end
def note_off(delay, channel, note)
# note on
putc delay * 6
putc 0x80 + channel
putc note
putc 0x00
end
def program_change(delay, channel, instrument)
putc delay * 6
putc 0xc0 + channel
putc instrument
end
program_change(0x1, 8, 9)
program_change(0x1, 1, 7)
program_change(0x1, 2, 7)
# Turn on some notes and then turn them off, to boost us
# up to the middle of the range of operators.
note_on(0xf, 8, 0x20, 0x40) # voice 1
note_off(0xf, 8, 0x20)
note_on(0xf, 8, 0x21, 0x40) # voice 2
note_off(0xf, 8, 0x21)
note_on(0xf, 8, 0x22, 0x40) # voice 3
note_off(0xf, 8, 0x22)
# Play some notes until we use up all the OPL operators.
note_on(0xf, 8, 0x20, 0x40) # voice 4
note_on(0xf, 1, 0x21, 0x40) # voice 5
note_on(0xf, 2, 0x22, 0x40) # voice 6
note_on(0xf, 8, 0x23, 0x40) # voice 7
note_on(0xf, 1, 0x24, 0x40) # voice 8
note_on(0xf, 2, 0x25, 0x40) # voice 1
note_on(0xf, 8, 0x26, 0x40) # voice 2
note_on(0xf, 1, 0x27, 0x40) # voice 3 3-2-1-8-7-6-5-4
# Now all voices are in use ...
# "no alt" = no inferior channels, first voice from same channel used
note_on(0xf, 8, 0x28, 0x40) # gets v2 2-3-1-8-7-6-5-4 chan 8 < chan 1 (no alt)
note_on(0xf, 1, 0x29, 0x40) # gets v2 chan 1 > chan 8
note_on(0xf, 2, 0x2a, 0x40) # gets v7 7-2-3-1-8-6-5-4 chan 8 < chan 1+2
note_on(0xf, 8, 0x2b, 0x40) # gets v4 4-7-2-3-1-8-6-5 chan 8 < chan 1+2 (no alt)
note_on(0xf, 1, 0x2c, 0x40) # gets v4 chan 1 > chan 8
note_on(0xf, 2, 0x2d, 0x40) # gets v7 7-4-2-3-1-8-6-5 chan 2 < chan 1 (no alt)
note_on(0xf, 8, 0x2e, 0x40) # gets v7 chan 8 > chan 2? (no alt?)
note_on(0xf, 1, 0x2f, 0x40) # gets v7 chan 1 > chan 8
note_on(0xf, 2, 0x30, 0x40) # gets v1 1-7-4-2-3-8-6-5 chan 2 < chan 1 (no alt)
note_on(0xf, 8, 0x31, 0x40) # gets v1 chan 8 > chan 2? (no alt?)
# voices off: 5, 7, 1, 3, 2, 8, 6, 4, 0
note_off(0xf, 8, 0x20)
note_off(0xf, 1, 0x21)
note_off(0xf, 8, 0x22)
note_off(0xf, 1, 0x23)
note_off(0xf, 8, 0x24)
note_off(0xf, 1, 0x25)
note_off(0xf, 8, 0x26)
note_off(0xf, 1, 0x27)
note_off(0xf, 8, 0x28)
note_off(0xf, 1, 0x29)
note_off(0xf, 8, 0x2a)
note_off(0xf, 1, 0x2b)
note_off(0xf, 8, 0x2c)
note_off(0xf, 1, 0x2d)
note_off(0xf, 8, 0x2e)
note_off(0xf, 1, 0x2f)
note_off(0xf, 8, 0x30)
note_off(0xf, 1, 0x31)
# end of track
putc 0x00
putc 0xff
putc 0x2f
putc 0x00