Replies: 14 comments 18 replies
-
|
Wondering if maybe millis() is incorrectly faster than it should be. Maybe some issue with the ESP32 Arduino library? |
Beta Was this translation helpful? Give feedback.
-
|
BPM seems generally accurate at 50 BPM, 100 BPM, and 150 BPM (although didn't run it very long), and 110 BPM seems to actually be about 110.3 BPM, and 120 BPM seems to be about 121 BPM. 130 BPM seems to be about 131.6 BPM. 140 BPM seems to be about 141.5 BPM. |
Beta Was this translation helpful? Give feedback.
-
|
By the way, I did change this, so maybe that caused it?: |
Beta Was this translation helpful? Give feedback.
-
|
Seems to maybe be a rounding error. Would using microseconds instead of milliseconds for midi_tick_ms solve that? |
Beta Was this translation helpful? Give feedback.
-
|
As i remember, now it is waiting for timer value to overcome 1 ms and then calls some onTick() method and resets the 1 ms counter. The right action instead would be adding 1000 us for the next triggering value, this would compensate introduced errors when it triggers not at 1000us exactly, but at 1005 or any other "greater or equal than 1000 value", so correct version would set next at 2000, not at 2005. |
Beta Was this translation helpful? Give feedback.
-
|
The code seems to be correct, except for this guard But i am not sure that it is executed ever. Maybe the micros itself are faulty.. dunno |
Beta Was this translation helpful? Give feedback.
-
|
Tick coef is nothing misterious, but [microseconds in 1 second] × [60 seconds in a minute] / [4 quarters notes in a bar] / [ticks in a 16th note] |
Beta Was this translation helpful? Give feedback.
-
|
After about 5 hours or more, I found that 'const float tick_coef = 7477800;' is generally "close enough" (2 MIDI_TICKS_PER_16TH). |
Beta Was this translation helpful? Give feedback.
-
|
By the way, tried adding single "flam" (adding a second drum sound by using that 2 MIDI_TICKS_PER_16TH), but it seems that was too much for the CPU to handle. I may make a more basic sample player to see if that makes it better. Recommend any open source simple sample players (with MIDI) for playing an array of those uint_8t hexadecimal Mono 16 bit PCM samples? Guess it wouldn't be difficult to make one, but adding the MIDI part looks excessive to do if there is already a good one that is efficient. Think there is a sample player in AudioKit, so may look at that to see if it is C or C++ under the Swift code. |
Beta Was this translation helpful? Give feedback.
-
|
For me this version works with no glitches, but I don't know how accurate it is. |
Beta Was this translation helpful? Give feedback.
-
|
Because before this mod, in case when we are late, it forced |
Beta Was this translation helpful? Give feedback.
-
|
They say, the internal quartz is quite reliable to expect +/-3.6 seconds per hour. |
Beta Was this translation helpful? Give feedback.
-
|
By the way, tried the drum roll code again today after the BPM was adjusted to base on milliseconds and using that adjusted coef I posted before, and it thankfully sounds good now. Anyway, here is that simple flam code for inside of do_midi_tick(): |
Beta Was this translation helpful? Give feedback.
-
|
I want to add synth shuffle also, but eliminating that random missing bass drum sound (and adding proper rolling) is higher priority. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Recently tried matching that BPM clock up (in a recording, without connecting USB MIDI), and noticed it seems to drift (think it was a little fast).
Any recommended solution? Is the third party MIDI library causing that, or is there some hw_timer or other config calculation that should be adjusted?
Thanks in advance for recommending a proper solution! (or confirming it's because of a 3rd party library)
Beta Was this translation helpful? Give feedback.
All reactions