Hello, I’m a programmer who recently started learning JUCE. I’ve had a project in mind but wanted to ask for some advice on how to start, and what to look into.
Basically, I want to build a 4-part sample-based drum machine with a 16 step sequencer. Additionally, I wanted to have step-based automation for parameters like pitch, volume, amp env, sample choice etc.
Any ideas on where to start? My initial idea was to make a 4-part drum sampler with midi control, then make the 4 part sequencer with midi outs, then link them. That said, is it easier to just make a closed, non-midi system? Any advice is greatly appreciated, thanks!
The MIDI part is the easy one. Making a good sampler is more difficult than it seems so you may want to reuse existing code first (this will also help you understand what it takes to build it yourself):
Got it! I’ll look into Tracktion for making the sequencer. I was thinking of using the pre-built Juce SamplerSound object for the sample part.
Regardless, I’ll look into HISE as well. Just to confirm, the correct approach is to use MIDI, even if the sequencer and instrument are part of the same plugin? Thanks for the help!
I thought you wanted to use MIDI to control your instrument from a MIDI controller or another MIDI source. Internally MIDI is not the best choice because of its limitations. A couple of examples: MIDI1 velocities are limited to a resolution of 127 values and you don’t want to wait for a NoteOff to know the duration of a note.
I think I miscommunicated in my first post. I’m not married to MIDI, it was just the only way I could think to do it. If there’s a better/easier way of connecting the step-sequencer and sampler together, that would be better.
External control of some parameters would be useful, but the idea is to just have the built-in step sequencer perform the modulation/automation of the parameters. Thanks for all the help thus far!
I guess you want to trigger your step sequencer by a midi note? Or should it play all the time?
In audio processing you deal with signals and events. Events are most commonly stored and processed as midi, at least in JUCE.
You are free to create your own event types, but why would you?
That’s a good point. Now that I think about it, it would make most sense for the sequencer to be triggered by and in sync with the VST host/DAW. This would mean synchronizing through MIDI, which resolves the debate. Thanks!
Also a good point. I hadn’t considered that to use an alternative to MIDI would necessitate building it myself, which as you imply is a needless endeavor for my use-case.
I just want to point out that, depending on your goals, there may be other platforms that are easier and more rewarding to work with here. Juce is mostly there for building full-fledged audio applications, and a project like this can take a lot of work (think months), especially for beginners. If all you want to do is experiment with sequencers and samplers, it might be in your interest to do this in Pure Data or some other similar high-level platform.
On the other hand, if you chose this project specifically because you want to get into audio programming, then you’ve come to the right place.
That’s an important point to consider, but I’m definitely in the latter camp. I recently graduated with a CS degree and want to learn the proper tools for audio programming.
Though I’m aware this project will take a lot of work, I’ve been working on smaller things in the meantime just to build up my knowledge/experience.
While MIDI does provide ways to synchronize musical events, it’s not what most DAW’s use internally. To synchronize your sequencer to the host/DAW in a JUCE plugin, you’ll propably want to go look at the AudioPlayHead class and calculate your sequencer timing from there. If you want to create a standalone application, you might want to look at Ableton’s Link library to handle the timing.
It’s best to avoid sending MIDI in and out of your app if you don’t need to, since MIDI uses a different timing system then your application internally, so that’ll complicate things a lot. That doesn’t mean you can’t use MIDI events as an internal representation though.
FWIW, I have some sequencer code on Github and wrote a blog post about it. Not related to JUCE specifically, but most of it applies there as well, I imagine.
Good to know! These are exactly the kind of details I was curious about. Thanks!
The advantage of using MIDI in a plugin is, that the user can work with their own midi. You don’t have to implement anything yourself (but you can).
The Midi timestamps are indeed agnostic of the musical grid (for better or worse).
Eventually you will probably need both, the AudioPlayHead for the sequencer part and the midi for playback user imported midi and to keep track where in the active audio block you play.