Transpose midi with Drywetmidi

can you tell me how to change the key of all notes of a midi file during playback. I tried with this code but nothing happens.

on click i write midiFile.ProcessNotes(n => n.NoteNumber -= (SevenBitNumber)1,); one semitone less or midiFile.ProcessNotes(n => n.NoteNumber += (SevenBitNumber)1,); one semitone more.

but not work.

1

1 Answer

I'm the author of DryWetMIDI. You're talking about playback, but showing midiFile.ProcessNotes. So what do you want to achieve?

If you want to transpose notes during playback use NoteCallback property. You can see example of usage in the documentation – .

When you get Playback object (via midiFile.GetPlayback() for example), the playback is detached from MIDI file. So there is no any sense to modify the file since those modifications won't be reflected in the Playback.

If you want something different, modify your post and provide as many details as possible.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like