Thursday 14 May 2015

Build the Auduino Granular Synth - MIDI Upgrade

Ever since I posted the original Auduino Granular Synth tutorial, I have been receiving requests to modify the circuit for MIDI control.

So, after several long nights of work I am proud to present the MIDI Update for the Auduino. This update allows the Auduino to respond to MIDI Note and Pitch Bend messages from a MIDI controller. As a fun bonus, I programmed the middle potentiometer to play a Major Pentatonic scale in the key of the note currently being held on the keyboard.

Build It

Watch this Video for construction and programming details.


The Arduino MIDI Library

This update uses the Arduino MIDI Library as a foundation. You can download the MIDI Library HERE. Make sure it is installed before you attempt to compile the software.

The Software

You can download the software HERE. Open up the program in the Arduino IDE and upload it to your Auduino circuit (Video provides details). Also included is the Drill Template for installing the MIDI Jack.

DIP Switch Option

The challenge with this project was trying to make it all fit in the existing enclosure. I didn't want to over-complicate things by adding new controls. That being said, I still thought it would be important to have the ability to change the MIDI channel.

By adding a simple 4-Position DIP Switch, you can easily change the MIDI channel that the synth responds to. Once the switch is installed, the Auduino will be set to the channel as outlined in the following chart.

Switches = MIDI Channel (0=OFF 1=ON)
0000 = 1    0001 = 2    0010 = 3    0011 = 4
0100 = 5    0101 = 6    0110 = 7    0111 = 8
1000 = 9    1001 = 10   1010 = 11   1011 = 12
1100 = 13   1101 = 14   1110 = 15   1111 = 16

Parts List (With affiliate links to Amazon.com)

Tools

