From 1dcaec3cc810791d91e305de393cda548c927e47 Mon Sep 17 00:00:00 2001 From: Jeff Evans Date: Sun, 7 Apr 2024 15:42:55 -0700 Subject: [PATCH] map tracker channels to zero-based midi channels --- S3mToMidi/MidiWriter2.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/S3mToMidi/MidiWriter2.cs b/S3mToMidi/MidiWriter2.cs index bc34a9f..c217219 100644 --- a/S3mToMidi/MidiWriter2.cs +++ b/S3mToMidi/MidiWriter2.cs @@ -60,7 +60,7 @@ public static void Save(Dictionary> allEvents, string path, Mid //Console.Out.WriteLine("Channel {0} NoteOff Pitch {1}", note.Channel, note.Pitch); yield return new NoteOffEvent((SevenBitNumber)ChannelNoteToMidiPitch(note.Pitch), (SevenBitNumber)ChannelVelocityToMidiVolume(note.Velocity)) { - Channel = (FourBitNumber)note.Channel, + Channel = (FourBitNumber)(note.Channel - 1), DeltaTime = GetDeltaTimeForChannelTick(note.Channel, note.Tick, channelLastTicks) }; } @@ -70,7 +70,7 @@ public static void Save(Dictionary> allEvents, string path, Mid { initializedChannels.Add(note.Channel); yield return new ProgramChangeEvent(){ - Channel = (FourBitNumber)note.Channel, + Channel = (FourBitNumber)(note.Channel - 1), ProgramNumber = (SevenBitNumber)0, DeltaTime = GetDeltaTimeForChannelTick(note.Channel, note.Tick, channelLastTicks) }; @@ -78,7 +78,7 @@ public static void Save(Dictionary> allEvents, string path, Mid //Console.Out.WriteLine("Channel {0} NoteOn Pitch {1}", note.Channel, note.Pitch); yield return new NoteOnEvent((SevenBitNumber)ChannelNoteToMidiPitch(note.Pitch), (SevenBitNumber)ChannelVelocityToMidiVolume(note.Velocity)) { - Channel = (FourBitNumber)note.Channel, + Channel = (FourBitNumber)(note.Channel - 1), DeltaTime = GetDeltaTimeForChannelTick(note.Channel, note.Tick, channelLastTicks) }; }