I am re-writing some idea I tried in browser based on Tone.js and P5js to learn JUCE better with a project…
here is the prototype that wasn’t written in JUCE: http://leventtasel.com/davul.html
(you can click around for different functions… center will start the sequence, left and right areas will change bpm and clicking on circles will add/remove bits for the sequence)
Now I have a working code just for the interface again, written in JUCE but I don’t know how to approach the sound portion in JUCE.
I have been looking at examples but there is no higher level structures I came accross that Tone.js provided such as Player or Tone.Transport to schedule the sound files to play in a loop.
Before I waste more time searching… as only thing close to this, I found was an existing thread with a broken link from 2010 (I built a basic drum sequencer)
I wanted to ask here to see if there might be an example implementation I could follow and if there were some high level structures I am missing that would make it easier to implement without getting too much into buffers
I decided I would go forward doing the sound bits using Synthesiser class and SamplerSound, SamplerVoice classes…
I managed to read in the binary sample wav files referencing this discussion:
and a youtube video I found:
In that video, it is mentioned that I need to call renderNextBlock within a loop it sounds like to render the audio to some output. I set the project up initially as an Animated Application… So I only have my main Component.
Would it be acceptable to call this audio rendering function within the component update call somehow?
I am worried about frame dropping on mobile and going out of sync.
Is there a preferred place to call this renderNextBlock function?
Doing more digging… I feel like I can use this class called AudioDeviceManager with my AnimatedAppComponent.
If anyone would suggest a different approach to perhaps put a Timer on AudioAppComponent or a code that I can look for reference, that would be greatly appreciated \o/
I ended up changing my component into AudioAppComponent and subclassed Timer as well to do the sequencing. getNextAudioBlock, prepareToPlay was a little more convenient than initializing the device as a member, for future reference…