75 comments:

  1. can you upload this code to a regular arduino nano via usb?

    ReplyDelete
    Replies
    1. Hi Wojciech. I haven't used a nano personally, but if it is pin compatible and uses the same interrupts as the UNO, it might work.

      Delete
    2. I know it's been a long time, but it does, just so you know

      Delete
    3. Thanks for the update Wojciech! That's good to know.

      Delete
  2. I wonder how difficult it would be to set up the mod wheel for vibrato on the MIDI controller.

    ReplyDelete
    Replies
    1. Hi William. This should be possible with some code modification. I didn't add this for fear of bogging down the timing of the code (I'm sort of pushing it as it is). But it may be something worth exploring.

      Delete
    2. I'll probably give it a go once I get the project finished in general. Coding isn't exactly something I'm very knowledgable in but I've been known to figure a thing or two out before. I tend to mostly work on basic analog circuits.

      Delete
  3. So I'm well on my way here, but couldn't help wondering if another DIP switch could be used to change scales. Any idea if that is possible to do or some other method to add scale adjustments to the center pot

    ReplyDelete
    Replies
    1. Hi MM. That is definitely doable, although at some point it would just be easier to add a LCD display and menu system. Then you could add a bunch of parameters to the program.

      My goal for this update was to keep it as simple as possible for people who have built the project and want to add MIDI. There are lots of other things that could be added but in my opinion, would be overkill for this simple synth. Good luck with your build!

      Delete
  4. I'm getting the "avrdude: stk500_recv(): programmer is not responding" error when trying to upload the midi sketch using the uno as programmer function. The uno seems to load other sketches just fine, but this is the only one I've tried to do it as a programmer aside from the initial Auduino sketch, which loaded just fine. I've tried the reset trick and all that, but haven't had any luck yet. All the connections seem to be connecting properly, but that error keeps coming up. I've been scouring forums for ideas but I'm at a loss. Any suggestions?

    ReplyDelete
  5. Hi Dave! I am having some trouble with this version of the synth. I cant get my midi controler to play the synth and it just stays mute.. I was interested to know how to adapt a cv input so i could control it with a sequencer or how to adapt the code from this simplenZAR to the Auduino Midi.
    http://www.roebbeling.de/wordpress/?p=85
    Would it be easier to just create the code instead of adapting the existing one? Im really new at codes DIY sistems so any help would be very welcome.
    Thanks!

    ReplyDelete
    Replies
    1. Hi Mojojo. Did you install the DIP switch option for MIDI channel changing? (12:40 in video) If not, did you set the parameter in the software correctly before uploading? (19:30 in video)

      Delete
  6. I am having the same issue. i uploaded the original auduino code and the audio worked, but this sketch with the MIDI upgrade is not. Something with pin 5?

    ReplyDelete
    Replies
    1. Hi MM. Did you install the DIP switch option for MIDI channel changing? (12:40 in video) If not, did you set the parameter in the software correctly before uploading? (19:30 in video)

      Delete
    2. Hi Dave. Yes, I installed that option. I have quadruple-checked it to make sure that whole MIDI circuit is installed correctly. Is there anything I need to uncomment? I did notice that the word "true in yours is orange. Mine is black. Is it possible that const bool is not defined because of that?

      Delete
    3. I should clarify, where you have const bool regarding the DIP switch, followed by true, the word true in my file is black, not orange like it is in your video. I also tried marking it false in order to see if I could get anything to work and it still didn't. Once again though, the word "false" was balck so not sure it is getting defined properly in my software.

      Delete
    4. What version of the arduino IDE are you using? What version of the MIDI library do you have installed?

      - Try sending notes on each channel (0 to15) from your keyboard/controller.

      - Turn all the knobs on the synth to at least the 12:00 position.

      - Take a multimeter set to DC Volts. Place the ground probe on the circuits ground rail and the Postive probe on PIN 6 on the Optocoupler. It should read around 5 Volts. Plug in your MIDI Keyboard and start quickly pressing the keys. The voltage should drop a bit to 4.80 Volts or so. This will show that the incoming Midi data is a least passing through the Optocoupler.

      If you want, send a picture of your circuit to my email under "contact" at the top of the page.


      Delete
    5. Hi Dave,

      Thank you so much for helping me to troubleshoot this. I just checked the voltage and I am getting 5 volts at Pin 6 and 5 volts at with just the ground and positive rails. I did not get a drop with the keyboard on any channel. I am using 1.6.5 IDE and 4.2 MIDI Library. I am going to send some pics. Again, thanks for helping with this.

      Delete
    6. Did this ever get resolved?
      I am having the same issue.

      Delete
    7. I just used an older version of the IDE and it worked. Used 1.6.0 I think.

      Delete
    8. I'm strugling to get the midi working also.

      Original program works.
      Midi version doesn't.

      Arduino 1.8.1
      Midi 4.2 and 4.3.1

      I'm sure I'm sending on midi channel 1 which I configured as default.
      I can see a small drop in Voltage on pin 6 of the Octocoupler
      Even on pin 2 of my ATMega chip.

      But no sound.

      I noticed that when I upload the original software I can hear sound until I connect midi cable.

      Delete
  7. What about making this with usb MIDI & Power. I am currently building this Synth.

    ReplyDelete
    Replies
    1. It's possible, but that would be a whole different project. Would have to start from the ground up.

      Delete
    2. Open question ;-)

      Hey do you know how I can add MIDI out code to the original tinkerit sketch?

      I keep getting errors as I am not good at coding, My synth has the same face plate sticker and Potentiometers, and enclosure as the ones you build but my Synth is run by Arduino.

      I have everything needed to build the Circuit but I am not very good at electronics (Learning tho). I had some problems building the circuit so thats why I used an arduino.

      I built this synth because I think you done an awesome job of It both in looks and function, My syth is working its just I am stuck trying to work out how to edit the sketch to add midi so it works with my arduino. My arduino is a Uno R3.

      I have spent months trying to build this but I wanted to make it so bad I never gave up.

      THANK YOU DAVE :-)

      Jason H
      Australia

      Delete
    3. Try looking up the Groovesizer. It is based on the same code but uses MIDI out rather than in. That may turn up some reaults for you.

      Delete
    4. I done some digging around and ended up finding the code for Groovesizer, Uploaded the sketch and it worked so thank you for that! :-) I wish I could upload a photo so I could show others how my synth turned out. Thanks again!

      Jason H

      Australia

      Delete
  8. Is there a way to send the Mod Wheel data to change the Scale like the Middle Pot does?

    ReplyDelete
    Replies
    1. Hi GPS. Yes this would be possible with some code modification.

      Delete
  9. Upload a youtube video and let us know the link!!

    ReplyDelete
    Replies
    1. I will, I think I need another Mono/Mono cable tho :/ But MIDI is now working so thanks.

      Delete
    2. My Synth: https://youtu.be/uMhc3aUXDCY sorry about the sound I filmed this on my phone.

      Delete
  10. Has anyone made a syth here with both Input and Output? I ordered this Arduino Shield with MIDI I/O and Thru, If I plug the MIDI output from my synths MIDI out into the MIDI Thru on the midi shield would this give me both input and out put? I Do not understand midi thru, The MIDI shield I am talking abut above sits on top of the Arduino. Any help would be awesome.

    Cheers!

    ReplyDelete
    Replies
    1. Hi Jason. There are two types of Midi Thru, hardware and software. With the hardware version you basically connect a second wire to the MIDI input jack and run it (through a buffering circuit) to the midi thru jack. This version is the best since there is no lag between the input and thru jacks.

      The second way to do it is with software which is what you are proposing. In the software, you add a command that will write any incoming midi data to the output jack. This makes the output behave like a midi thru. The downside is the lag that is created by the extra write command in your code. Hope this helps.

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Would I need to add a MIDI in Jack to my Arduino synth?

      Also I am going to add a small amp to my syth because the sound is so quite when plugged into my audio interface, Even when the signal knob is turned all the way up and monitor is on.

      Thanks for your help.

      Delete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Hi Dave,

    just wan't to confirm another successful build. Though i'm not a noob at this stuff at all I liked your thorough instruction videos very much. Here's a picture of the MIDI version with the top panel provided by you, where I managed to put all three jacks on the back of the enclosure (power, audio AND MIDI, thought it looks better this way):

    http://www.noiseratio.de/pics/Auduino_DIY_MIDI_Synth_final.jpg

    Next built will be the non MIDI version, for droning reasons ;)

    Cheers,

    Dietmar/Germany

    ReplyDelete
    Replies
    1. Nice work Dietmar! Really clean build, you did a great job! Would you mind if I add your picture to my Facebook page? I really enjoy displaying the work that people send to me for others to be inspired by.

      Delete
    2. Hi Dave,

      yes, of course you can add the picture wherever you like.

      Cheers,

      Dietmar

      Delete
  13. Hi Dave,

    I really liked how you were able to adjust the key of the major pentatonic scale based on the midi root note being played. The inclusion of pitch bending was very cool as well. I am new to the arduino (and circuitry / coding in general) and your original granular synth was the first project I undertook. It was successful and I have replaced the center sync control pot with a linear softpot to create a guitar-like synthesizer. Fortunately, sticking with the original pentatonic scale allows for wrong notes to almost never be played in a given key. Unfortunately, the synth is stuck in one key only (unless new frequencies are coded in).

    How would one go about adding an additional "key adjustment" potentiometer in the granular synth without needing to add MIDI support? I assume this 6th pot would fit into the UNO's final analog input, but what might the code to integrate "key adjustment" look like?

    I will continue to experiment with the code included in this tutorial but any help is greatly appreciated.

    Thanks!

    Ben

    ReplyDelete
  14. Hi Dave,

    Tonight I finally finished my granular synth which has been an on-off project for the last 3 months. It works really well hooked up to a surplus-stock Nintendo Rockband keytar I bought new for a few British pounds on ebay. Thanks for such a great project and the expertly produced instructions.

    I have also just finished a PT2399 delay/echo unit based on a board from Synthrotek (others are available). Feeding the output from the synth through the PT2399 unit enables me to dial-in various amounts of echo which adds to the richness of the sound IMO.

    I now need to catch up on your recent MIDI controller tutorials. I haven't read them yet, but are they by any chance heading in the direction of building a sequencer?

    Regards,

    Roger

    ReplyDelete
    Replies
    1. Congratulations! That's awesome Roger! If you want, email me a picture of your build and I'll post it on the Facebook page.

      A sequencer would definitely be a cool project, I'll make a note of it. So many projects, so little time lol.

      Delete
  15. Hi Dave, I'm having trouble getting the midi-enabled version of the program to work properly on my Audino build. The version 5 audino code on google drive appears to work ok, but as soon as I upload your midi version, the synth no longer responds to me turning the potentiometer knobs when disconnected from my midi keyboard, nor when it is attached, and it is not able to respond to midi when it is attached either. I'm using an arduino uno and I'm not even seeing the LED indicator flash like it did when I increased the oscillator frequency or otherwise played with knobs like when I used the version 5 normal code.

    Is the synth circuit supposed to continue to respond to input on the potentiometers and generate sound when it isn't connected to a midi input device, or after being reprogrammed this way is it supposed to NOT do that at all unless plugged in to a midi input device? Thanks! - Tim

    ReplyDelete
    Replies
    1. Hi Tim. The Midi version of the synth will only make noise when a midi note is received so you won't get any sound until you hit a key on a keyboard. (Make sure the Midi channel number is the same between both devices).

      If you are still having issues you should look at the Midi input circuit. If everything looks correct, check for a bad optocoupler.

      Delete
    2. I have exactly the same issue, I tried also other optocoupler but nothing helps :( pretty frustrating, I can't get the error.

      Delete
  16. Great project, thanks! Is there a way to add an adjustable release time to the notes? Either by adding another knob or sacrificing the pentatonic scale knob?

    I'm not great with code but managed to get the project working as is.

    ReplyDelete
  17. Hi,
    Nice work!
    I know all intrucyions are in the video but can you provide the schematics (with potentiometers, jacks and opt dip switches) ?
    Just to double check.
    Thanks

    ReplyDelete
  18. Hi all, hi Dave,
    I wanted to give this build a shot and built it (the original, w/o MIDI upgrade), and it worked perfectly.
    I then bought the part for the MIDI upgrade and built it as well, to very weird results :
    No sound at all, exept when I plug in my midi controller and play notes at the same time, in this case the note I play gets 'stuck' and doesn't stop until I disconnect the power supply.
    Also, I checked the voltage between gnd rail and the pin 2 on the atmega chip and I noticed that I always have 4.82v, whether a note is played ('stuck') or not.
    I both tried with Arduino 1.8.3 and 1.6.0 and MIDI library 4.3.1 and 4.2, neither work.
    I didn't install the DIP switch yet but try feeding the auduino with all 16 channels, to the same results...
    If anybody has some info or solution to this that works, I'll gladly buy him/her a virtual beer.
    Thanks !

    ReplyDelete
  19. Would it be possible to do the midi input via usb?? I have a midi hacked uno and it would be much nicer to do it that way without having to add an old school Midi jack.

    ReplyDelete
  20. Actually just figured this out myself. You can do it if you use the Midi hack outlined here http://soulsbysynths.com/miniatmegatron-downloads/

    As far as I can tell it'll only work with the original Uno or clones that use the same chipset(amtel16u2 or similar) and won't work for the Nano Uno.

    Just uploaded your MIDI version of the software and it's working through my DAW(Reason) :)

    ReplyDelete
  21. hey! this is great, thank you for all the work!
    i'm completly new to arduino programming, where should i look if i want to change the behaviour of the middle pot, to play lets say chromatically instead of a major scale?
    thank you

    ReplyDelete
  22. Hi, I have gotten the original Auduino code without the Midi to work fine on my Nano clone, but with the Midi update I get the same error for my Nano and Uno when compiling: #error MIDIUSB can only be used with an USB MCU.
    Can anyone help?

    ReplyDelete
  23. I made the midi version. Works perfectly with the first software but I have no sound with the midi update. Dipswitch installed, all components checked ..

    ReplyDelete
  24. How can I set it up to change scales or do modes? This would make this so much more versatile for my music. I'm new to programming so any help would be appreciated. :-)

    ReplyDelete
  25. Is there anyway to Receive MIDI via USB(for example using the MIDI library) instead of using MIDI cable?

    ReplyDelete
  26. Hi
    This project is awesome! I just need to change output pin to 9. But it is just working on pin 3. Is that possible?

    ReplyDelete
  27. Hello sir, this project is so good. The way you explained it is encouraging me to do the project. My doubt is can i connect the midi output to a uno board instead of doing a circuit like you did. Please help me sir. If we can do it tell me the steps. Thanks in advance

    ReplyDelete
  28. Hello from Argentina. I just built your MIDI Auduino (in free-form naked wires version) and it totally rocks. I have known the synth since 2010 and have built a couple of units, but with MIDI IN you really made it a professional instrument. THANK YOU SO MUCH FOR YOUR INSTRUCTIONS AND CODE, you made me a happy guy. I promise to upload pictures and video soon.

    Now I have a question, same as I saw here by another user. The notes seem to get stuck: at first when you release keys in MIDI controller the sound stops, but then shortly there's a sustained sound (like one of the filters) which doesn´t stop (only mutes when you play a new key, but as soon as you release it the "stuck" sound comes back).

    I had the same issue with non-MIDI IN version, and I think it's got something to do with one of the filters "triggering" a pulse in a certain point of voltage. Anyway I'm absolutely newbie at electronics so I couldn't tell.

    Is there anything you can imagine to help me?

    ReplyDelete
    Replies
    1. i have the same issue, it seemed to me this happens, when some notes have a longer decay and overlap. have only tried with a sequencer. worked well with super short notes, that do not overlap. when notes are 'too long' something messy happens.

      i would like to know if it is possible to have an option to switch this sustained mode on, when there is no midi signal coming in, to make the synth a drone box, when not controlled via midi. must be a simple thing to implement, but i have no clue about coding. so would hope any of you here can help out.

      Delete
  29. Hello from Argentina (again). I'm sharing with you a video of my build of your Auduino MIDI IN, thank you so much for the information you have shared in your blog.

    https://youtu.be/JbUJUQ4RVvI

    Hope you can see it, again thanks for your rich blog and keep up the awesome work!

    ReplyDelete
  30. as maybe already read above:

    i would like to know if it is possible to have an option to switch this sustained mode on, when there is no midi signal coming in, to make the synth a drone box, when not controlled via midi. must be a simple thing to implement, but i have no clue about coding. so would hope any of you here can help out.

    ReplyDelete
  31. The original Auduino works like that, no trigger for notes, just the five pots and a continous output.

    ReplyDelete
  32. Hey dave, I really love your tutorials, thank you!
    I tried to make this midi upgrade to my auduino, but unfortunately the code seems not to work.
    the auduino is just quiet, no LED blinking, nothing.
    I double checked the circuit, also the settings in the code (no jumper switch is in use) but it wont work.
    I also tried on different boards with different atmega chips, nothing.
    can you please help me?

    ReplyDelete
  33. Herr... I dont know if you realise this already but this Auduino version will ONLY play when triggered by MIDI note in data . It will not make a sound by itself like the original Auduino will .

    ReplyDelete
  34. Just finished your tutorial but used my own enclosure design. Works great and had a lot of fun! Big thanks! https://www.instagram.com/p/CFTOEvDHGBO/

    ReplyDelete
  35. Hello there from the 2020!
    I have successfully built this project a year or two ago due to your tutorial, which I am very greatfull of.
    As a beginner in a eurorack modular synth devices, I was wondering, and asking for your advice, if it is possible and if it is, then how to convert this synth to recieve CV 1v per octave and add a typical for eurorack VCOs octave switch?
    To spice things up, here's a video of a small jam I made with the non-midi version of synth, I know you like this stuff: https://youtu.be/Ni8UIZNYUwE

    ReplyDelete
  36. Where can I find the sketch? Not on the NV article, and not here. Looking for the one that includes MIDI support.

    ReplyDelete
  37. This comment has been removed by the author.

    ReplyDelete
  38. Okay, I was able to get the sketch to compile after removing the latest version of the midi library and installed V 4.2.0 and it worked.

    ReplyDelete
  39. Thanks for sharing this great project. https://www.instagram.com/p/CRfsWaBBqzh/

    ReplyDelete
  40. Hello,

    I'm planning to build this synth as both my first arduino and synth project.
    I've been building quite some guitar pedals before so soldering and reading schematics isn't a problem.
    Programming would be my first.

    The plan is to make a version that is as versatile as possible. I know how to add VC to the parameters with vactrols and I would like to add the Midi input too.

    I wondered if it would be possible to activate and deactivate the Midi input with a switch so I can use the synth without Midi if necessary.

    Greetings
    Sevrien

    ReplyDelete
  41. Dear everybody and especially NotesAndVolts ofcourse. Mine worked fine, and I had to put it away for a year or so, and then it did not work, but I could still see zhe blinking lightz on the uno, so I tried to measure e verything, al all was closed as to be closed open where it should be. It could not find the error and I planned on getting a new 6n138 as that would be last resort before making a new one. But then I read your comments about changing the midi channel, and guess what. IT WORKS....

    ReplyDelete
  42. i'd love to see a version of this for the m5stack with a menu and 1/8" MIDI breakout to make it as compact as possible. The CPU power difference could make it less timing-sensitive and the onboard battery could make it a sweet portable handheld synth.

    ReplyDelete