Skip to content

Commit

Permalink
map tracker channels to zero-based midi channels
Browse files Browse the repository at this point in the history
  • Loading branch information
reznet committed Apr 7, 2024
1 parent 354295b commit 1dcaec3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions S3mToMidi/MidiWriter2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void Save(Dictionary<int, List<Event>> 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)
};
}
Expand All @@ -70,15 +70,15 @@ public static void Save(Dictionary<int, List<Event>> 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)
};
}
//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)
};
}
Expand Down

0 comments on commit 1dcaec3

Please sign in to comment.