Audio hardware block

The Interstacks Audio hardware block can play musical notes via its built-in MIDI music synthesizer, play sound files, and generate digitized audio data. The block has a small speaker and microphone inside its plastic case, as well as connectors on the back for plugging in an external speaker or external microphone.

Simply send a character string, like ‘cde’, to the “Music Note” input terminal to hear three music notes. Try “CDEFG” to hear notes an octave higher. You can also send raw MIDI commands. See the detailed specification sheet below for more information.

The “Sound Data In” terminal can play MP3, WAV, and AAC encoded sound files. This can get a bit complicated as you need to use the “Play FC” flow control output terminal to manage sending data into the Audio block. Example projects and software blocks will be available soon. By using the built-in or external microphone, you can record (digitize) sound. The sound data is sent out of the “Recorded Sound” output terminal in the WAV sound format. The “Record FC” flow control input terminal is used to manage the sending of the sound data out of the Audio block. You start and stop recording by sending any message to the “Start Recording” and “Stop Recording” terminals. Alternatively, you can set a fixed recording time by setting property “R” in the Stackbuilder property editor.


Set Properties of Audio Block
If you want to set any properties for the Audio block in Stackbuilder, select the Audio block by clicking on it once in Stackbuilder. Click in the “Property Editor” in the bottom right, in the first row, in the “Property” column. Type a “V” (without quotes) to set volume level. Click in its corresponding “Default Value” column and type a number between 0 and 100.


Connectors on back
Looking into back:


Note that there is a small speaker and microphone built-in to the module.

For advanced users, the full blocks specification sheet with all properties and terminals.
Audio Block
Built-in and external, microphone and speaker to record and play sounds (WAV, MP3, AAC) plus MIDI music note synthesizer.

T (uuid): Module Type
F (int): Firmware Version

V (int): Volume 0-100.
B (int): Bass 0-15.
H (int): Treble 0-15.
X (int): 0 use internal speaker (defualt), 1 use external speaker.
S (int): 0-3. Audio recording sample rate. 0-8khz 1-16khz 2-32khz 3-48khz. Default 0. 16 bit mono IMA ADPCM. At 8khz, 4k bytes/second.
R (int): Maximum audio recording length in seconds. Default is 0 which is infinity.

D (int): Note duration in milliseconds for “Music Note” terminal (play musical note).
P (int): 0-128. Instrument (MIDI "program") number for terminal 2. 128 is percussions. For example: 0 grand piano, 19 church organ 24 acoustic guitar 40 violin 42 cello 56 trumpet 57 trombone 66 tenor sax 71 clarinet 73 flute 105 banjo 109 bag pipe 124 telephone ring 126 applause. For instrument 128, each note is a different percussion instrument, per MIDI GM1+GM2 table.
A (int): Audio module status. Echoes "Status" terminal. 0=nothing, 1=record, 2=audio stream, 3=midi

“Properties” - in (List or Property Name string): To set property. Send property name, Value. For example [’N’,’netname’]. To get property, just send property name. For example ’N’.
“PResponse” - out (List or True) : On set, responds with True when done. On get, responds with list. For example [’N’, ‘netname’].

"Sound Data In” - in (Binary): Audio data (or MIDI format 0) in to play. MP3, WAV, AAC.
"Play FC” - out (int): Flow control.

“Music Note” - in (int or binary or string or list of ints): Play musical note (MIDI convention, middle C is 60, full range 0-127) for Property D duration (in mS), using Property P instrument (MIDI convention 0-128 instrument table. Percussion is 128). If percussion instrument selected, then notes become different percussion effects per MIDI GM1+GM2. Can also optionally embed note durations in binary data stream. If int > 128, following note duration is (int - 128) * 100ms. MIDI notes to “Music Notes" with different durations. Binary('\x86\x3c\x83\x3e\x86\x40\x84\x3c\x86\x40\x86\x3c\x86\x40')

String. 'a' through 'g' and 'A' through 'G' map to notes with 'c' being middle c. and ‘C’ being octave above middle C. 'c#' will play C sharp. can send string like 'abcc#dd#efgg#’. '1' plays middle C. '2' plays C sharp.
List of ints. A python list of ints can also be used. [60, 61, 62, 63]
Advanced: If the binary data has \xFF as first value, then the rest of that data is used as raw MIDI commands. Note on is \x90. Note off is \x80. Program (Instrument) change is \xc0. Typical format is: \xFF, NoteOn or NoteOff, Note value, Velocity value (e.g. \x5a). You must send a value for velocity for each note. Binary('\xff\x90\x3c\x5a\x90\x40\x5a\x90\x43\x5a') C chord. 3 notes on. Most instrument selections will have notes decay to zero eventually. A few instruments (church organ (19), rock organ (18)) will keep On notes playing forever until a NoteOff is sent. Binary('\xff\x90\x3c\x5a') One note on. Binary('\xff\x80\x3c\x5a\x90\x40\x5a') Same note off then new note.

“Music FC” - out (int): Flow control.

"Recorded Sound” - out (Binary): Audio data out that was recorded (digitized). WAV file.
"Record FC” - in (int): Flow control.
"Start Recording” - in (Any): Starts recording. For record length time (property “R”) in seconds. If streaming on, 0 stops recording. Sends audio data out “Recorded Sound” terminal.
“Stop Recording” - in (Any): Stop recording.
“Status” - out (int): Sound playing status. 0=nothing, 1=record, 2=audio stream, 3=midi

For Advanced users: A note about using flow control terminals for transferring large amounts of sound data in to, or out of, the Audio block. A negative number is the message size. A positive number is the number of messages that can be received. On getting the stack startup message (BP has been constructed message), flow control terminals send their initial information. For Audio, both input terminal “Sound Data In" and input terminal “Music Note" are flow controlled. “Play FC” terminal sends -1400 (1400 byte message size) and 6 for can receive 6 messages. “Music FC" terminal sends -10 for 10 byte message size and 20 for 20 messages. As data is sent in to the corresponding “Sound Data In” or “Music Note” in terminals, the flow control terminals will output the number of messages they are now ready to receive, having processed some number of previous messages. You are not required to use these terminals. They are only needed if you are trying to send large streams of data into the audio module. The “Record FC” flow control input terminal is used to manage the sending of sound data out of the Audio block’s “Recorded Sound” output terminal.

Refer to documentation on many other topics at
Please email with any questions.