Skip to content

Commit 19e98be

Browse files
committed
fix: fix custom instrument data lookup using wrong index
Custom instruments start at `song.header.default_instruments` (currently 16), so when looking up custom instrument data, the default instrument count must be subtracted from the note's instrument ID.
1 parent 817ee6d commit 19e98be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nbswave/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def _mix(
170170
sound1 = self._instruments[note.instrument]
171171
except KeyError: # Sound file missing
172172
if not ignore_missing_instruments:
173-
instrument_data = self._song.instruments[ins]
173+
custom_ins_id = ins - self._song.header.default_instruments
174+
instrument_data = self._song.instruments[custom_ins_id]
174175
ins_name = instrument_data.name
175176
ins_file = instrument_data.file
176177
raise MissingInstrumentException(

0 commit comments

Comments
 (0)