Mozzi  version v2.0
sound synthesis library for Arduino
char2mozzi.py File Reference

A script for converting raw 8 bit sound data files to wavetables for Mozzi. More...

Go to the source code of this file.

Detailed Description

A script for converting raw 8 bit sound data files to wavetables for Mozzi.

Usage: >>>char2mozzi.py <infile outfile tablename samplerate>

Parameters
infileThe file to convert, RAW(headerless) Signed 8 bit PCM.
outfileThe file to save as output, a .h file containing a table for Mozzi.
tablenameThe name to give the table of converted data in the new file.
samplerateThe samplerate the sound was recorded at. Choose what make sense for you, if it's not a normal recorded sample.
Note
Using Audacity to prepare raw sound files for converting:

For generated waveforms like sine or sawtooth, set the project rate to the size of the wavetable you wish to create, which must be a power of two (eg. 8192), and set the selection format (beneath the editing window) to samples. Then you can generate and save 1 second of a waveform and it will fit your table length.

For a recorded audio sample, set the project rate to the MOZZI_AUDIO_RATE (16384 in the current version). Samples can be any length, as long as they fit in your Arduino.

Save by exporting with the format set to "Other uncompressed formats", "Header: RAW(headerless)" and "Encoding: Signed 8 bit PCM".

Now use the file you just exported, as the "infile" to convert.

Author
Tim Barrass 2010-12

Definition in file char2mozzi.py.

Functions

def char2mozzi.char2mozzi (infile, outfile, tablename, samplerate)