BlocklyProp reference for AUDIO blocks
BlocklyProp blocks for generating audio. See each block for board type compatibility.
frequency out
Compatible with all Propeller board types
The frequency out block generates pulses of the specified frequency and duration on an I/O pin. An example use would be generating beeps on a piezospeaker.
- PIN: select the Propeller I/O pin on which to send the signal. Options may vary by board type.
- duration (ms): insert a value block to set the duration in milliseconds for the pulses to last.
- frequency (Hz) insert a value block to set the frequency of the pulses, in Hertz.
The PIN menu this block can be set to "other." When "other" is chosen, the dropdown menu disappears, and it is replaced with an input. You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:
sound initialize
This block launches a processor automatically. Use only one instance of this block per project.
Compatible only with the Activity Board WX and Badge WX board types.
The sound initialize block starts the polyphonic (multi-tone) sound process.
sound play
Available for Activity Board WX, FLiP, and both Badge board types.
The sound play block controls the frequency, volume, and waveform generated on the selected channel.
- Select the sound channel: A, B, C, or D
- Select the action
- set frequency in Hz (1 to 20000)
- set volume (0 to 127)
- set waveform: sine, square, triangle, sawtooth, or noise
- stop: stops generating the waveform
text to speech say
Using either text to speech block will launch one processor (only one total, NOT one per block).
For the Hackable Electronic Badge and Badge WX.
The TTS say block phonetically pronounces the letter characters in the attached text string block.
text to speech spell
Using either text to speech block will launch one processor (only one total, NOT one per block).
For the Hackable Electronic Badge and Badge WX.
The TTS spell block pronounces each letter character from left to right in the attached text string block.
WAV play
This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.
This block launches TWO processors automatically.
The WAV play block does the following:
- Sets up the microSD card reader connection for the specified board type*
- Sets up the WAV player object in the Propeller microcontroller
- Plays the WAV formatted audio file from the SD card whose filename was typed into the block.
*Compatible with FAT32-formatted microSD cards, such as Parallax #32328.
The WAV file on the microSD card must be in the correct format.
Options from our Sound Library reference section:
- Download pre-formatted files from the Sound Library
- Re-format your audio files with the free Audacity software - tutorial
- Create your own new audio files with Audacity - tutorial
WAV BLOCKS MUST BE USED WITH OTHER TYPES OF BLOCKS. The WAV play block launches processors to manage the SD card and generate the audio output. However, once the first processor has launched the others, it will shut itself down if it does not have any other blocks to execute. This breaks the project, and instead of hearing your audio track, you will just hear a buzzing sound. To avoid this, the first processor must keep running.
If your project does other things, like blink lights or make a robot move, your WAV file will play as long as other code keeps running.
If your project does NOT do other things and all you want to do is play the WAV file, do one of these two things:
- Follow the WAV play block with an empty repeat forever block to play just one file, if you don't know how long it lasts.
- Follow the WAV play block with a pause block with a duration lasting longer than your audio track, as shown below. You can alternate WAV play blocks and pause blocks to play a series of WAV files.
WAV status
This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.
The WAV status block provides a value of 1 (one/true) if a WAV file is currently playing and a value of 0 (zero/false) if a WAV file is not currently playing.
WAV volume
This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.
The WAV volume block set the volume of the Propeller’s WAV player. A value of 0 is quietest, and 10 is loudest.
WAV stop
This block is ONLY available for the Propeller Activity Board WX and Badge WX board type.
The WAV stop block stops playing a WAV file.
WAV set pins
Compatible only with the Activity Board WX
The WAV set pins block is used only at the beginning of your program to send the WAV file player output to different pins.