Transpose #428
Unanswered
Mickinator
asked this question in
Q&A
Transpose
#428
Replies: 2 comments 1 reply
-
Hi Morbert, import mido
midi_file = mido.MidiFile("path/to/file")
for message in midi_file.tracks[0]:
if message.type in ('note_on','note_off'):
message.note += 12
midi_file.save("path/to/transposed/file") Changing the channel or velocity can be done the same way. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Grey Alien502,
thanx for your answer. It helps, if I want to send a midi-file. But thats
not my problem.
Zynthian has the controller transpose. You can find it in Options. It
wouldt be very good to edit this parameter via midi ( with a CC or with a
note command on master channel.)
Regards & stay healthy
Norbert
von Norbert Schreiber gesendet
…-----Original-Nachricht-----
Von: GreyAlien502 <[email protected]
<mailto:[email protected]> >
Betreff: Re: [mido/mido] Transpose (#223)
Datum: 11.04.2020, 01:29 Uhr
An: mido/mido <[email protected] <mailto:[email protected]> >
CC: Micki <[email protected]
<mailto:[email protected]> >, Author <
[email protected] <mailto:[email protected]> >
Hi Morbert,
To modify messages, you can set the properties of the mido.Message objects
found in a track.
Here is an example to transpose all notes in a file up 1 octave and save
the output to a new file:
import mido
midi_file = mido.MidiFile("path/to/file")
for message in midi_file.tracks[0]:
if message.type in ('note_on','note_off'):
message.note += 12
midi_file.save("path/to/transposed/file")
Changing the channel or velocity can be done the same way.
There is more information on the Message objects here:
<https://mido.readthedocs.io/en/latest/messages.html>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#223 (comment)> , or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANJNSQJSLPQC3646MRO6VHTRL6TWJANCNFSM4LJTYNBA>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My name is Norbert, i' m 66 and very new with python and mido, but it' s wonderful.
I use a raspi 3B with python and mido for controlling purposes.
I understood, that mido works with messages (e.g. note on = H90 H60 H 30).
I can receive and send it.
But now I want to change the values of each Byte. E.g. I like to change -
I would be very happy, if someone can give me short and simple examples how to do that.
Thanx for helping
Norbert
Beta Was this translation helpful? Give feedback.
All reactions