Merge pull request #988 from fragglet/dmxopl

genmidi: Import DMXOPL instruments.
This commit is contained in:
mc776 2023-06-24 13:19:33 -07:00 committed by GitHub
commit 18b2af875c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
293 changed files with 342 additions and 193 deletions

View file

@ -36,190 +36,312 @@
from instrument import Instrument, NullInstrument from instrument import Instrument, NullInstrument
from midi import * from midi import *
# General MIDI instruments: # Note: all instruments must ALWAYS be defined, or use NullInstrument.
# General MIDI instruments:
INSTRUMENTS = [ INSTRUMENTS = [
Instrument("instr001.sbi"), # #001 - Acoustic Grand Piano Instrument('instr001.sbi', 'instr001-2.sbi', # Acoustic Grand Piano
Instrument("instr002.sbi"), # #002 - Bright Acoustic Piano off1=-12, off2=-12, tune=+2),
Instrument("instr003.sbi"), # #003 - Electric Grand Piano Instrument('instr002.sbi', 'instr002-2.sbi', # Bright Acoustic Piano
Instrument("instr004.sbi", "instr004-2.sbi"), # #004 - Honky-tonk Piano off1=-12, off2=-12, tune=+2),
Instrument("instr005.sbi", "instr005-2.sbi"), # #005 - Electric Piano 1 Instrument('instr003.sbi', 'instr003-2.sbi', # Electric Grand Piano
Instrument("instr006.sbi", off1=-12), # #006 - Electric Piano 2 tune=+2),
Instrument("instr007.sbi"), # #007 - Harpsichord Instrument('instr004.sbi', 'instr004-2.sbi', # Honky-tonk Piano
Instrument("instr008.sbi", off1=-12), # #008 - Clavi off1=-12, off2=-12, tune=+10),
Instrument("instr009.sbi", off1=-12), # #009 - Celesta Instrument('instr005.sbi', 'instr005-2.sbi', # Electric Piano (Rhodes)
Instrument("instr010.sbi", off1=-12), # #010 - Glockenspiel off1=-12, off2=-12, tune=+3),
Instrument("instr011.sbi", off1=-12), # #011 - Music Box Instrument('instr006.sbi', 'instr006-2.sbi', # Electric Piano (DX-7)
Instrument("instr012.sbi", off1=-12), # #012 - Vibraphone off1=-12, off2=-12, tune=+4),
Instrument("instr013.sbi", off1=-12), # #013 - Marimba Instrument('instr007.sbi', 'instr007-2.sbi', # Harpsichord
Instrument("instr014.sbi", off1=-12), # #014 - Xylophone off1=-12, off2=-12),
Instrument("instr015.sbi", off1=-12), # #015 - Tubular Bells Instrument('instr008.sbi', 'instr008-2.sbi', # Clavichord
Instrument("instr016.sbi", off1=-12), # #016 - Dulcimer off1=-12, off2=-12),
Instrument("instr017.sbi", off1=-12), # #017 - Drawbar Organ Instrument('instr009.sbi', 'instr009-2.sbi', # Celesta
Instrument("instr018.sbi", off1=-12), # #018 - Percussive Organ off1=-12, off2=-12, tune=+1),
Instrument("instr019.sbi", off1=-12), # #019 - Rock Organ Instrument('instr010.sbi', 'instr010-2.sbi', # Glockenspiel
Instrument("instr020.sbi", off1=-12), # #020 - Church Organ off1=-24, off2=-24),
Instrument("instr021.sbi", off1=-12), # #021 - Reed Organ Instrument('instr011.sbi', 'instr011-2.sbi', # Music Box
Instrument("instr022.sbi", off1=-12), # #022 - Accordion off1=-12, tune=+4),
Instrument("instr023.sbi", off1=-12), # #023 - Harmonica Instrument('instr012.sbi', 'instr012-2.sbi', # Vibraphone
Instrument("instr024.sbi", off1=-12), # #024 - Tango Accordion off1=-12, off2=-12),
Instrument("instr025.sbi", off1=-12), # #025 - Acoustic Guitar (nylon) Instrument('instr013.sbi', 'instr013-2.sbi', # Marimba
Instrument("instr026.sbi", off1=-12), # #026 - Acoustic Guitar (steel) off2=-12),
Instrument("instr027.sbi", off1=-12), # #027 - Electric Guitar (jazz) Instrument('instr014.sbi', off1=-12), # Xylophone
Instrument("instr028.sbi", off1=-12), # #028 - Electric Guitar (clean) Instrument('instr015.sbi', 'instr015-2.sbi', # Tubular Bells
Instrument("instr029.sbi", off1=-12), # #029 - Electric Guitar (muted) off1=-24, off2=-24, tune=+2),
Instrument("instr030.sbi", off1=-12), # #030 - Overdriven Guitar Instrument('instr016.sbi', 'instr016-2.sbi', # Dulcimer
Instrument("instr031.sbi", off1=-12), # #031 - Distortion Guitar off1=-12, off2=-12, tune=+2),
Instrument("instr032.sbi", off1=-12), # #032 - Guitar harmonics Instrument('instr017.sbi', 'instr017-2.sbi', # Drawbar Organ
Instrument("instr033.sbi", off1=-12), # #033 - Acoustic Bass off1=-12, tune=+10),
Instrument("instr034.sbi", off1=-12), # #034 - Electric Bass (finger) Instrument('instr018.sbi', 'instr018-2.sbi', # Percussive Organ
Instrument("instr035.sbi", off1=-12), # #035 - Electric Bass (pick) off1=-24, off2=-24),
Instrument("instr036.sbi", off1=-12), # #036 - Fretless Bass Instrument('instr019.sbi', 'instr019-2.sbi', # Rock Organ
Instrument("instr037.sbi", off1=-12), # #037 - Slap Bass 1 off1=-12, off2=-12, tune=+10),
Instrument("instr038.sbi", off1=-12), # #038 - Slap Bass 2 Instrument('instr020.sbi', 'instr020-2.sbi', # Church Organ
Instrument("instr039.sbi", off1=-12), # #039 - Synth Bass 1 off1=-12, off2=-12, tune=+2),
Instrument("instr040.sbi", off1=-12), # #040 - Synth Bass 2 Instrument('instr021.sbi', 'instr021-2.sbi', # Reed Organ
Instrument("instr041.sbi", off1=-12), # #041 - Violin off1=-12, off2=-12),
Instrument("instr042.sbi", off1=-12), # #042 - Viola Instrument('instr022.sbi', 'instr022-2.sbi', # Accordion
Instrument("instr043.sbi", off1=-12), # #043 - Cello off1=-12, off2=-12, tune=+9),
Instrument("instr044.sbi", off1=-12), # #044 - Contrabass Instrument('instr023.sbi', 'instr023-2.sbi', # Harmonica (DMX FIXED)
Instrument("instr045.sbi", off1=-12), # #045 - Tremolo Strings off1=-12, off2=-12),
Instrument("instr046.sbi", off1=-12), # #046 - Pizzicato Strings Instrument('instr024.sbi', 'instr024-2.sbi', # Tango Accordion
Instrument("instr047.sbi", off1=-12), # #047 - Orchestral Harp off1=-12, off2=-12, tune=+7),
Instrument("instr048.sbi", off1=-12), # #048 - Timpani Instrument('instr025.sbi', 'instr025-2.sbi', # Acoustic Guitar (nylon)
Instrument("instr049.sbi", off1=-12), # #049 - String Ensemble 1 off1=-12, off2=-24),
Instrument("instr050.sbi", off1=-12), # #050 - String Ensemble 2 Instrument('instr026.sbi', 'instr026-2.sbi', # Acoustic Guitar (steel)
Instrument("instr051.sbi", off1=-12), # #051 - SynthStrings 1 off1=-12, off2=-12, tune=+1),
Instrument("instr052.sbi", off1=-12), # #052 - SynthStrings 2 Instrument('instr027.sbi', 'instr027-2.sbi', # Electric Guitar (jazz)
Instrument("instr053.sbi", off1=-12), # #053 - Choir Aahs off1=-12, off2=-12),
Instrument("instr054.sbi", off1=-12), # #054 - Voice Oohs Instrument('instr028.sbi', 'instr028-2.sbi', # Electric Guitar (clean)
Instrument("instr055.sbi", off1=-12), # #055 - Synth Voice off1=-12, off2=-12, tune=+3),
Instrument("instr056.sbi", off1=-12), # #056 - Orchestra Hit Instrument('instr029.sbi', 'instr029-2.sbi', # Electric Guitar (muted)
Instrument("instr057.sbi", off1=-12), # #057 - Trumpet off1=-12, off2=-12),
Instrument("instr058.sbi", off1=-12), # #058 - Trombone Instrument('instr030.sbi', 'instr030-2.sbi', # Overdriven Guitar
Instrument("instr059.sbi", off1=-12), # #059 - Tuba off1=-12, off2=+2, tune=-122),
Instrument("instr060.sbi", off1=-12), # #060 - Muted Trumpet Instrument('instr031.sbi', 'instr031-2.sbi', # Distortion Guitar
Instrument("instr061.sbi", off1=-12), # #061 - French Horn off1=-12, off2=+2, tune=-122),
Instrument("instr062.sbi", off1=-12), # #062 - Brass Section Instrument('instr032.sbi', 'instr032-2.sbi', # Guitar Harmonics
Instrument("instr063.sbi", off1=-12), # #063 - SynthBrass 1 off1=-12, off2=-12, tune=+15),
Instrument("instr064.sbi", off1=-12), # #064 - SynthBrass 2 Instrument('instr033.sbi', 'instr033-2.sbi', # Acoustic Bass
Instrument("instr065.sbi", off1=-12), # #065 - Soprano Sax off1=-12, off2=-12, tune=+2),
Instrument("instr066.sbi", off1=-12), # #066 - Alto Sax Instrument('instr034.sbi', 'instr034-2.sbi'), # Electric Bass (finger)
Instrument("instr067.sbi", off1=-12), # #067 - Tenor Sax Instrument('instr035.sbi', 'instr035-2.sbi', # Electric Bass (pick)
Instrument("instr068.sbi", off1=-12), # #068 - Baritone Sax off1=-12),
Instrument("instr069.sbi", off1=-12), # #069 - Oboe Instrument('instr036.sbi', 'instr036-2.sbi', # Fretless Bass (DMX BUG FIX)
Instrument("instr070.sbi", off1=-12), # #070 - English Horn off1=-12, off2=-12, tune=+3),
Instrument("instr071.sbi", off1=-12), # #071 - Bassoon Instrument('instr037.sbi', 'instr037-2.sbi', # Slap Bass 1
Instrument("instr072.sbi", off1=-12), # #072 - Clarinet off1=-12, off2=-12),
Instrument("instr073.sbi", off1=-12), # #073 - Piccolo Instrument('instr038.sbi', 'instr038-2.sbi', # Slap Bass 2
Instrument("instr074.sbi", off1=-12), # #074 - Flute off1=-12, off2=-12),
Instrument("instr075.sbi", off1=-12), # #075 - Recorder Instrument('instr039.sbi'), # Synth Bass 1
Instrument("instr076.sbi", off1=-12), # #076 - Pan Flute Instrument('instr040.sbi', 'instr040-2.sbi', # Synth Bass 2
Instrument("instr077.sbi", off1=-12), # #077 - Blown Bottle off1=-12, off2=-12, tune=+10),
Instrument("instr078.sbi", off1=-12), # #078 - Shakuhachi Instrument('instr041.sbi', 'instr041-2.sbi', # Violin
Instrument("instr079.sbi", off1=-12), # #079 - Whistle off1=-12, off2=-12),
Instrument("instr080.sbi", off1=-12), # #080 - Ocarina Instrument('instr042.sbi', off1=-12), # Viola
Instrument("instr081.sbi", off1=-12), # #081 - Lead 1 (square) Instrument('instr043.sbi', 'instr043-2.sbi', # Cello
Instrument("instr082.sbi"), # #082 - Lead 2 (sawtooth) off1=-12, off2=-12, tune=+1),
Instrument("instr083.sbi", off1=-12), # #083 - Lead 3 (calliope) Instrument('instr044.sbi', off1=-12), # Contrabass
Instrument("instr084.sbi", off1=-12), # #084 - Lead 4 (chiff) Instrument('instr045.sbi', 'instr045-2.sbi', # Tremolo Strings (DMX)
Instrument("instr085.sbi", off1=-12), # #085 - Lead 5 (charang) off2=-12, tune=+5),
Instrument("instr086.sbi", off1=-12), # #086 - Lead 6 (voice) Instrument('instr046.sbi', 'instr046-2.sbi', # Pizzicato String
Instrument("instr087.sbi", off1=-12), # #087 - Lead 7 (fifths) off1=-12, off2=-12, tune=+10),
Instrument("instr088.sbi", off1=-12), # #088 - Lead 8 (bass + lead) Instrument('instr047.sbi', 'instr047-2.sbi', # Orchestral Harp
Instrument("instr089.sbi", off1=-12), # #089 - Pad 1 (new age) off1=-12, off2=-12, tune=+2),
Instrument("instr090.sbi", off1=-12), # #090 - Pad 2 (warm) Instrument('instr048.sbi', 'instr048-2.sbi', # Timpani (DMX)
Instrument("instr091.sbi", off1=-12), # #091 - Pad 3 (polysynth) off1=-36, off2=-12, tune=+2),
Instrument("instr092.sbi", off1=-12), # #092 - Pad 4 (choir) Instrument('instr049.sbi', 'instr049-2.sbi', # String Ensemble 1 (DMX)
Instrument("instr093.sbi", off1=-12), # #093 - Pad 5 (bowed) off2=-12, tune=+5),
Instrument("instr094.sbi", off1=-12), # #094 - Pad 6 (metallic) Instrument('instr050.sbi', 'instr050-2.sbi', # String Ensemble 2 (DMX)
Instrument("instr095.sbi", off1=-12), # #095 - Pad 7 (halo) off2=-12, tune=+5),
Instrument("instr096.sbi", off1=-12), # #096 - Pad 8 (sweep) Instrument('instr051.sbi', 'instr051-2.sbi', # SynthStrings 1
Instrument("instr097.sbi", off1=-12), # #097 - FX 1 (rain) off1=-12, off2=-24, tune=+4),
Instrument("instr098.sbi", off1=-12), # #098 - FX 2 (soundtrack) Instrument('instr052.sbi', 'instr052-2.sbi', # SynthStrings 2
Instrument("instr099.sbi", off1=-12), # #099 - FX 3 (crystal) off1=-12, off2=-12, tune=+7),
Instrument("instr100.sbi", off1=-12), # #100 - FX 4 (atmosphere) Instrument('instr053.sbi', 'instr053-2.sbi', # Choir Aahs
Instrument("instr101.sbi", off1=-12), # #101 - FX 5 (brightness) off1=-12, off2=-24, tune=+9),
Instrument("instr102.sbi", off1=-12), # #102 - FX 6 (goblins) Instrument('instr054.sbi', 'instr054-2.sbi', # Voice Oohs
Instrument("instr103.sbi", off1=-12), # #103 - FX 7 (echoes) off1=-12, off2=-12, tune=+9),
Instrument("instr104.sbi", off1=-12), # #104 - FX 8 (sci-fi) Instrument('instr055.sbi', 'instr055-2.sbi', # Synth Voice
Instrument("instr105.sbi", off1=-12), # #105 - Sitar off1=-12, off2=-12, tune=+10),
Instrument("instr106.sbi", off1=-12), # #106 - Banjo Instrument('instr056.sbi', 'instr056-2.sbi', # Orchestra Hit
off1=-12, off2=-12, tune=+8),
Instrument('instr057.sbi', off1=-12), # Trumpet (DMX FIXED)
Instrument('instr058.sbi', 'instr058-2.sbi', # Trombone
off1=-12, off2=-12, tune=+2),
Instrument('instr059.sbi', off1=-12), # Tuba
Instrument('instr060.sbi', off1=-24), # Muted Trumpet
Instrument('instr061.sbi', 'instr061-2.sbi', # French Horn
off1=-12, off2=-12, tune=+2),
Instrument('instr062.sbi', 'instr062-2.sbi', # Brass Section
off1=-12, off2=-12, tune=+4),
Instrument('instr063.sbi', 'instr063-2.sbi', # Synth Brass 1
off1=-12, off2=-12, tune=+6),
Instrument('instr064.sbi', 'instr064-2.sbi', # Synth Brass 2
off1=-12, off2=-12, tune=+8),
Instrument('instr065.sbi', off1=-12), # Soprano Sax
Instrument('instr066.sbi', off1=-12), # Alto Sax
Instrument('instr067.sbi'), # Tenor Sax
Instrument('instr068.sbi'), # Baritone Sax
Instrument('instr069.sbi', 'instr069-2.sbi', # Oboe
off1=-12, off2=-12),
Instrument('instr070.sbi', off1=-12), # English Horn
Instrument('instr071.sbi', off1=-12), # Bassoon
Instrument('instr072.sbi', off1=-12), # Clarinet (DMX FIXED)
Instrument('instr073.sbi', off1=-12), # Piccolo
Instrument('instr074.sbi', off1=-12), # Flute
Instrument('instr075.sbi', off1=-12), # Recorder
Instrument('instr076.sbi', 'instr076-2.sbi', # Pan Flute (DMX)
off1=-12, off2=-12, tune=+2),
Instrument('instr077.sbi', 'instr077-2.sbi', # Blown Bottle
off1=-12, off2=-12, tune=+3),
Instrument('instr078.sbi', 'instr078-2.sbi', # Shakuhachi
off1=-12, off2=-12, tune=+2),
Instrument('instr079.sbi', off1=-12), # Whistle
Instrument('instr080.sbi', off1=-12), # Ocarina
Instrument('instr081.sbi', 'instr081-2.sbi', # Lead 1 (square)
off1=-12, off2=-12, tune=+8),
Instrument('instr082.sbi', 'instr082-2.sbi', # Lead 2 (sawtooth)
off1=-12, off2=-12, tune=+7),
Instrument('instr083.sbi', 'instr083-2.sbi', # Lead 3 (calliope)
off1=-12, off2=-12, tune=+7),
Instrument('instr084.sbi', 'instr084-2.sbi', # Lead 4 (chiffer)
off1=-12, off2=-12, tune=-2),
Instrument('instr085.sbi', off1=-12), # Lead 5 (charang)
Instrument('instr086.sbi', 'instr086-2.sbi', # Lead 6 (Voice)
off1=-12, off2=-12, tune=+10),
Instrument('instr087.sbi', 'instr087-2.sbi', # Lead 7 (5th sawtooth)
off2=-5, tune=-3),
Instrument('instr088.sbi', 'instr088-2.sbi', # Lead 8 (Lead+Bass)
tune=+2),
Instrument('instr089.sbi', 'instr089-2.sbi', # Pad 1 (new age)
off1=-12, off2=-12, tune=+5),
Instrument('instr090.sbi', 'instr090-2.sbi', # Pad 2 (warm)
off1=-12, off2=-12, tune=+7),
Instrument('instr091.sbi', 'instr091-2.sbi', # Pad 3 (polysynth)
off1=-12, off2=-12, tune=+5),
Instrument('instr092.sbi', 'instr092-2.sbi', # Pad 4 (choir)
off1=-12, off2=-12, tune=+10),
Instrument('instr093.sbi', 'instr093-2.sbi', # Pad 5 (bowed glass)
off1=-12, off2=-12, tune=+7),
Instrument('instr094.sbi', 'instr094-2.sbi', # Pad 6 (metal)
off1=-12, off2=-12, tune=+4),
Instrument('instr095.sbi', 'instr095-2.sbi', # Pad 7 (halo)
off1=-12, off2=-12, tune=+6),
Instrument('instr096.sbi', 'instr096-2.sbi', # Pad 8 (sweep)
off1=-12, off2=-12, tune=+7),
Instrument('instr097.sbi', 'instr097-2.sbi', # FX 1 (rain)
off1=-12, off2=-12, tune=+6),
Instrument('instr098.sbi', 'instr098-2.sbi', # FX 2 (soundtrack)
off1=-12, off2=-5, tune=+8),
Instrument('instr099.sbi', 'instr099-2.sbi', # FX 3 (crystal)
off1=-12, off2=-12, tune=+7),
Instrument('instr100.sbi', 'instr100-2.sbi', # FX 4 (atmosphere)
off1=-12, off2=-12, tune=-3),
Instrument('instr101.sbi', 'instr101-2.sbi', # FX 5 (brightness)
off1=-12, off2=-12, tune=+8),
Instrument('instr102.sbi', 'instr102-2.sbi', # FX 6 (goblin)
off1=-12, off2=-12, tune=-5),
Instrument('instr103.sbi', 'instr103-2.sbi', # FX 7 (echo drops)
off1=-12, off2=-12, tune=+9),
Instrument('instr104.sbi', 'instr104-2.sbi', # * FX 8 (star-theme)
off1=-12, off2=-12, tune=+5),
Instrument('instr105.sbi', 'instr105-2.sbi', # Sitar
off1=-12, off2=-12, tune=+2),
Instrument('instr106.sbi', 'instr106-2.sbi', # Banjo
off1=-12, off2=-12),
Instrument("instr107.sbi", off1=-12), # #107 - Shamisen Instrument("instr107.sbi", off1=-12), # #107 - Shamisen
Instrument("instr108.sbi", off1=-12), # #108 - Koto Instrument('instr108.sbi', off1=-12), # Koto
Instrument("instr109.sbi", off1=-12), # #109 - Kalimba Instrument('instr109.sbi', off1=-12), # Kalimba
Instrument("instr110.sbi", off1=-12), # #110 - Bag pipe Instrument('instr110.sbi', 'instr110-2.sbi', # Bag Pipe
Instrument("instr111.sbi", off1=-12), # #111 - Fiddle off1=-12, off2=-12, tune=+4),
Instrument("instr112.sbi", off1=-12), # #112 - Shanai Instrument('instr111.sbi', off1=-12), # Fiddle
Instrument("instr113.sbi", off1=-12), # #113 - Tinkle Bell Instrument('instr112.sbi', off1=-12), # Shanai
Instrument("instr114.sbi", off1=-12), # #114 - Agogo Instrument('instr113.sbi', off1=-7), # Tinkle Bell
Instrument("instr115.sbi", off1=-12), # #115 - Steel Drums Instrument('instr114.sbi', off1=-12), # Agogo
Instrument("instr116.sbi", off1=-12), # #116 - Woodblock Instrument('instr115.sbi', 'instr115-2.sbi', # Steel Drums
Instrument("instr117.sbi", off1=-12), # #117 - Taiko Drum off1=-12, off2=-12, tune=+2),
Instrument("instr118.sbi", off1=-12), # #118 - Melodic Tom Instrument('instr116.sbi', off1=-12), # Woodblock
Instrument("instr119.sbi", off1=-12), # #119 - Synth Drum Instrument('instr117.sbi', 'instr117-2.sbi', # Taiko Drum (new)
Instrument("instr120.sbi", off1=-12), # #120 - Reverse Cymbal off1=-24, off2=-12),
Instrument("instr121.sbi", off1=-12), # #121 - Guitar Fret Noise Instrument('instr118.sbi', 'instr118-2.sbi', # Melodic Tom
Instrument("instr122.sbi", off1=-12), # #122 - Breath Noise off1=-12),
Instrument("instr123.sbi", off1=-12), # #123 - Seashore Instrument('instr119.sbi', 'instr119-2.sbi', # Synth Drum
Instrument("instr124.sbi", off1=-12), # #124 - Bird Tweet off1=-24, off2=-12),
Instrument("instr125.sbi", off1=-12), # #125 - Telephone Ring Instrument('instr120.sbi', 'instr120-2.sbi', # Reverse Cymbal
Instrument("instr126.sbi", off1=-12), # #126 - Helicopter off1=-12, tune=+7),
Instrument("instr127.sbi", off1=-12), # #127 - Applause Instrument('instr121.sbi', off1=-26), # Guitar Fret Noise (DMX)
Instrument("instr128.sbi", off1=-12), # #128 - Gunshot Instrument('instr122.sbi', 'instr122-2.sbi', # Breath Noise
off1=-12, off2=-12),
Instrument('instr123.sbi', 'instr123-2.sbi', # Seashore
note=O0.F, off1=-35, off2=-36),
Instrument('instr124.sbi'), # Bird Tweet
Instrument('instr125.sbi', 'instr125-2.sbi', # Telephone Ring
off1=-36, off2=-32),
Instrument('instr126.sbi', 'instr126-2.sbi', # Helicopter
note=On4.F, off1=-48, off2=-26),
Instrument('instr127.sbi', 'instr127-2.sbi', # Applause
note=O0.F, off1=-48, off2=-47),
Instrument('instr128.sbi', off1=-12), # Gun Shot
] ]
# Percussion instruments: # Percussion instruments:
# Note: Many of these instruments have not been defined yet.
# As these are percussion instruments, a note number should ALWAYS be
# specified.
PERCUSSION = [ PERCUSSION = [
Instrument("perc35.sbi", note=On4.A), # #35 Acoustic Bass Drum Instrument('perc35.sbi', note=On3.Cs), # Acoustic Bass Drum
Instrument("perc36.sbi", note=On4.A), # #36 Bass Drum 1 Instrument("perc36.sbi", note=On4.A), # #36 Bass Drum 1
Instrument("perc37.sbi", note=On1.C), # #37 Side Stick Instrument('perc37.sbi', 'perc37-2.sbi', # Slide Stick
Instrument("perc38.sbi", note=On3.Gs), # #38 Acoustic Snare note=O0.Cs),
Instrument("perc39.sbi", note=O3.C), # #39 Hand Clap Instrument('perc38.sbi', 'perc38-2.sbi', # Acoustic Snare
Instrument("perc40.sbi", note=On1.Cs), # #40 Electric Snare note=On2.D, off1=-12),
Instrument("perc41.sbi", note=On3.D), # #41 Low Floor Tom Instrument('perc39.sbi', 'perc39-2.sbi', # Hand Clap
Instrument("perc42.sbi", note=O1.Gs), # #42 Closed Hi Hat note=On2.Cs, off1=-12, off2=-14),
Instrument("perc43.sbi", note=On3.Gs), # #43 High Floor Tom Instrument('perc40.sbi', 'perc40-2.sbi', # Electric Snare
Instrument("perc44.sbi", note=O1.Gs), # #44 Pedal Hi-Hat note=On2.D, off1=-4, off2=-11),
Instrument("perc45.sbi", note=On2.C), # #45 Low Tom Instrument('perc41.sbi', # Low Floor Tom
Instrument("perc46.sbi", note=O1.Gs), # #46 Open Hi-Hat note=On3.Gs, off1=-12),
Instrument("perc47.sbi", note=On2.Fs), # #47 Low-Mid Tom Instrument('perc42.sbi', 'perc42-2.sbi', # Closed High-Hat
Instrument("perc48.sbi", note=On2.A), # #48 Hi-Mid Tom note=On1.C, off1=-17, off2=-12, tune=-122),
Instrument("perc49.sbi", note=On1.C), # #49 Crash Cymbal 1 Instrument('perc43.sbi', # High Floor Tom
Instrument("perc50.sbi", note=On1.Cs), # #50 High Tom note=On3.As, off1=-12),
Instrument("perc51.sbi", note=On1.B), # #51 Ride Cymbal 1 Instrument('perc44.sbi', # Pedal High Hat
Instrument("perc52.sbi", note=On1.C), # #52 Chinese Cymbal note=On1.C, off1=-17),
Instrument("perc53.sbi", note=O1.E), # #53 Ride Bell Instrument('perc45.sbi', # Low Tom
Instrument("perc54.sbi", note=O0.E), # #54 Tambourine note=On2.Cs, off1=-12),
NullInstrument, # TODO - #55 Splash Cymbal Instrument('perc46.sbi', 'perc46-2.sbi', # Open High Hat
NullInstrument, # TODO - #56 Cowbell note=On1.C, off1=-17, off2=-12, tune=-122),
Instrument("perc57.sbi", note=On1.As), # #57 Crash Cymbal 2 Instrument('perc47.sbi', # Low-Mid Tom
NullInstrument, # TODO - #58 Vibraslap note=On2.E, off1=-12),
Instrument("perc59.sbi", note=O0.E), # #59 Ride Cymbal 2 Instrument('perc48.sbi', # Hi-Mid Tom
NullInstrument, # TODO - #60 Hi Bongo note=On2.G, off1=-12),
NullInstrument, # TODO - #61 Low Bongo Instrument('perc49.sbi', 'perc49-2.sbi', # Crash Cymbal 1
NullInstrument, # TODO - #62 Mute Hi Conga note=O0.Cs, tune=+6),
NullInstrument, # TODO - #63 Open Hi Conga Instrument('perc50.sbi', # High Tom
NullInstrument, # TODO - #64 Low Conga note=On2.As, off1=-12),
NullInstrument, # TODO - #65 High Timbale Instrument('perc51.sbi', 'perc51-2.sbi', # Ride Cymbal 1
NullInstrument, # TODO - #66 Low Timbale note=O0.C, tune=+4),
NullInstrument, # TODO - #67 High Agogo Instrument('perc52.sbi', 'perc52-2.sbi', # Chinses Cymbal
NullInstrument, # TODO - #68 Low Agogo note=O1.G, off2=-1, tune=+5),
Instrument('perc53.sbi', # Ride Bell
note=O0.D, off1=-12),
Instrument('perc54.sbi', 'perc54-2.sbi', # Tambourine
note=O1.Gs, tune=+8),
Instrument('perc55.sbi', 'perc55-2.sbi', # Splash Cymbal
note=O0.G, off1=-12, off2=-11, tune=+5),
Instrument('perc56.sbi', note=On1.As), # Cowbell
Instrument('perc57.sbi', 'perc57-2.sbi', # Crash Cymbal 2
note=O0.D, tune=+6),
Instrument('perc58.sbi', note=On3.C), # Vibraslap
Instrument('perc59.sbi', note=O0.Cs), # Ride Cymbal 2
Instrument('perc60.sbi', 'perc60-2.sbi', # High Bongo (New)
note=On2.F, off1=-6, off2=-12),
Instrument('perc61.sbi', 'perc61-2.sbi', # Low Bongo (New)
note=On3.B, off2=-12),
Instrument('perc62.sbi', 'perc62-2.sbi', # Mute high conga (New)
note=On3.F, off1=-12, off2=-2),
Instrument('perc63.sbi', 'perc63-2.sbi', # Open High Conga (New)
note=On2.F, off1=-4, off2=-12),
Instrument('perc64.sbi', 'perc64-2.sbi', # Low Conga (New)
note=On2.Cs, off1=-4, off2=-12),
Instrument('perc65.sbi', note=On1.G), # High Timbale
Instrument('perc66.sbi', note=On1.C), # Low Timbale
Instrument('perc67.sbi', 'perc67-2.sbi', # High Agogo
note=O1.Fs, off2=-6),
Instrument('perc68.sbi', 'perc68-2.sbi', # Low Agogo
note=O1.Cs, off2=-1),
NullInstrument, # TODO - #69 Cabasa NullInstrument, # TODO - #69 Cabasa
Instrument("perc70.sbi", note=On5.E), # #70 Maracas Instrument('perc70.sbi', note=On2.E), # Maracas
Instrument("perc71.sbi", note=On5.E), # #71 Short Whistle Instrument('perc71.sbi', note=On2.A), # Short Whistle
Instrument("perc72.sbi", note=On5.E), # #72 Long Whistle Instrument('perc72.sbi', note=On2.Fs), # Long Whistle
Instrument("perc73.sbi", note=On5.E), # #73 Short Guiro Instrument('perc73.sbi', 'perc73-2.sbi', # Short Guiro
Instrument("perc74.sbi", note=On5.E), # #74 Long Guiro note=On1.C, off1=-12, off2=-12),
Instrument("perc75.sbi", note=On5.E), # #75 Claves Instrument('perc74.sbi', 'perc74-2.sbi', # Long Guiro
note=On1.C, off1=-12, off2=-12),
Instrument('perc75.sbi', note=O1.Cs), # Claves
Instrument("perc76.sbi", note=On5.E), # #76 Hi Wood Block Instrument("perc76.sbi", note=On5.E), # #76 Hi Wood Block
Instrument("perc77.sbi", note=On5.E), # #77 Low Wood Block Instrument("perc77.sbi", note=On5.E), # #77 Low Wood Block
Instrument("perc78.sbi", note=On5.E), # #78 Mute Cuica Instrument('perc78.sbi', note=On4.E), # Mute Cuica
Instrument("perc79.sbi", note=On5.E), # #79 Open Cuica Instrument('perc79.sbi', note=On4.E), # Open Cuica
Instrument("perc80.sbi", note=On5.E), # #80 Mute Triangle Instrument('perc80.sbi', note=O2.Fs), # Mute Triangle
Instrument("perc81.sbi", note=On5.E), # #81 Open Triangle Instrument('perc81.sbi', note=O2.Fs), # Open Triangle
] ]

