basic midi sequencer
Posted: Tue Apr 21, 2009 2:58 pm
hi,
I'm coding a basic midi sequencer and came toa full stop when I started to think that I cannot implement the ticks (midi pulses) using PureBasics ElapsedMilliseconds().
What I want to do is to have a sequencer with resolution of 96 ticks/pulses per beat. This means (as far as I understand the whole math behind it) that each beat goes through 96 ticks before moving on to the next beat. If thats so how would I make a sequencer that can perfectly play those 96 ticks even at high bpm rates. I tried using the timer but it gave me 15 to 16 milliseconds of time between each call but to play a 200 BPM beat you will need around 3 msec between each tick and this is not achievable using this timer.
This leads me to a conclusion that I am doing it completely wrong. So I wanted to ask you guys which is the best solution to create such perfect timing programs in PB. I know some of the sequencer even use four times and more the resolution than 96. How do they do it? Of course I could skip the whole tick part and just use delay for the appropriate note length but I also would like to implement midi note recording which again means that I will have to use ticks anyway.
thank you,
olby
I'm coding a basic midi sequencer and came toa full stop when I started to think that I cannot implement the ticks (midi pulses) using PureBasics ElapsedMilliseconds().
What I want to do is to have a sequencer with resolution of 96 ticks/pulses per beat. This means (as far as I understand the whole math behind it) that each beat goes through 96 ticks before moving on to the next beat. If thats so how would I make a sequencer that can perfectly play those 96 ticks even at high bpm rates. I tried using the timer but it gave me 15 to 16 milliseconds of time between each call but to play a 200 BPM beat you will need around 3 msec between each tick and this is not achievable using this timer.
This leads me to a conclusion that I am doing it completely wrong. So I wanted to ask you guys which is the best solution to create such perfect timing programs in PB. I know some of the sequencer even use four times and more the resolution than 96. How do they do it? Of course I could skip the whole tick part and just use delay for the appropriate note length but I also would like to implement midi note recording which again means that I will have to use ticks anyway.
thank you,
olby