Arduino Synth - FM Dual-Voice Generative Synth | Mozzi library | Volca form-factor
Вставка
- Опубліковано 1 лип 2024
- DIY synth build with Arduino Nano Dual-voice 2-OP FM & Generative Polymetric Sequencer using Mozzi SDK.
An evolution of my first Mozzi synth build, this one features dual independent 2-operator FM voices paired with a 2-track generative sequencer.
Each voice has independent carrier & modulator waveforms, FM ratio, envelope & LFO.
Both tracks share the a single pattern (inspired by the Intellijel Metropolix) and can be stacked in unison or have different polymetric step-counts. Track 1 can be offset 0-3 octaves above track 2 for separate bass & lead.
It started simple... but ended up cramming the 32K flash to the brim with features and wavetables, maxxing out the interface with obscure button combinations, and pushing the 16Mhz Arduino Nano to the edge! Upside is it makes lots of funky noises now!
Source Code: github.com/Meebleeps/MeeBleep...
Source released under Creative Commons Attribution-NonCommercial-ShareAlike 4.0. Copyright (C) 2022 Meebleeps
0:00 Intro
0:08 Overview & Build
0:40 Schematic
0:48 Laser Cutting with FIRE!
1:02 Detailed Features (Envelopes)
1:24 FM Ratio Modes
2:25 LFO Modes
3:32 Carrier Waveforms
4:09 Modulator Waveforms
5:17 Polymetric Sequencer
5:48 Muscial Scale Selection
6:42 Parameter Locking
7:52 Demo Jam 1
8:28 Demo Jam 2
9:00 Demo Jam 3
new PCB-based demo here: ua-cam.com/video/ibM3H8qv-BE/v-deo.html.
This is my new favourite channel! Thank you brother
Thank you so much for sharing your code! I adapted your first generative algorithm to a little hybrid synth I have been working on (digital oscillator + analog filter) and it's really musical and fun. Awesome work!
That is so cool, glad you found it useful! Let me know if you share your hybrid synth - I have been considering building one as a future project to learn some analog electronics (feels like I have watched every UA-cam vid on it 😁 but haven’t built anything yet)
This is so sick dude, great work.
thanks! 😁
Great stuff! Really impressive and well rounded. Looks like it's a lot of fun to play as well! Subbed and I'm defo going to check out all of your synth projects!
cheers - thanks for the sub! 👍 😁
Wow, love it, can't believe there is so much power in this little nano! Great coding!
thanks! 👍😊 yep it's really at it's limits but I think it sounds great!
Definitely will refer to your code to try out some new ideas with Mozzi. great work
Thanks ☺️ I am a huge fan of what the Mozzi team have built and they have been very supportive of my projects.
this is unbelievably cool
😊 thanks!!
I'm totally impressed with how much you manage to squeeze out of a Nano. Also sound quality is good.
thanks - yes I was pretty happy with how much I could cram in. my original goal was to build a 3-note 2-op FM chord synth but the nano didn't *quite* have enough (topped out at 2 FM voices + 1 sub osc). Initially I was disappointed but am pretty happy with the end result - turned out better and more fun to play than the original design!
Pushing the 328 to its very limits and beyond. Kudos
thanks! much appreciated coming from someone makes such great music & noise tools! 😊😊
This is great work!
Thanks! 😄
amazing work! thank you so much!
thanks!! 😊
for people having issues with compiled binary not fitting in flash:
The github repository has been updated to provide an option to compile to a smaller binary for people using different compilers (eg Arduino IDE vs my VSCode/PlatformIO environment) or larger bootloaders. See changes in readme.md & compiler switches in MutantFMSynthOptions.h (also related changes in a bunch of files so make sure you pull the whole master branch).
A few people have let me know the compiled code doesn't fit into the Arduino Nano when compiled using the Arduino IDE. This is probably because different compilers optimise in different ways and I have been using the Visual Studio Code + PlatformIO environment, and it **just** fits. 😬
Easiest options to get it to fit are:
- migrate to VSCode & PlatformIO (it takes a little bit of setting up but it is a *much* better IDE) or
- delete one of the wavetables. The wavetables are all 2KB each, so removing one of them will let the code fit without a problem. From my experience playing with the synth, the least useful is the ramp :) to remove a wavetable:, in avSource.h: delete the relevant #include in avSource.h, decrease all #define MAX_*WAVEFORMS from 6 to 5, and amend the definitions of **#define** WAVEFORM* to delete the reference to the wavetable you removed.
then in mutantBitmaps.h delete the corresponding bitmap from const PROGMEM byte BITMAP_WAVEFORMS[6][8] and change the defintion from [6][8] to [5][8].
When I get some time I will code a fix so it compiles on both without issues.
I have updated the source code to provide an option to compile to a smaller binary - see changes in readme.md & compiler switches in MutantFMSynthOptions.h (also related changes in a bunch of files so make sure you pull the whole master branch)
Great work!
Thanks! 😊
Wow, Congratulations!! just amazing !! MASTER ;) Thanks
thanks Biyi! 🙏
@@wireheadinstruments when i try to complile appears: #endif without #if , what im doing wrong?
@@MrGuillermofrancisco not sure - which file is the error appearing in?
This volca like design I like more than the side cable design, it looks more eurorack friendly, something bigger but more space means more mods possible... one day I might get one, it sounds really nice with the latest firmware! Also AE modular seems a perfect fit.
Yeah the volca form factor certainly gives it a lot more room! Part of the reason for this size is to bring it down to 22HP for future Eurorack conversion - 42hp seemed indulgent! 😂
Nice one! Thx for sharing :-) Greetings cya
thanks again!! 🙏😊
Superb. I love the way you're using the LED matrix, it's visually so much better than a character LCD 😁 have you considered trying a beefier microcontroller, I've been playing with ESP32 boards because you can work with proper audio DACs and use the two cores to separate the sound generation from everything else. (I've not done anything nearly as good as this though!)
😊 thanks! I’ve ordered a daisy patch submodule for a future project, and have been looking at the teensys as well, so will see how they go. I do like the 8-bit FM on the nano, but a high resolution version would make those glassy tones sing!
wow the things that you can do an Arduino!
Yep I was pretty amazed too! 😂
@@wireheadinstruments how much did you pay to get your panel laser cut?
@@cwrigh13 1 carton of good beer 😂 (my mate owns a laser cutting business)
@@wireheadinstruments what value pots are you using? 100K?
@@cwrigh13 10k linear
Thanks to an awesome reddit contribution from u/PollutionExpensive43, there are now 3D-printed enclosure files for this synth here: github.com/Meebleeps/MeeBleeps-Freaq-FM-Synth/tree/master/enclosure.
Hi, thank you for this amazing creation! I have built one but not as smart looking as yours. I've tried to get the Midi out connection to go, but no luck?
Also, I was having problems with the clock in the program fritzing out, so used a 555 timer hooked in to the Sync In pin. It works a treat with a pot changing the speed of the pulse.
Hi, no worries that's awesome! I would love to see your creation - post or dm me on reddit? www.reddit.com/r/volcas/comments/sninl4/diy_fm_synth_in_volca_formfactor_using_arduino/ re the clock, the internal clock should be stable if nothing is connected to the sync in, maybe check the pulldown resistor has a good connection? Re the midi, my original schematic was incorrect and shows midi out connected to in D0/RX but it should be D1/TX. I've updated it on github here: github.com/Meebleeps/MeeBleeps-Freaq-FM-Synth/blob/master/MeeBleeps%20Freaq%20Schematic%2026032022.png also fyi the midi implementation is super-basic proof-of-concept - it just outputs the note-on events from track 1 with no note-offs and no clock. That worked fine for my modular testrig, but other midi instruments may not like the lack of note-offs.
At 8:55 reminds me of Sly and the Family Stoned
Not sure about the comparison 😁 but thanks for putting me onto Sly - serious funk for the weekend!
Amazing, the bad part is that i can't make one of these for myself 😅
Thanks! 😊 You might be in luck - I’m working on a PCB-based version that comes assembled and ready to play! Hoping to get it complete in the next couple of months.
@@wireheadinstruments yeeeaahhh, separate mine, I want hehehe 😁😁
Hello again, was the choice of matrix display informed by the fact that its easier to update than say an oled? I am making an f.m synth and updating the oled is bogging down the audio. I am using an 3106 oled 128x32.
Hi @afrorack, just replaying my answer here in case it helps others: I chose the matrix because it was bright 😊and because I didn’t want a real screen for this device. Re bogging down, The nano is very limited in cpu speed - a lot of time I’ve spent on this was optimising - reducing code in updateaudio(), reducing the CONTROL_RATE speed, spreading out things across multiple updatecontrol() calls. Eg display updated every 8 loops (and only changed rows are updated), buttons every 7, analog controls every 5, etc. I don’t know how much time it takes to update the oled, but for the matrix each row is 2 bytes written via SPI at 10MHz, so max 16 bytes for a full refresh, maybe 20 microseconds. At 128x32 there are 64x pixels to update, so I can see that could take a long time. If you haven’t already, try reducing control_rate, eg if control rate is 256hz and you update the screen every 16th step that’s still 16fps so should be enough. Hope that helps! 😊
awesome project!! have you made some internal changes to the modular version? I see the plate on the cutting machine hehehe
thanks! 😁 the modular version on the cutting machine is for a sequencer-only version. just tidying up the code for first release - prototype has 3 sequences: 0-8V v/oct, 5V gate and 0-5V modulation with a bunch of modes - recorded, random stepped & beat-synced LFO with a bunch of waveforms. but once again I'm getting carried away playing it rather than finishing it though!
@@wireheadinstruments I truly understand the dificulty of crafting or creating music. that strugle is very problematic, both consume to much time hehehe. If you ever bring this one in to live PLEASE made a video showing the guts of it!
@@Gorgilakokinho yep that is the plan - I just have to stop tweaking it and playing with it and call it finished! 😁
I get how to build it, but still having trouble how to code with Mozzi, if you could do a video where you explain what’s going on there, how to add a filter, etc… that would be amazing
hi! I probably won't do a video - there is lots of good resources for Mozzi around including a forum for tricky questions.
For filtering, maybe check out my first mozzi synth which uses the LowPassFilter class: ua-cam.com/video/d2Lml1Z9uWc/v-deo.html
The way I built these was to start with the examples from the mozzi site and adapt & merge them, with lots of trial&error (especially lots of error & re/learning about integer overflow and the fixed-point math).
I started with the PWM_Phasing and FMsynth examples here: sensorium.github.io/Mozzi/examples/#06.Synthesis
Then took the output from those experiments and pushed the results of that into filters by adapting the LowPassFilter sketch here: sensorium.github.io/Mozzi/examples/#10.Audio_Filters
And shaped the filter, amplitude & FM modulation using the ADSR_Control_Rate_Envelope sketch sensorium.github.io/Mozzi/examples/#07.Envelopes and control LFOs using the Oscil class sensorium.github.io/Mozzi/examples/#01.Basics
Hope that helps!
Great work and thank you for sharing this. Busy putting one together but I can seem to compile and upload to a nano. I get an error saying the code uses 103% of the memory. I’m using arduino ide and I’ve updated all my libraries. Works on an Uno. A little stuck, any advice?
Hi, yes sorry, I have received feedback from a few people that it doesn't fit when compiled using the Arduino IDE. Different compilers optimise in different ways - I have been using the Visual Studio Code + PlatformIO environment, and it *just* fits.
Easiest options to get it to fit are:
- migrate to VSCode, or
- delete one of the wavetables. The wavetables are all 2KB each, so removing one of them will make it fit without a problem. from my experience playing with the synth, the least useful is the ramp :) to remove a wavetable:, in avSource.h: delete the relevant #include in avSource.h, decrease all #define MAX_***_WAVEFORMS from 6 to 5, and amend the definitions of __#define__ WAVEFORM_*** to delete the reference to the wavetable you removed.
then in mutantBitmaps.h delete the corresponding bitmap from const PROGMEM byte BITMAP_WAVEFORMS[6][8] and change the defintion from [6][8] to [5][8].
When I get some time I will code a fix so it compiles on both without issues.
Thanks! That’s hugely helpful.
*waits as his soldering iron heats up
Sounds great! And is that a Eurorack module I see on your laser cutter? ;)
shh its a secret! 😂 yep next project is a eurorack version of the generative sequencer out of this build. it is my first attempt at working with analog CV so there has been a fair bit to learn about DACs, Opamps, v/oct tuning etc - all the fun stuff!
@@wireheadinstruments cool, I think generative sequencing is really suited to the Eurorack format. If you want any pointers for dealing with analogue CV let me know. I've been building microcontroller based analogue modules for a few years, and although I'm still learning every day, I do have some go-to schematics and bits of code now.
@@wireheadinstruments PS thanks for sharing your code. I'm always building 10 things at once but I'm really tempted to build this too.
Thanks - I might just do that! At the moment I’m using HAGIWOs midi-to-CV build as a guide - I’ve got an MCP4922 set up with a TL072 opamp to get 0-9v cv. It kinda works but I’m definitely kludging it and still working through reference voltages etc
Let me know how you go! 😁
that's insane, the code and design is so well done !!! I would like to make my own if it's okay for you ? i'll credit you obviously. thank's again !!!!!!!!!
Thanks so much! 😊 yes I’ve released the source and design files so that other makers can build one - only thing i would ask is to share the results with me and the community as I would love to see what you do with it! Cheers :)
Thanks 😊 yes please feel free to build one - any questions let me know 👍
Not sure where else to ask this - but I'm having issues with flipping the matrix orientation. I've tried altering ledDisplay.setOrientation in the MutantFMSynth.ino file, changing the initial setOrientation in the LedMatrix.cpp file and even changing the values of the different display bits but on compiling and uploading I seem to never get any changes? Any ideas?
Yes sorry, this is a known issue as I didn’t end up implementing any code for actually changing the orientation, as it turned out to be unnecessary for my build. There is a GitHub issue for this which has code to make 180degree flip work here: github.com/Meebleeps/MeeBleeps-Freaq-FM-Synth/issues/10
@@wireheadinstruments woah wasn't sure I'd get a response thanks a bunch! I didn't think to look on the repo for a fix, cheers!
Hello
Can I make this with two led matrix?
I wanna the led longer
Hi there, sure is possible (with code changes) and would be nice to have more room! May need to do some optimisation to fit another display in memory, and extend/replace my handcrafted max7219 code to handle multi display. I haven’t made one but from my understanding it shouldn’t be too much modification. Good luck!
Where and how do I learn to code something like this?
There’s lots of examples on the Mozzi website which I started with - FM synthesis, envelopes, control signals, etc. if you want to start experimenting, you can download the Mozzi FM example into the arduino IDE and started tinkering! It is much easier to follow than my sprawling code. 😂
right, so wheres BUY button?
Thanks 😁 none yet - wouldn’t say its ready for commercial production (spoiler - it contains duct tape 😂)
Hi What pots did you use 10K or 100K Lin.?
Hi, I used 10k linear pots.
@@wireheadinstrumentsThanks for the help, I look forward to the build on this wonderful project.
Hello bro
I still get sketch too big error on arduino ide
Even I do #define COMPILE_SMALLER_BINARY
What should I do
That’s unexpected. But try enabling midi output - it has the side effect of removing all the debug messages and shrinking the binary by a fair bit. Flag to enable is ENABLE_MIDI_OUTPUT in avMidi.h
It is adaptable to pro micro?
Possibly but with a lot of work and extra hardware - the pro micro doesn’t have enough analog or digital IO, so you’d need to modify the synth design or add external multiplexer ICs. Could probably be done, but a lot easier to buy a nano 😊
What is the part number on the LED matrix? The only one I see coming up that seems to fit the bill is out of production from sparkfun.
Hi, I used this one www.altronics.com.au/p/z6362-8x8-red-led-matrix-breakout-board/ but any MAX7219-based 8x8 matrix should work. There are cheaper ones on ebay eg www.ebay.com.au/itm/302096773225?chn=ps&_ul=AU&mkevt=1&mkcid=28 and others on alibaba but I can't vouch for them. good luck! 😊
@@wireheadinstruments trying to load in VSCode & PlatformIO, and it is saying it is too large still. 101%, right on the edge. I'm also a little confused about what piece of the include avsource.h needs to be deleted. most of the other edits make sense. The editing of the [6][8] to [5][8] throws an initializer error. Which piece of that array should be deleted?
@@JasonRoachable Sorry For the delay. I can’t update GitHub as I am away from my studio, but this should work (maybe - untested!)
In avSource.h Replace definitions of max waveforms like this:
#define MAX_LFO_WAVEFORMS 5 /* was 6 */
#define MAX_CARRIER_WAVEFORMS 5 /* was 6 */
#define MAX_MODULATOR_WAVEFORMS 5 /* was 6 */
Then remove the definition of the waveform index from this list and reduce the value of the definitions after it, eg:
#define WAVEFORM_SIN 0
#define WAVEFORM_SAW 1
//delete this line #define WAVEFORM_REVSAW 2
#define WAVEFORM_SQUARE 2 // was 3
#define WAVEFORM_PSEUDORANDOM 3 //Was 4
#define WAVEFORM_NULL 4 // was 5
delete this line:
// #delete: include "revsaw2048_int8.h"
In mutantBitmaps.h replace the definition of the icons with this (assuming you are deleting the ramp waveform:
// replace
const PROGMEM byte BITMAP_WAVEFORMS[5 /* was 6 */][8] = {
{B00000000,B01100000,B10010000,B10010000,B00001001,B00001001,B00000110,B00000000}
, {B00000000,B10000011,B10000101,B10001001,B10010001,B10100001,B11000001,B00000000}
// delete this line , {B00000000,B11000001,B10100001,B10010001,B10001001,B10000101,B10000011,B00000000}
, {B00000000,B11110000,B10010000,B10010000,B10010001,B00010001,B00011111,B00000000}
, {B00000000,B10010001,B00001000,B00100010,B10000100,B00010001,B01000100,B00000000}
, {B00000000,B00000000,B00000000,B11111111,B00000000,B00000000,B00000000,B00000000}
};
Then in avSourceFM.cpp you will need to amend the switch statements accordingly in toggleCarrierWaveform() and toggleModulatorWaveform() and toggleLFOWaveform()
Sorry that is a lot! I’ll get on making a build switch to make it easy but won’t be until next weekend when I’m back in the studio. Hopefully that helps! Cheers.
@@wireheadinstruments no worries. I appreciate your time. I think I was able to get it loaded ok it just took some futzing around, as I don't normally use Arduino or VSCode etc. Hopefully will have time to put it all together and test this weekend. Thanks so much for what you've put together.
@@JasonRoachable great to hear you’ve made progress 😊 good luck with testing and hope it works first try!! Let me know how you go 👍🏻
hello dear friend! where can I download the full instructions on how to start and finish (what actions and buttons to press and how to start ) I can turn it on and the sounds change, but I don't understand what I'm doing?!?!?!???? Can you show me the way?!?!??? I would like to gain knowledge in my first actions!!?!?!?!
Hi there 😊 there isn’t a user manual for the open source version, however the build video steps through all the functions. The retail version has a comprehensive manual here wireheadinstruments.com/s/Wirehead-FreaqFM-Operation-Manual-v16.pdf. The commercial version has a lot of upgrades and some controls and functions have changed but it might be useful reference too 😊.
@@wireheadinstruments Thank you dear friend for the quick response!
hello , after editing I have a background noise that is present on the audio output, do you have a solution? thank you
hi, I find I get a lot of noise from many USB power supplies - have you tried it with a DC input? Noise is generated by the led matrix driver IC switching current especially when powered via USB. I have tried to filter it out by adding the 100uF capacitor across the GND-5V pins of the LED matrix board - you could try increasing this (by replacing with a higher value or adding another cap in parallel). Just don't do that while the power is on! I have done that a few times while trying different values to see what difference it made to the noise, and ended up blowing up multiple arduinos 😟
@@wireheadinstruments after trying to solve the problem of noise in the audio output, I tried with another power supply which should be higher, the arduino and the LED matrix ended up fried, I had to replace the components and I had to start all over again
@@analogart5251 🤕 that sucks! sorry to hear that. I hit a few of those issues during development too as I was learning (the hard way) as I went. unusual for the matrix itself to be fried even if the MAX7219 chip is damaged. It sounds like you are committed to the diy route which is awesome, but just fyi if you don't have any luck getting it running I have kits available on Tindie - not many left for 2022 but will be restocking in 2023.
@@wireheadinstruments hello, I repaired the assembly but by applying a 1000uf capacitor I still have a noise in the audio output, I even tried to amplify this output with an LM386 but it does not work
@@analogart5251 sorry to hear that, can’t really assist - amplification should not be required - the audio output is almost 5v peak-peak if working correctly so is pretty hot.
Can I get one? ..later on
almost! - I am making a small run of the pcb-based design: ua-cam.com/video/ibM3H8qv-BE/v-deo.html . will be available in November.