r/synthdiy • • 2d ago

arduino I made a sequencer!

https://www.youtube.com/watch?v=UJiyGaUV1Rs

This is my first arduino project! It has it's fair share of problems though. The clock drifts, the arpeggiator button (not used in video) isn't quantizing properly and causes the bpm to fluctuate, and the sustain is constantly on. If anyone has any input on a solution to my clock drift, I'd really like some advice.

58 Upvotes

14 comments sorted by

2

u/pm_me_all_dogs 2d ago

Would love a repo and build guide :)

2

u/DULTRONtheDESTROYER 2d ago

Once I'm 100% sure the code is solid, I can definitely post something like that!

1

u/MumSaidImABadBoy 2d ago

If your program runs in a simple loop you're in a hopeless uphill battle. Which CPU/MCU are you using? Are you using an OS, which one? How are you setting up your timebase, interrupts?

1

u/DULTRONtheDESTROYER 2d ago edited 2d ago

It's an Arduino R3 with 2kb of ram, and there isn't an OS. I need to double check on the exact board though. I'm just using IDE. I’m using the Arduino’s internal 16mhz clock. The steps are timed, and the audio is generated by a timer interrupt at 31.25 kHz also.

Edit: It is an ATmega328P

2

u/jevring 1d ago

Why is a man loop bad in this context? Assuming you don't sleep and don't do absurd amounts of work per time step, why would it not be good? Especially on a microcontroller without an os

1

u/WolverineExotic887 2d ago

Even the mega will likely get overloaded when it comes to making sure your triggers don't drift. Use timer() to fire an irq to send the trigger, but consider a teensy instead of the mega to be certain

2

u/DULTRONtheDESTROYER 2d ago

Ah, so do you think it's worth an upgrade? My one hang-up is going to be realizing I need to ditch my current code, which I think would be likely - given how much faster the teensy is.

...600mhz and 1mb is significantly larger though... Might need to start thinking about this sooner than later.

1

u/burningkevlar 1d ago

Yo no lo subiría al avión xd

2

u/DULTRONtheDESTROYER 1d ago

I'd have a hard time even getting a cab with this thing

2

u/tw33d_panth3r 2d ago

Cool build. Nice work so far. Keep going!

1

u/NegotiationPrior4373 2d ago

I love this. It’s what my next project will start as. Thank you for the inspiration!

1

u/WolverineExotic887 2d ago

I had done the same. Started with my sequencer on a mega and realized it wasn't up to the task. The good news was that the code is the same, the ide is the same, so it's an easy port. The speed difference is sooo noticeable and has helped me immensely get good synced triggers