AD9833 MIDI Signal Generator – Part 2

This project builds on the AD9833 MIDI Signal Generator and adds a second signal generator for some simple additive synthesis.

Warning! I strongly recommend using an old or second hand keyboard for your MIDI experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

  • Arduino Uno
  • 2x AD9833 signal generator module
  • 2x Button switches
  • 1x 10k Potentiometer
  • MIDI receive module (see: Arduino MIDI Interfaces)
  • Amplification/speaker for output
  • Breadboard and jumper wires

The Circuit

AD9833 MIDI Signal Generator Part 2_bb

This takes the circuit from the AD9833 MIDI Signal Generator and adds the potentiometer back in alongside a second AD9833 module.

The second AD9833 will share all pins with the first apart from the FSYNC pin.  This is used to select which module to talk to using the SPI link, so each FSYNC pin is connected to a different pin on the Arduino – in this case using digital pins 9 and 10.

The other pins link up in the same way as before:

  • VCC to 5V
  • GND to GND
  • SDATA to MOSI (D11)
  • SCLK to CLK (D13)

There is now a second button too to control the waveform selection.  The two buttons are connected to the Arduino digital pins 2 and 3 and need to be used in INPUT_PULLUP mode – they are thus active when the signal reads LOW.

The potentiometer is simply connected to A0, sweeping between 0 and 5V.

The audio output is the simple sum of the two oscillators – I’ve just tied the two outputs together.  It is a little crude but it works well enough for now.  A variation could be to put one oscillator on the L channel and the other on the R then there might be some interesting effects if you could hear it with a stereo amp or output.

The Code

Once again this is use the MD_AD99833 library from MajicDesigns and it needs the fix described in AD9833 Signal Generator – Part 2 to work properly.

Because of the issues I was having with the square wave output, I’ve disabled that for the time being, being content with a sine and triangle wave.  The choice of wave is independent for the two oscillators although there is an optional “one button” configuration where a single button changes both waves at the same time.

The code also has configuration options to drop it back to a single AD9833 so that the same code can be used for both MIDI experiments.

Find it on GitHub here.

Closing Thoughts

It would be great to stack up a good number of these modules, but that will definitely need some kind of shield building.  The outputs are currently combined in a very simple passive manner, it would be really good to get them multiplying somehow, but these are not voltage controlled oscillators, so that would have to be done programmatically in software somehow – adding a control signal to change the frequency in a programmed manner.

This is still monophonic of course.  The other option for more oscillators is to use them to provide some simple polyphony.  Alternatively, this modules would make a great LFO – low-frequency oscillator – to add vibrato or another kind of modulation to one of the other projects.

Kevin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s