C
C#2y ago
nebula_dev

❔ BPM Clock System

I am in the process of making a program similar to SonicPI, in which will allow me to programmatically make music. I have made the sound and file reading logic, but I am stuck on figuring out how to manage the playback timing (BPM): If the user inputs this, and the BPM is 120: thread () { loop (4) { play(piano.wav, C4, 1); } } thread () { loop (4) { play(click.wav, C4, 2); } } It should play a piano note every beat, and a click sound every second beat. I was originally using Thread.Sleep and a few calculations, but it is very out of sync when threads are brought into the mix. Any help would be brilliant 😄
3 Replies
Angius
Angius2y ago
PeriodicTimer perhaps? It's the most time-accurate one
nebula_dev
nebula_devOP2y ago
Alright, I'll check that out thanks
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server