python-midi icon indicating copy to clipboard operation
python-midi copied to clipboard

Get relative tick respecting the tempo?

Open Enovale opened this issue 6 years ago • 10 comments

Maybe this has been asked before, but when I use the ticks of NoteOnEvents and NoteOffEvents, when reesembled, the notes are much longer than the original midi and there is more space in between. I'd rather not convert to absolute ticks if possible, i just want relative ticks that work with tempo

Enovale avatar Jan 08 '19 01:01 Enovale

Sounds like your resolution (ticks per beat) is changing when you don't intend it to. Are you creating a new sequence, moving notes from one sequence to another, or just modifying one sequence in place?

semininja avatar Jan 08 '19 03:01 semininja

I'm putting the notes into a completely tempo-less environment, outside of MIDI

I'm using the ticks like they're milliseconds, basically (which i'm now realizing is not correct)

Enovale avatar Jan 08 '19 03:01 Enovale

You might want to inspect the README a bit more closely; there's some good info there.

semininja avatar Jan 08 '19 04:01 semininja

I understand how tempo and ticks work, I was just being absent minded and forgot while coding. Even so, I still don't know how to do what im trying to do

Enovale avatar Jan 08 '19 05:01 Enovale

What is it that you're trying to do? I might be able to offer some more specific assistance.

semininja avatar Jan 08 '19 05:01 semininja

Basically, i'm using the ticks on the NoteOffEvents and NoteOnEvents to make a list of strings accordingly, that im using as Arduino C code. Formatted like this:

beep(NoteOnData1, TheNextEventInMidiTick); delay(NoteOnTick); beep(NextNoteOnData1); etc etc Like this: https://gist.github.com/nicksort/4736535

I hope that makes sense. the places where ticks are used should be in miliseconds, not the random nature of ticks per beat, which is the problem

EDIT: Weird format issues

Enovale avatar Jan 08 '19 13:01 Enovale

Any ideas @semininja ?

Enovale avatar Jan 08 '19 20:01 Enovale

I think basically, I just need a way to convert ticks to miliseconds.

Enovale avatar Jan 09 '19 03:01 Enovale

Divide your tempo value (given in microseconds per beat) by your resolution (ticks per beat) to get microseconds per tick.

semininja avatar Jan 09 '19 03:01 semininja

alright. I think I figured it out and fixed my problem...

Well now i'm curious if theres a way to convert all chords (or multiple NoteOnEvents without a NoteOff in between) to single NoteOns with NoteOffs, but maybe thats a question for a new issue

Enovale avatar Jan 09 '19 05:01 Enovale