Getting Started with the Fluxamasynth Shield

The Fluxamasynth is a programmable synthesizer in an Arduino shield format. The Arduino sends MIDI commands to the ATSAM2195 IC on the shield, which generates stereo line level audio out. The controller can be programmed using the Arduino IDE, and Modern Device has provided a library to simplify using the synthesizer.

The Fluxamasynth is based on Dream’s ATSAM2195 single-chip MIDI sound system, which is part of their Dream Sound Synthesis line of programmable ICs. The chip was intended for battery powered keyboards or portable Karaoke machines, but I’m sure you can use and abuse the Fluxamasynth in all sorts of new and interesting ways. Here are a few suggestions:

  • Make your own MIDI instrument with unconventional analog sensors
  • Create algorithmic compositions
  • Use it in a homebrew pinball machine to generate music and sound effects
  • Build an unusual percussion device
  • Augment an analog instrument with a Fluxamasynth-based hyperinstrument

The Fluxamasynth has a built-in wavetable with 128 general MIDI sounds and an additional set of 128 variations and dozens of percussion sounds. It can play music in 64-voice polyphony without effects or 38 voices with effects.

Here’s what you need to get started:

  • An Arduino
  • The Arduino IDE, if you don’t have it
  • The Fluxamasynth library
  • An amplifier, stereo system, or set of powered speakers (or headphones)
  • a mini stereo cable to hook up to audio output device

Getting started

  1. Check the pin select jumper. The current version ships with the pin select jumper set to “4”. The pin select is used to determine which pin on the microcontroller sends the MIDI signals to the ATSAM2195 chip. By default the library code uses the microcontroller’s software serial library to talk to the shield on pin 4. We made this selectable in case someone wanted to use the hardware serial port instead (and pins 2 and 3 have interrupts associated with them, which can be useful).
  2. The audio output of the synth is line-level stereo output; it needs to be amplified to be heard clearly, though headphones work as well. Connect the output to powered computer speakers, your stereo or an amplifier. The correct output cable is a stereo mini, which looks like this:

Stereo mini cable

Programming with the Fluxamasynth Library

Download the library and follow the instructions on the Arduino site for installing libraries.
As a first step, try reading an analog input pin and using that value to bend a pitch:

#include <Fluxamasynth.h>

Fluxamasynth synth;     // create a synth object

int note=60;            // C4 on keyboard
int bend=512;           // midpoint of pitch bend range

void setup() {
  synth.setMasterVolume(255);            // max volume
  synth.setChorus(0, 5, 127, 127, 127);  // turn on Chorus effect
  synth.programChange(0, 0, 58);         // set instrument to Trombone
  synth.pitchBendRange(0, 127);          // set pitch bend to maximum range
  synth.noteOn(0, note, 64);             // play C4
}

void loop() {
  bend=analogRead(0);
  synth.pitchBend(0, bend);  
}

For this example you can sep up a circuit as in the Arduino analog input tutorials, with an analog sensor or potentiometer hooked up to analog input pin 0. You can also get interesting effects by just hooking up a wire and using your body’s capacitance to change the input value.

Check out the full library reference for all of the commands in the library.

For a more complicated example of generating algorithmic music with the Arduino and Fluxamasynth shield, see the “Terry Riley’s In C” code in the library’s example sketches.

Troubleshooting

Crackly Sound

The most common source of crackling sound is not using a noteOff() for each noteOn() on a channel. You’ll hear some distortion if you call a second noteOn() on a channel without turning the note off.

No Sound

  1. Make sure that the Fluxamasynth is on a non-conductive surface. Attach it to a piece of foam core while you’re prototyping, then attach standoffs to the corner holes for a more permanent solution.
  2. Is the pin select jumper on pin 4? Note that the library defaults to using pin 4.
  3. Are you using the correct audio cable? A mini stereo cable is what you need.
  4. Check to see if your powered speakers work with other audio sources and that the volume is up.
  5. Open up the Serial monitor in the Arduino IDE and see if you are getting any Serial data from the synth. You won’t get anything coherent since the MIDI data is transmitted at 31250 baud, but you should get a bunch of binary garbage characters in the Serial monitor if everything is working. If not, there may be a problem in your code.
  6. Go back and upload the “hello world” program at the start of this document to make sure it isn’t a coding error. Check the master volume and channel volumes to make sure you aren’t playing silent sounds. Check the duration of noteOn and noteOff and make sure you are letting the note sound long enough to be heard. Make sure the attack is a reasonable value. Remember that most MIDI values are in the range 0-127. Values greater than 127 will “roll over” (i.e. 128 = 0).

If you still have problems, please send a specific description of the problem and your setup to support@moderndevice.com. Pictures are often very helpful when troubleshooting via email. Send error messages if you’ve got them.

By Shawn Wallace on May 9, 2013.