mirror of
https://github.com/chocolate-doom/research.git
synced 2024-11-25 13:31:29 +00:00
9d4ebed414
Subversion-branch: /research Subversion-revision: 1674
46 lines
624 B
Ruby
Executable file
46 lines
624 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
|
|
def note_on(delay, channel, note, volume)
|
|
# note on
|
|
putc delay
|
|
putc 0x90 + channel
|
|
putc note
|
|
putc volume
|
|
end
|
|
|
|
def note_off(delay, channel, note)
|
|
# note on
|
|
putc delay
|
|
putc 0x80 + channel
|
|
putc note
|
|
putc 0x00
|
|
end
|
|
|
|
def program_change(delay, channel, instrument)
|
|
putc delay
|
|
putc 0xc0 + channel
|
|
putc instrument
|
|
end
|
|
|
|
def end_of_track
|
|
putc 0x00
|
|
putc 0xff
|
|
putc 0x2f
|
|
putc 0x00
|
|
end
|
|
|
|
#program_change(0, 8, 36)
|
|
|
|
for i in 0...128
|
|
# note on
|
|
note_on(0xf, 8, i, 0x7b)
|
|
|
|
# note off
|
|
note_off(0xf, 8, i)
|
|
end
|
|
|
|
# end of track
|
|
|
|
end_of_track
|
|
|