View file

@ -26,23 +26,41 @@ def instr_to_str_def(filename, filename2, instr):
if is_null_voice(instr.voice1): if is_null_voice(instr.voice1):
return "NullInstrument" return "NullInstrument"
args = ['"%s"' % filename] file_args = "%r" % filename
if instr.voice2 is not None: if instr.voice2 is not None:
args.append('"%s"' % filename2) file_args += ", %r" % filename2
instr_name = instr.voice1["name"]
extra_args = []
if instr.fixed_note is not None: if instr.fixed_note is not None:
args.append("note=%s" % midi.def_for_note(instr.fixed_note)) extra_args.append("note=%s" % midi.def_for_note(instr.fixed_note))
if instr.offset1 != 0: if instr.offset1 != 0:
args.append("off1=%i" % instr.offset1) extra_args.append("off1=%+i" % instr.offset1)
if instr.offset2 != 0: if instr.offset2 != 0:
args.append("off2=%i" % instr.offset2) extra_args.append("off2=%+i" % instr.offset2)
if instr.tune != 0:
extra_args.append("tune=%+i" % instr.tune)
return "Instrument(%s)" % (", ".join(args)) extra_args = ", ".join(extra_args)
if extra_args:
file_args += ", "
if len(file_args + extra_args) <= 32:
return "\tInstrument(%s%s), %s# %s" % (
file_args, extra_args,
" " * (32 - len(file_args + extra_args)),
instr_name)
return "\tInstrument(%s %s# %s\n\t %s)," % (
file_args.strip(),
" " * (35 - len(file_args)), instr_name,
extra_args)
def print_instr_def(filename, filename2, instr): def print_instr_def(filename, filename2, instr):
print("\t%s," % instr_to_str_def(filename, filename2, instr)) print(instr_to_str_def(filename, filename2, instr))
def dump_instrument(filename, filename2, instr): def dump_instrument(filename, filename2, instr):
@ -65,6 +83,9 @@ instruments = genmidi.read(sys.argv[1])
main_instrs = instruments[0:128] main_instrs = instruments[0:128]
percussion = instruments[128:] percussion = instruments[128:]
print("# Note: all instruments must ALWAYS be defined, or use NullInstrument.")
print("")
print("# General MIDI instruments:")
print("INSTRUMENTS = [") print("INSTRUMENTS = [")
for i in range(len(main_instrs)): for i in range(len(main_instrs)):
@ -76,6 +97,7 @@ for i in range(len(main_instrs)):
print("]") print("]")
print("") print("")
print("# Percussion instruments:")
print("PERCUSSION = [") print("PERCUSSION = [")
for i in range(len(percussion)): for i in range(len(percussion)):

