Art 483 | Fundamentals of Interface Design | Winter 2007

Creating Sound Files

These instructions will show you how to create custom sound files that can be played by a program running on the NXT.

The process of creating and using a custom sound file on a NXT robot is accomplished in a number of steps, each using different software tools. These production steps can be summarized as follows:

  1. Recording/editing: generating a digital audio file with the sound composition
  2. Resampling: changing the audio file to the correct sample rate [if necessary]
  3. Conversion: converting the audio file into a format acceptable to the NXT system
  4. Transfer: downloading the NXT sound file onto the robot

Following that, a reference to a sound file is made in a NXT program and the program can then be run.

The production steps above are complicated and are illustrated in a flowchart which can be found here.

Following are detailed instructions for accomplishing each step. In all steps, tools for both Macintosh and Windows platforms are described.


Assuming one wishes to create an original sound file, the first step is to record and edit a digital audio file containing the sound composition. While there are many production quality audio tools available, a high quality, free, open source tool is Audacity, available on most platforms, including Macintosh and Windows, here. Download and install the correct version of the application on your system.

On the Macintosh, another option is the Professional version (not free) of QuickTime Player. If you have this license, QuickTime Pro is perhaps simpler to use than Audacity. It is also preferable because it can do the required resampling that Audacity does not support. You can upgrade the free QuickTime Standard to the Professional version by purchasing it and getting a serial number.

Which ever tool you choose, record and edit your sound and save it as a WAV file. The required settings for this file are:

  • sampling rate: 8 kHz (8000)
  • sample size: 8 bit
  • sound mode: mono

If you are using QuickTime Pro, record the sound, edit it, then Export it as "Sound to Wave" and "8 kHz 8 bit Mono." See screen snapshot below.

Audacity does not support 8 bit output, so you must make sure the audio track is 16-bit mono instead, and set the "Project rate" to 8000 (8 kHz). Then use "Export as WAV..." to save your sound file. See screen snapshot below. In the next step, we will change the sample size to the required 8 bits (resample).

WARNING: Be sure to trim all unnecessary or undesired sound or silence from the recording to keep the sound file as small as possible. Audio files can quickly get very large, and the NXT robot has very little storage space.


If you used QuickTime Pro, you can skip this step and go directly to the conversion step, since your WAV file already has the correct sample size.

If you used Audacity, you must convert your WAV file from 16 bit mono to 8 bit mono samples. A free, open source tool called SoX (Sound Exchange) can be used for this. For the Macintosh, there is an enhanced version of this called SoX Wrap (available here), that has a user interface "wrapped" around the basic conversion tool. For Windows, use SoX (available here). [I haven't tried this one yet, so you're on your own for now.]

To convert your WAV file using SoX Wrap, open the program, choose "Add File(s)" to load it, and then configure the desired output settings as listed and shown below in the screen snapshot:

  • Output to: .wav
  • Sample rate: 8000
  • Date encoding: Unsigned Linear
  • Date size: Bytes
  • Volume: 1.0
  • Channels: 1

Choose "Define Output Path" to select the folder in which you would like the converted file saved, and then click the "Run SoX" button. It will create a version of your input file with a number appended to the name (e.g., "sample1.wav").


Now you must convert the WAV file into the native NXT format, called RSO. To do this, you use a public domain utility called wav2rso, which is written in a scripting language called Perl. Download this utility from our course server here.

Perl is an interpreted language, which means the program is simply a script that is run with a Perl interpreter. Most computers have this capability. I will explain how to do this on a Macintosh, since it is tricky, and am assuming the Windows users are computer science folks who know how to do it. (If not, let me know.)

To run Perl, open the program in your Applications/Utilties folder called Terminal. A window will open and greet you with "Welcome to Darwin!" Follow these steps carefully:

  1. At the prompt, type "perl" followed by a space, and do not press return or enter.
  2. Then, go to the Finder, locate the "" file you downloaded, drag it onto the Terminal window and release it. Do not press enter or return, but enter a space, and again do not press enter or return. You should see something like this line (depending on where your copy of "" was):
    Focolare:~ andy$ perl /Applications/
  3. Now, go back to the Finder, find the WAV file you want to convert, and drag and drop it onto the Terminal window, and release it. You should see something like this line (depending on where your WAV file was):
    Focolare:~ andy$ perl /Applications/ /Users/andy/Desktop/sample1.wav
  4. At last, you can press return. The program will run (very quickly), and you should see an empty prompt again.

That's it. You should find a file in the same folder as your WAV file and with the same name, but a ".rso" extension instead of ".wav" on the end. That is your NXT sound file.


Finally, you have only to get the .RSO file onto the NXT robot and reference it in a program to have the robot play this sound. How you do this depends on whether you are using Mindstorms or Robolab, and if the latter, whether you are using Macintosh or Windows.

First, the Mindstorms case, which is simpler. The Mindstorms installer created a folder on your computer in which it loaded all of the sound files that come with the application. You can find this folder at this location on your hard disk:

/Applications/Mindstorms/engine/Sounds/ [within your user's home folder]

{{{ would a PC user please email me the appropriate location ??? }}}

To make your own RSO sound file available to your Mindstorms program, simply put it in this folder before starting Mindstorms. Then you can select your file from the popup menu that appears in Mindstorms when you use a Sound block and select "Play Sound File." Mindstorms will automatically download the RSO file you created to the NXT when you download the program.

Robolab does not have this automatic, feature, so you must manually download the .RSO file before downloading and running your Robolab program on the NXT.

To do this on the Macintosh, you must use a public domain utility called NXTBrowser, (available on our course server here.) that connects the Macintosh to the NXT robot via Bluetooth. Download and install this program on your computer. Then follow these instructions:

  1. Turn on Bluetooth on your Mac if it isn't already on.
  2. Turn on your NXT and make sure Bluetooth is on.
  3. Launch NXTBrowser.