Programming the VS:
The first step in recording audio into you VS is collecting / recording and saving the files into a folder on your computer. The audio files can be many formats MP3, AIF, WAV or SND files. The next step is creating a list of sound bytes that you want to record. It should look like this;
Example of the text file used to program the VS.
Example of directory containing the sound files.
Note: Spaces are not allowed in the names of the sound files .
Requirements: The text file must have two columns, the first must be an integer number that is in the range of sound bytes that you are going to load into the VS. These numbers are the Sound Slots that the Arduino will address to play from the VS. Column two must be tab separated from column one. Column two is the name of the real sound file. Both the name in the text file and the real sound file must match upper and lower case, can not have any spaces and must include the extension.
1. Text file, with the exact name SoundScore.txt
2. Column One: An integer
3. A “TAB”
4. Column Two: Name of the sound file.
5. A “RETURN”
From the VS programming software, a serial connection is made to the VS (though the Arduino). Using this software you can either record the audio into the VS corresponding to text file score-list. Or, using the remote control section, choose a slot number, play your audio and hit record, then press the stop button when done.
With the remote control section, you can also play from any of the memory slots, wether they were recorded manually with the remote control or automatically by the programmer. Audio played by the remote control section plays through which ever audio output you have connected to the VS. This lets you test the actual sounds that are recorded into the VS.
There are three main pieces of software used to run the VS;
1. The VS Arduino library
2. The VS Loader (Arduino Sketch)
3. The VS Programmer (Multi-platform-Made with Processing)
The VS Library:
The VS library for the Arduino must be installed first. To do this, download the VS Library folder and place it in the Arduino library folder. The library folder is usually located here: /Arduino/Hardware/Library.
The VS Loader:
After the VS Library folder is in the correct place, relaunch the Arduino software. Then go under the File menu to Sketchbook -> Examples -> VoiceShield -> VSLoader. Open this sketch, compile it, then upload it to your Arduino. Once this is done you can quit the Arduino software and program the VS with audio.
The VS Programmer:
To install, you simply download the version that matches your OS: Mac, Windows or Linux. I’ve included all the basic parts needed to run this software;
I. The VS Programmer (coded in Processing & compiled into an application).
II. SoundBytes folder with sample sound bytes.
III. SoundScore.txt text list with sound slots and audio file names.
The VS is programmed in real time, the audio is sent over an audio cable while the VS is controlled by serial data signals sent to the Arduino.
1. Connect the audio out of your PC to the audio in of the VS using a double ended 3.5mm stereo cable. Adjust the computers playback volume to a level that is louder then normal listening volume but not too loud. (You may need to experiment a bit with the volume.)
2. Launch the VS Programmer. Once it is open, on the left side you should see a list of numbers (these are the sound slots) with the names of the audio files. On the right hand side you should see a list of serial ports available on your computer. Select the one that corresponds to your Arduino, by clicking in it’s check box, then click the connect button.
3. After a few seconds you should see the two indicators in the upper left turn green, meaning that your programmer has opened a serial port and that the Arduino has responded indicating that it has the “VSLoader” sketch installed properly.
4. Click once on the Program button in the lower left, to start programming audio into the VS.
5. In the Status area on the bottom of the window you should see a massage about which sound byte is being programmed and after they are all done, you will see a message that says it is finished programming. On my computer I find it handy to have a splitter on the audio wire onto which I can connect headphones, so as to listen while the VS is being programmed.
Now you can either test the recorded sounds by using the remote control section of the programmer, or quit the programmer and start using these sounds with an Arduino sketch.
The most basic way to use the VS is to have your Arduino code call the ISDPLAY(n) function. Where “n” is the number of the sound slot that you want to play. The VS will automatically stop when the EOM (end of message) is reached.
When recording to the VS the ISD places an EOM flag at the end of the audio sample when you (or the programming software) tells it to stop recording. This way, during playback, the VS can tell when it has reached the end of a audio sample. This also causes the interrupt (INT) pin to go low, this way the Arduino can tell when the end is reached. This is important, when you want to play many audio clips one after another, but have no other way of telling how long they are.
Note: The VS uses digital pins 2,3,4 and 5 of the Arduino , adjust your project so that it does not use these pins.
Check these example Arduino sketches;
Basic Button Talk: Connect buttons to make the VS talk when pressed.
Basic Phrase Talk: See how to join a bunch of words into a sentence.
Basic Number Talk: Arduino reads analog voltage, VS says it two different ways.
I2C Clock Talk: A clock that says the time once a minute. (Uses, PCF8583 a real time chip, and SpikenzieLabs I2C-LCD interface to display the time.)
Using the VS Arduino Library:
These are the functions that your Arduino sketch can call from the VS library;
1. VoiceShield abc(n) Creates an instance of the VoiceShield class, with the name “abc” and divided into n sound bytes. “abc” can be any name, it is case sensitive. n, is the number of sound bytes the sketch is going to address. This is not necessarily the number of sound slots that it was programmed with, but it should be. [Note: 240 seconds / n = size of the sound slots.]
1. ISDPLAY(n): Causes the VS to start playing from n, where n is a sound slot. Playback can be stopped by either calling the ISDSTOP() function, by starting to play a new sound (old sound will stop immediately and new one will start) or when the VS gets to the end of the sound byte. With ISDPLAY(), the Arduino is free as soon as the command is sent to the VS.
2. ISDPLAY_to_EOM(n) : Causes the VS to start playing from n, where n is a sound slot. Unlike ISDPLAY(n), ISDPLAY_to_EOM(n), keeps the Arduino busy until the VS lets the Arduino know that the sound is finished playing.
3. ISDRECORD(n): Causes the VS to start recording into sound slot n. The VS will not stop recording until the memory is full, or you issue the ISDSTOP() command.
4. ISDSTOP(): Causes the VS to stop recording or playing.
5. SOUNDSLOTS(): Function returns the number, as an integer, of sound slots programmed into the current Arduino sketch.
6. ISDEOM(): Function returns the status of the EOM marker as an integer. Low (0) when the VS is at the end of a sound or the memory and high (1) during playback.
Screen shot of a basic Arduino Sketch that will play a sound from slot #5, wait 2 seconds and play it again.
3. Mac OS: VoiceShield Programmer (v3 beta) appmacosx.zip
4. Windows: VoiceShield Programmer (v3 alpha) appwindows.zip
5. Linux: VoiceShield Programmer (v3 not tested) applinux.zip
This version is leaner and meaner then the original VoiceShield Programmer. VSProgrammerLite is made with Processing and uses the updated Minim audio library. It also does not use the controlP5 GUI interface, so it is simpler, lighter and more cross platform compatible.
Screen shot of the VSProgrammerLite. A “lightened” version of the VoiceShieldProgrammer. This version works the same way as the original but has a simplified interface.
Copyright SpikenzieLabs 2019