CF-III Sound

(Just for fun: Star Wars sound gadget)

--------------------------------------------------------------------------------------

Update, compatibility with R2 Touch v1.2

Nov. 2013.

Version 1.2 and above of R2 Touch support the MP3Trigger sound system. In order to support both CF-III and the MP3Trigger with the same app, a few changes have been made on the CF-III program and the sound organization.

  • If you update to R2 Touch v1.2, you also need to update your .bas file to the new version 1.9 provided at the bottom of this page, and your MarcDuino firmware to version 1.6.
  • The music sounds have been moved from Bank 9 to Bank 8. You do not need to change the naming of the music files, but you need to edit the number of files in bank 8 to reflect the number of music files instead of the number of the sing files.
  • The sing file category is no more, and replaced with the user file category. The "user" bank is not accessible via R2 Touch, but is accessible via the CF-III switches. I have moved my own sing- files to mus- files. If you want to use the user bank, name the files user-xxx.wav.
  • You'll need to go to the wrench menu and click "Reset to Defaults" for the music sounds to work properly. If you had made custom changes to the sound settings in R2 Touch, you will have to re-enter them.

-----------------------------------------------------------------------------------------


For my Droid sound, I use a CF-III sound system from ACS. Not only does it include a FlashCard sound player, a rather powerful audio amplifier, but also a fully featured programming environment in Basic.


I added an optional 8 contact sensing board so I could remote control it from a simple 12-channel remote. I later programmed the unit so I could also control it from the RS232 input via my iPhone App and MarcDuino boards. It makes the contact board unnecessary, but it's a nice addition and I kept the simple 12 channel remote functionality in place, just in case.


I arranged the sound files in categories or "banks" of sound, following an idea I first saw presented by Chris James (see his video here). This makes it very easy to put some order in my large sound collection and call the right sound for the right mood. Then I added the CFSOUND.BAS program file below to make it respond to both the contact boards and my R2 Touch iPhone App commands. You will need this program or another sound device that is programmed to respond to the same commands to use my iPhone App as is. Alternately, you could customize R2 Touch app to send other messages that your system will understand.

I provide a pre-made flash card image that contains both the program and default sounds. It will work with R2 Touch out of the box. Just download the file and copy to your memory card, you should be good to go

CF-III Flash Card Image

Instructions to further customize your sounds are provided below.

Sound files organization

The sound files on the memory card are organized in 9 banks, using a simple file naming convention. Note that a sound is accessed programmatically by its bank number and its number, not directly by its file name. You don't need to program anything if you are using the R2 Touch application and the MarcDuino boards, they send all the serial commands for you.

Bank 1, generic sounds, files called gen-x.wav where x is the number of the sound (1 to 99)
Bank 2, chatty sounds: chat-x.wav
Bank 3, happy sounds: happy-x.wav
Bank 4, sad sounds: sad-x.wav
Bank 5, whistle sounds: whis-x.wav
Bank 6, scream sounds: screa-x.wav
Bank 7, Leia sounds: leia-x.wav
Bank 8, musical sounds: mus-x.wav
Bank 9, user sounds: user-x.wav (triggered via CF-III switch only, not accessible via R2 Touch)

Startup sound: start.wav


Creating the Memory Card and Customizing CFSOUD.BAS for your sound files

A complete Memory Card image for the CF-III is available for download here. Just extract the files from the archive and copy them on a blank memory card. Instructions to create your own customized version are also provided below.

Before you can use the CF-III Sound system, you have to create a CF memory card image. Follow these steps:
1- make sure all your sounds are in .wav format (stereo or mono), 44 kHz sampling rate, and equalized in volume
2- rename the sounds files according to the naming convention (e.g. chat-1.wav, chat-2.wav...), and copy them to the card.
3- add a startup sound as start.wav
4- download the CFSOUND.BAS program below.
5- Before you copy it on your CF memory card, change the values of the variables Nx (lines 110 to 540) to match the numbers of sounds you have in each banks.
For example, if you have only 5 generic sounds, change line 130 to read:

130 N1=5

6- Copy your modified CFSOUND.BAS file on the card
7- Insert the card in the sound system, the startup sound should come up, you are good to go.
8- You can command the sounds either via the contact inputs or by sending commands through serial interface as described below.

Controlling sound via the switch sensing inputs

It is straightforward to control the sound via a 12-channel remote using the provided program.

Switch inputs 1-9 will play the next sound in their respective banks.
Switch input 10 will start a random sequence of sounds (use switches 1 to 9 to stop the random sequence)
I wired outputs 11 and 12 of the 12-channel remote to the volume control inputs.

Sound Command format

The program respond to commands sent via the RS232 port at 9600 bauds. Commands must start with $ and finish with a Carriage Return character:

$soundcommand\r

A description of the commands is provided below. This command set is used by my R2Touch App and the MarcDuino boards. Any sound system that implements the same command will work too.

Sound Commands Reference

$x
        If x is between 1 and 4:   
            Play next sound from bank x
        If x is between 5 and 9:
            Play first sound from bank x. Bank 9 not implemented on MP3Trigger platforms.

$xy or $xyy
        Play sound y or yy from bank x (x from 1 to 9, y from 1 to 9, yy from 10 to 99). MP3Trigger platform implements sounds only up to yy=25.

$R    
        Start playing sounds randomly chosen from banks 1 to 5, at random intervals
         (no sounds from banks 6-9 will be played in random mode)

$O       
    (capital letter O) Random Off

$s   
        Stop any current playing sound, and cancel random mode.

$-   
        Volume down

$+      
      Volume up

$m   
      Volume mid

$f       
    Volume max

Some particular sounds have been given their own command for convenience, they point to specific files in the default image provided below, you can change their assignment by editing the code:

$S    
        Scream (bank 6 sound 1)

$F       
      Faint/short circuit (bank 6 sound 3)

$L    
        Leia message (bank 7 sound 1)

$c   
       Short Cantina music (bank 8 sound 1)

$W   
        Star Wars (bank 8 sound 2)

$M    
        Imperial March (bank 8 sound 3)

$C   
       Long Cantina music (bank 8 sound 5)

$D   
       Disco Star Wars music (bank 8 sound 6)


ċ
CFSOUND.BAS
(12k)
Curious Marc,
Nov 3, 2013, 6:36 PM