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

48 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
  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