Mido is a Python library for working with MIDI messages and ports. It’s designed to be as straight forward and Pythonic as possible
Questions tagged [mido]
54 questions
1
vote
1 answer
Midi instrument index python
I have some midi files. Each midi file has some instruments. I need to know what instruments each midi file consists. I have found some python libs that can parse midi files such as mido. For example, here is the result of parsing one midi file:
…

Semyon Kirekov
- 1,237
- 8
- 20
0
votes
0 answers
How to get the exact time of all MIDI beats and measure starts?
I have a MIDI file that contains an orchestra piece I wrote, and I want to create punches and streamers for it. If you don't know what that is, that's okay — essentially the gist is I need to know the exact time value that each beat and measure…

Adalex3
- 400
- 4
- 14
0
votes
0 answers
MIDI tuning change messages in MIDO generated files
Can MIDI files written by MIDO provide custom tunings for the MIDI notes according to the MIDI Tuning Standard? And do players like windows media player support them? I am attempting to write a sample MIDI file that achieves this using the following…

user2649681
- 750
- 1
- 6
- 23
0
votes
0 answers
mido + python-rtmidi get_compiled_api() returning "web", no MIDI port detection
I'm currently working on a script to convert MIDI inputs to Virtual Keyboard-style QWERTY outputs. The script I had was correctly working several months ago, but as of now is inexplicably failing to find any of my MIDI inputs.
I'm using the…

Corsaka
- 364
- 3
- 15
0
votes
1 answer
Pianoroll matrix to MIDI conversion
For my project, I have taken midi files, and with the midi2dat function of SoundForge converted them to a matrix with 88 columns, 88 being the number of possible notes. The values in the columns are either 0 or the velocity of the note played. The…

Tria Ufo
- 1
0
votes
1 answer
mido: example code for creating a midifile
I am trying to create a midifile using mido but I didn't find a clear example of how to create a midifile using mido. what I am looking for is the equivilent of this code using midiutil:
degrees = [60, 62, 64, 65, 67, 69, 71, 72] # MIDI note…

Philip Bergwerf
- 67
- 1
- 5
0
votes
0 answers
What do the numbers in the 'value' argument mean in the control change message in mido (regarding bank changes) in python?
I've written a program that successfully writes midi files, and opens them in Logic Pro X on my computer (this program is for personal use only btw, so I'm not worried about it not working on other devices.) I have two questions.
Firstly, I'd like…

joyjam
- 1
0
votes
0 answers
How to split a midi file by bar then randomly re-combine the bars into a new midi file
Let say i have a midi file that has 8 bars, 4/4 and 100bpm.
i want to split it to 8 equal length midi files. Then combine the 8 bars randomly into a new midi file using Python's Mido or any other library.
I tried to get help from chatgpt, it gave me…

memes garage
- 11
- 1
- 1
0
votes
0 answers
Getting a type error when trying to run this python script
Getting this error below. How can I fix it?
1 frames
in create_training_data(data)
39 # Loop through the data and retrieve relevant info
40 for i in range(len(data['energy'])):
---> 41 X[i][0]…

OdinX
- 1
- 1
0
votes
0 answers
Tuple index out of range
Getting this error code. Can someone please tell me what should the correct range be here?
Built a python program for generating music based on user input. But whenever I am trying to run the script I keep getting tuples out of range. I have tried…

OdinX
- 1
- 1
0
votes
1 answer
Can I live capture midi with rtmidi while using Ableton?
I'm creating a pygame that renders midi notes on a grid and I'd like to be able to use the same midi input through Ableton at the same time.
Right now I'm using this to capture:
inport = mido.open_input(synth_name)
msg = inport.receive()
Is there a…

nmowery
- 81
- 1
- 1
- 2
0
votes
1 answer
Kivy slowing down midi playback
I am working on an open-source midi synth and whenever I play back a song that hits multiple notes at the same time, the music is slowing down.
I know I have a pretty wonky implementation (lines 140 and below in the code) because kivy hangs whenever…

Robin De Wolf
- 35
- 11
0
votes
1 answer
Why do I hear no sound when playing midi with mido on macOS?
I can play and hear midi files on macOS with:
timidity song.mid
So I suppose my midi driver is working.
However, I can't hear any sound when playing with mido. Here's my code:
import mido
def play(path: str):
file = mido.MidiFile(path)
…

JasonN
- 1
- 5
0
votes
1 answer
suppress the end of a midi file
I want to remove the end of a midi file in order to have a file of 30 seconds for example.
I tried to compute on each track the total time value and to delete messages each time it is over 30 seconds. However, when I listen to it, it is still the…

soyann
- 1
0
votes
2 answers
How to use QFileDialog to open file with .mid suffix
I have created a subclass for an option to Open File. Alongside PYQT5, I have imported the python library Mido & py-midi in order to read the MIDI files. If my logic is correct. I will use PYQT5's FileDialog in order to retrieve a file, assign it to…

GetMoney_G5
- 73
- 3