View file

@ -78,7 +78,7 @@ def encode_instrument(instrument):
else: else:
fixed_note = 0 fixed_note = 0
header = struct.pack("<hBB", flags, 128, fixed_note) header = struct.pack("<hBB", flags, 128 + instrument.tune, fixed_note)
return header + instr1_data + instr2_data return header + instr1_data + instr2_data
@ -123,7 +123,7 @@ def decode_voice(data, name):
result["m_ksl_volume"] = result["m_ksl"] | result["m_volume"] result["m_ksl_volume"] = result["m_ksl"] | result["m_volume"]
result["c_ksl_volume"] = result["c_ksl"] | result["c_volume"] result["c_ksl_volume"] = result["c_ksl"] | result["c_volume"]
result["name"] = name.decode("ascii").rstrip("\0") result["name"] = name.decode("ascii").rstrip("\0").rstrip()
return result return result
@ -149,7 +149,8 @@ def decode_instrument(data, name):
fixed_note = None fixed_note = None
return Instrument( return Instrument(
voice1, voice2, off1=offset1, off2=offset2, note=fixed_note voice1, voice2, off1=offset1, off2=offset2, note=fixed_note,
tune=finetune - 128
) )

View file

@ -9,6 +9,8 @@ import sys
import sbi_file import sbi_file
import a2i_file import a2i_file
DO_OPL2_CHECK = False
# Check the specified instrument data is OPL2-compatible and does not # Check the specified instrument data is OPL2-compatible and does not
# use any OPL3 features. Returns an error message, or 'None' if data # use any OPL3 features. Returns an error message, or 'None' if data
# is valid. # is valid.
@ -50,13 +52,14 @@ def load_instrument(filename):
else: else:
raise Exception("Unknown instrument file type: '%s'" % filename) raise Exception("Unknown instrument file type: '%s'" % filename)
if DO_OPL2_CHECK:
check_opl2(filename, result) check_opl2(filename, result)
return result return result
class Instrument: class Instrument:
def __init__(self, file1, file2=None, off1=0, off2=0, note=None): def __init__(self, file1, file2=None, off1=0, off2=0, note=None, tune=0):
self.voice1 = load_instrument(file1) self.voice1 = load_instrument(file1)
if file2 is not None: if file2 is not None:
@ -67,6 +70,7 @@ class Instrument:
self.fixed_note = note self.fixed_note = note
self.offset1 = off1 self.offset1 = off1
self.offset2 = off2 self.offset2 = off2
self.tune = tune
NullInstrument = Instrument("dummy.sbi") NullInstrument = Instrument("dummy.sbi")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more