Monday, 19 March 2012

NaV-1 Arduino Soundgin-BabbleBot Synth

Stage One - Building the basic circuit

This post is the beginning of the design diary of the NaV-1 project. If you want to jump right in and build the final hardware go HERE.

In this project we are going to create a custom synthesizer using an Arduino and a Soundgin SSG01 Sound Coprocessor chip. The goal is to end up with a mono-synth that can be controlled with a MIDI keyboard. For lack of a better name, I am calling this project the NaV-1.

In this tutorial, we will simply get the Soundgin wired up, connect it to the Arduino, and send its output to a LM386 amplifier to drive a Line-Level output.

We are going to build this circuit from the ground up as a learning exercise as I find the best way to learn about something is to build it from scratch. If you are simply looking to play around with this chip, you may want to purchase the GinSing Arduino Shield available HERE.

What is a Soundgin / BabbleBot chip?
  
The Soundgin is basically a Microchip PIC18F1320 Microprocessor chip that has been custom programmed to act as a six oscillator sound generator. The oscillators can be played individually or combined through the two on-board mixers to create complex sounds. The chip was originally produced by Savage Innovations but has since been discontinued. Luckily, a company called JT Technology has re-released the chip under the name BabbleBot. If you can't find a Soundgin chip, feel free to substitute a BabbleBot.

Be sure to download and read the Soundgin Datasheet. It is not only a thorough explanation of the chip functions, but also of sound synthesis in general.



HARDWARE

We are going to modify the "PIC to Soundgin" example circuit from the Soundgin Data Sheet as a starting point to get our synth making some noise. First, we'll replace the Speaker output with a Line-Level output to make it compatible with the rest of our music gear. Next, we'll replace the PIC chip with our trusty Arduino board. And since we are going to take +5 volts from the Arduino's regulated power supply we can get rid of the 7805 and it's support components for now. This leaves us with the following circuit.

Click to Enlarge

This is how this circuit works. We are taking +5 Volts from the Arduino board's regulated power supply to drive the circuit. Pins 3 and 4 of the Arduino are used to Transmit and Receive Serial messages to and from the Soundgin. Pin 2 is used to check the Busy status of the Soundgin. There is also a 10 Mhz crystal circuit to drive the Soundgin.

The output of the chip is sent through a 2-Pole Low-Pass Filter made from two 27K resistors and two 10 nF capacitors. This is necessary to filter out high frequency noise that the Soundgin generates.  It is then passed through a 10K pot to allow sound level adjustment.

Finally, the signal is processed by the LM386 amplifier chip to drive the Line-Level output.

This is how the circuit looks on my Breadboard.

Breadboard Hookup

Audio Out Jack

Arduino Hookup


SOFTWARE

Here is a test program that will setup communications between the Arduino and Soundgin and play a repeating C3 square wave note on one of the oscillators. Download the file and upload it to your Arduino. The code is commented so give it a read through. This program will verify that you have a working circuit. If all is well you will hear a pulsing note that is on for 1 second an off for two seconds. Congratulations! You have completed the first step!

The program uses the Arduino SoftwareSerial library to configure pins 3 and 4 of the Arduino as an alternate Serial Port running at 9600 Baud. It uses this new port to transmit and receive serial data to and from the Soundgin chip. The 'patch' function simply sets one of the Soundgin's oscillators to Square Wave mode. Then the main loop sends a C3 note to the oscillator for one second the shuts it off for two seconds. The Arduino on-board LED will also flash for confirmation.

Next time we will add the MIDI control circuitry. See you then!

11 comments:

  1. Hi, I want to make a synth with Arduino and a MIDI keyboard for input. I've searched everywhere and so far your project seems to be the only one detailed enough. What I'm trying to understand at the moment is: what does the GinSing shield do? Is it possible to wire up a midi 5 pin connector to it and somehow control the notes? I'm an absolute noob at this btw.

    ReplyDelete
    Replies
    1. Hi Art Raz. I took a look at the GinSing board and it does not seem to have MIDI input capabilities built in. The board is used to interface a Soundgin chip to the Arduino and allow you to use it in your programs with the included Ginsing library. You might be able to add a MIDI interface but it would not be a beginner project.

      Delete
  2. I've also found another shield that's called fluxamasynth. It's not clear to me whether it can be used with a midi keyboard either.

    ReplyDelete
    Replies
    1. Hi Art. The fluxamasynth is a similar idea to the GinSing but uses a different chip for sound generation. It is also a Wavetable type synth which is less tweakable that the soundgin but adds more voices and effects. It seems to leave the Arduino serial port free so in theory, you could add you own MIDI circuit. You would need to write the code for the interface as well.

      Delete
  3. Hi Dave. Thanks for your reply. I'm gonna go with the Ginsing shield and learn the basics. Their website seems to be well documented with information about how to get the shield working.

    ReplyDelete
  4. One more question, Dave. What if I used something like this with the Ginsing shield? https://www.sparkfun.com/products/9598

    ReplyDelete
    Replies
    1. Hi Art. You first need to find out if the Ginsing shield allows access to the TX and RX pins (Digital pins 0 and 1) on the Arduino. If these pins are available on the Ginsing you may be able to use it. Check if the Ginsing site has a user forum. Ginsing users should know this info and may have designed a MIDI solution already. Good luck with your project!

      Delete
  5. Hi, your tutorials are really great.
    Just a stupid question: if it's so difficult to find a Soundgin chip, would it be possible to use just a PIC18F1320 and program it as a Soundgin (maybe more components are required)?

    ReplyDelete
    Replies
    1. Hi Mauro. You are correct. The Soundgin is actually just a PIC chip with custom programming. Unfortunately, the program code is not open source and has not been released by the owner. I know the rights to the code have been bought and sold by a few different companies. Perhaps one day it will be released, until then there is not much we can do.

      Delete
    2. Hi Mauro. You are correct. The Soundgin is actually just a PIC chip with custom programming. Unfortunately, the program code is not open source and has not been released by the owner. I know the rights to the code have been bought and sold by a few different companies. Perhaps one day it will be released, until then there is not much we can do.

      Delete