Arduino drum machine

I got it working, works great and sounds great! But is there at least a way to add a clock in? I found a clock and reset out which work fine, but if I want a clock in, what do I have to add to the code or what schematic would I use? Or are there any examples I can use?

2 Likes

As I’ve said I’ve never done it but I’d look at the tempo section of the script and separate out the speed setting from the pot control.
Pick a spare digital pin. Use a npn transistor and a signal diode. After that it’s reading.

1 Like

If you are already using arduino, you can just use a digital out pin. Just set it on and set it off to pulse, and loop with a sleep equal to the frequency you need. Doing a knob which will let you change this frequency is also possible, just normalize the values of your frequency range and map the across 0-1023 since the ardunios analog to digital conversation will take your pots analog pin and do the magic needed to turn it into numbers.

If you need a better explanation with code n junk I’ll gladly assist, I’m just away from the computer atm.

Usually, sequencers and midi clocks use the PPQ (Pulses per quarter note) unit of measurement. We could use Hz, but in reality, what is usually more useful for musicians are things that translate easily to things like BPM.

I should mention, i have not implemented this before, but i imagine the code should be simple enough.
-edit- I am back at my computer, so ill whip something up and see if im right.

4 Likes

As I was going through and coding a simple clock with duty cycle and other stuff i realized that I might be wasting my time if someone already implemented this. It sometimes pays to look for existing libs for this. Ive included the code here just for transparency.

Im going to hold off on this and take a look for work that has already been done regarding this since interrupts are going to be involved for good timing protocols.

Bringing the convo back to MIDI, its actually not too big a deal to implement a midi sequencer with an arduino. Personally, the easiest route here i think is to have a separate arduino for your sequencing duties, and plug it into your drums to trigger. @lookmumnocomputer has a project for a sequencer called the “BIG BUTTON” which was made alongside the Sparkfun WAV trigger.

5 Likes

for Midi & Sync out, the guy (very sympathic) send me the code and schem, i just ask to him if i can share it here for all.

1 Like

here’s a part of his answer :

Yes, please share it.
Please note I didn’t write the MIDI out code - someone else kindly shared it with me and I don’t know who originally added this to the O2 sketch, but I can’t take any credit for it.

here’s the schem

and code :

6 Likes

Hey @Dud , please pass on my/our thanks for this share. Much appreciated

1 Like

Hello!
It was I that shared the code/schematics with Dud - glad to see folks here are investigating the MiniPops O2 further.
However, I just realised the version shared doesn’t use the original samples - some may have already noticed the sounds in the code here are somewhat ‘experimental’ sounding, or just plain awful!
My apologies.
Of course, you can simply cut and paste the relevant MIDI stuff to your existing sketches but it might be best to replace the shared file above with an authentic sounding version for anyone coming to this afresh.

@Dud - I will email you a replacement, if you wish to re-upload it.

Cheers!

7 Likes

Thank you again @jackwildchurch! The original sample code would very much appreciated.

I was looking at some arduino code from notes and volts that reads a dip switch on initiation to determine a MIDI channel.
Reading your post, I was wondering if there would be space to include a switch to select alternative sets of samples in the code to populate the program on startup or reset. What do you think?

1 Like

Yes thx again, i’ve changed it !

1 Like

@Farabide It would take someone far cleverer than I to know if that’s even possible - I’m certainly no coder.
One thing I do know is the samples take up most of the memory so having different sets on board that you could switch between seems unlikely - but don’t take my word for it!
I’m trying some different samples and patterns for another build right now so I’ll endeavour to share the results if it works out OK.
I built the notes and volts auduino synth incorporating the dip switch to determine the MIDI channel but that was for MIDI in. I’m hoping someone will eventually sort out how to add MIDI in to the MiniPops - that would be awesome!

3 Likes

@Dud hopefully there are no further issues but if anyone finds it doesn’t sound right in any way, please let me know. I’ve got several iterations of the code where I’ve tweaked things (unsuccessfully) and I haven’t been very organised in filing things - hence the initial mix-up here.

3 Likes

Hi,
I’ve built another minipops using some different samples and patterns.
For drums I’ve used an 808 kick, hi-hat and snare, plus tom and cymbal from a casiotone but kept jan’s original cowbell, clave and maracas.
I’ve attempted some ‘breakbeat’ type patterns - there are 12, selected by push buttons (2 banks of six).

Getting samples to sound half decent within the limits of the arduino sketch took more time than building the hardware! I’m still not sure if it’s OK. Has anyone else created their own sounds?
Anyway, here’s a video that hopefully gives an idea of how it sounds:

EDIT: not sure how to get youtube videos to appear within the post - do I need to attain a certain discourse ‘trust level’?

6 Likes

really nice work !
btw you can make a space after your video link to show it dirrectely here :slightly_smiling_face:

1 Like

@Dud Thanks - I’m not sure what ‘make a space’ is…could you explain more?

after your link put a space (the big space bar on the keyboard )
or the “enter” button do the trick too

or you’re right and you can not do it for the moment, i don’t know for this

2 Likes

Thanks again (and to Caustic for editing) - hopefully I’ll know what to do next time

2 Likes

The problem was discourse was treating it as an embedded hyperlink. All you need to do for streaming sites etc is copy past the url on one line and it autoformats.

1 Like

Hey !
That’s a really great build !
I am myself building one with custom samples and patterns that I want to use for a live show (if there is still such a thing…) but the potentiometer for choosing pattern is making it hard to be accurate.
Would you be willing to share you code for the button selection ?

Thanks! There’s no code specific to the button selection. It’s just a case of wiring resistors in a chain so that each button makes contact at some point along the chain, thereby replicating the potentiometer but with discreet steps . A similar thing can be done with a rotary switch. I also found the potentiometer approach uncertain so I prefer this way.
I can post a wiring diagram if that helps.
Cheers

2 Likes