The BeatVox includes the following features:
Here are some sample programs for making sounds with the BeatVox shield.
The heart of the BeatVox shield is two high-quality low-pass filters (one for each audio channel) that are used to filter the two 16-bit timer PWM outputs of the Arduino. Sounds are generated by modifying the PWM duty cycle. The low-pass filters smooth out the signal and remove most of the switching noise so all that is left is the audio.
By leaving the sound synthesis to the Arduino you do not have to tie up the SPI or I2C lines constantly sending data to a D/A converter. Only the 16-bit timer PWM outputs (D9/D10 on an Arduino Uno/Duemilanove, D6/D7 on a Mega) are used to make sounds.
This method of sound synthesis is good for percussive sounds or speech samples (it was conceived as a synthesizer add-on to our Beat707 drum sequencer). The sampling rate is fixed at 22039 Hz (the standard 22050 Hz rate works just fine) and each sample is stored in 8 bits.
Pins D9/D10 are used on boards based on the ATmega328P (these are the 16-bit Timer 1 outputs). On the ATmega1280/2560 devices, pins D6/D7 are used (this is 16-bit Timer 4). You can either just use wires to connect D6 to D9 and D7 to D10 (on the stacking headers) or modify the jumpers on the BeatVox shield for permanent wiring (see below).
The BeatVox includes 512Kbytes of SPI FLASH. The FLASH is accessed over the standard SPI pins (D11-D13) and is enabled by a low level on pin D2. The FLASH device is an SST25VF040B (datasheet).
On boards based on the ATmega1280/2560, the SPI pins are on pins D50-D52. You will need to connect these pins with wires to the 3-pin jumper J20 on the BeatVox to make use of the SPI FLASH.
Sounds are stored either in the Arduino’s on-chip FLASH memory (that is, compiled in as part of your sketch) or in the SPI FLASH on the BeatVox shield. Here we look at the steps needed to take a standard audio file and convert it to the format needed to play on a BeatVox.
Whatever format your sound is in, you will need to convert it to a monophonic WAV file at a sampling rate of 22039 Hz (22050 Hz is OK too). You can play stereo sounds but each sound must be a separate monophonic WAV file and stored separately in FLASH. You can then play just the left channel, just the right channel, or both channels together.
Our favorite program for sound file manipulation is SoX. It is a free, cross-platform program that can do just about anything to your audio files. Here is an example command-line call to SoX to convert just about any type of WAV file to the format needed by BeatVox:
sox InputFile.wav --channels 1 --rate 22039 OutputFile.wav
SoX will also convert from other file formats to the WAV file format -- just give it an input audio file and it will auto-detect the format.
After you’ve converted all the WAV files you want to play to be monophonic and 22039 Hz, put them all in one directory.
To compile the sounds into your sketch, you will process all of the audio files through our free voxheader.py Python program. Chances are good you already have Python installed, but if not then it’s a simple and free installation (works on all platforms) from http://www.python.org.
Assuming you’ve got all the WAV files in the current directory you just type:
python voxheader.py *.wav
This will generate a Sounds.h file that you can then put into your sketch directory. This file is included in your PDE sketch file and the sounds then become part of your program.
Methods for storing sounds in the SPI FLASH are in the works.
The BeatVox has several jumpers to control its behavior. Refer to the schematic for more details. Here is a top view of the shield showing all of the jumper locations.
Jumpers J16 and J17 are connected by default and connect pins D9 and D10 to the left and right audio channels, respectively. These are the outputs of the two Timer 1 PWM channels on the ATmega328P.
Jumpers J12 and J13 are not connected by default -- when connected the left and right audio channels are driven by D6 and D7, respectively. These are the outputs of the two Timer 4 PWM channels on the ATmega1280/2560.
Only connect one set of jumpers. If both J12 and J16 are connected, for example, then pins D6 and D9 are shorted together which can damage the Arduino.
If you know you are always going to use the BeatVox on an ATmega1280/2560 it makes sense to cut jumpers J16 and J17 and install jumpers J12 and J13. You can always make a temporary connection by just using wires on the stacking headers to connect D6 to D9 and D7 to D10, but then you must ensure that your code does not enable D9/D10 to be outputs else they will short out to D6/D7.
The general-purpose pushbutton on the BeatVox shield is connected to pin D8 by default (through jumper J14) but can also be connected to pin D5 through jumper J10, D4 through jumper J8, or D3 through jumper J6.
Jumper J14 is connected by default, while all other jumpers are not connected by default.
The thumbwheel analog potentiometer is connected to analog input A0 through jumper J11 by default. Any other analog pin can instead be used by installing the appropriate jumper (J9 for A1, J7 for A2, J5 for A3, J4 for A4, or J3 for A5).
The BeatVox shield can be made compatible with +3.3V microcontroller boards by cutting jumper J2 and installing jumper J1. Do not ever allow both jumpers to be connected!
There are two main differences between Arduino boards based on the ATmega328P and those based on the ATmega1280/2560:
Here is how to work with these differences.
As described in the Jumpers section above, you can permanently cut jumpers J16 and J17 to disconnect D9/D10 from the audio outputs and install jumpers J12 and J13. You can also make temporary connections just by hooking up wires on the stacking headers, but then you must be careful to not make D9/D10 output pins else they can short out to D6/D7.
A 3-pin header (J20) is provided for making SPI connections to pins D50 through D52. You can either solder in a 3-pin header or just solder in bare wires and connect them to the socket headers on the Mega (as shown below). This is only needed if you want to use the BeatVox SPI 512Kbyte FLASH.
For standalone or battery-powered operation, the two-pin terminal pads (next to the reset switch on the shield) allow you to make a sturdy connection to a battery or other power source. These terminal pads can have bare wires soldered in, or you can solder in a 3.5mm two-pin terminal block (not included).
This power input is essentially the same as the DC power jack on the Arduino. Provide a DC power source of the same voltage and current that is required by your Arduino board (e.g., 7-12VDC for an Arduino Uno, at least 100mA is recommended). Power you apply to the two-pin terminal block is available at the Vin pin on the stacking headers.
The BeatVox shield is compatible with both 5V and 3.3V Arduino-compatible boards. By default jumper J2 is connected (see the schematic) for 5V operation. For 3.3V operation, cut this jumper using a small hobby knife or other sharp tool and short jumper J1. Do not ever allow both jumpers to be connected!
Here is the schematic of the BeatVox.
The BeatVox was designed in the USA and is assembled in the USA using lead-free components and lead-free manufacturing and assembly processes.