I am trying to write a major scale using the mido python library and then apply various control changes to it so I can see what difference it makes to the sound (for example the pedal).

This is my code

    mid = mido.MidiFile()
    track = mido.MidiTrack()
    track.append(mido.MetaMessage('set_tempo', tempo=500000, time=3840))
    track.append(mido.Message('program_change', channel=0, program=1, time=0))
    track.append(mido.Message('control_change', channel=0, control=4, time=0))
    track.append(mido.Message('note_on', channel=0, note=60, velocity=100, time=0))
    track.append(mido.Message('note_off', channel=0, note=60, velocity=100, time=960))

and so on... ( i add the remaining notes)

For some reason the control change seems to have no effect. I have tried placing it prior to the program change and playing around with timing but doesn't seem to have any effect.

Can anyone please explain how to apply control changes when writing your own midi files from scratch?

  • 2
    idk mido at all, but a CC needs a value as well as a CC # – Tetsujin Feb 29 '20 at 16:45
  • Thank you, this was exactly it – staplegun Feb 29 '20 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.