From e10f006a71624bdcc53f0cacc60081a6da0dbe4a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 2 Jan 2012 15:37:44 +0000 Subject: [PATCH] genmidi: Add option for note offset. --- lumps/genmidi/config.py | 9 +++++++++ lumps/genmidi/instrument.py | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lumps/genmidi/config.py b/lumps/genmidi/config.py index da8bb494..43c1ca07 100644 --- a/lumps/genmidi/config.py +++ b/lumps/genmidi/config.py @@ -45,6 +45,15 @@ # # Instrument("file1.sbi", "file2.sbi") # +# To tune the instruments, it's possible to apply an offset to the notes +# that are played. For example, to force all notes down by one octave: +# +# Instrument("file1.sbi", off1=-12) +# +# This can be controlled individually for double-voice instruments, eg. +# +# Instrument("file1.sbi", "file2.sbi", off1=-12, off2=+6) +# # When an instrument is played, the note usually comes from the MIDI # event. Some instruments (especially percussion) always play the same # note. To specify a fixed note, do this: diff --git a/lumps/genmidi/instrument.py b/lumps/genmidi/instrument.py index 66cca2e8..f42917fc 100644 --- a/lumps/genmidi/instrument.py +++ b/lumps/genmidi/instrument.py @@ -72,7 +72,7 @@ def load_instrument(filename): return result class Instrument: - def __init__(self, file1, file2=None, note=None): + def __init__(self, file1, file2=None, off1=0, off2=0, note=None): self.instr1 = load_instrument(file1) if file2 is not None: @@ -81,6 +81,8 @@ class Instrument: self.instr2 = None self.fixed_note = note + self.offset1 = off1 + self.offset2 = off2 NullInstrument = Instrument("dummy.sbi")