Table of Contents

Manage stored sounds

In addition to controlling sound playback, Bonsai can read the metadata of the stored sounds and delete them. Reading sound metadata communicates directly with the sound memory controller, so refer to the connections article to connect the USB (Soundbank) port to the computer. Deleting sounds only needs the USB (Computer) connection.

This article covers how to read the metadata of the stored sounds, delete a single stored sound, and delete all stored sounds in Bonsai.

The complete workflow is shown below. Copy and paste it into Bonsai to get started immediately, or build each section by following the step-by-step instructions in the following sections.

Manage stored sounds

Read sound metadata

Use the ReadSoundMetadata operator to read the metadata of a single stored sound or of every stored sound.

Read sound metadata

  • Insert a KeyDown operator and set the Filter property to A.
  • Insert a SelectMany operator, the nested workflow will run once for every key press.
  • Insert a VisualizerWindow operator.

Double-click the SelectMany operator to open its nested workflow, and add the operator shown below:

ReadSoundMetadata operator

  • Insert a ReadSoundMetadata operator and connect it to the WorkflowOutput node in place of the Source1 node. Configure the following properties:
    • DeviceIndex - Set the index of the Sound Card to read. If no index is specified, the first Sound Card will be used.
    • SoundIndex - Set the index of the sound to read (2–31). If no index is specified, every stored sound is read.

Run the workflow and press the A key. The visualizer displays one line for each stored sound, for instance:

2: 500Hz2sTone (384000 samples, SampleRate96000Hz)

The first number is the sound index, followed by the sound name, the length in samples, and the sample rate. The length counts the samples of both channels, so a 2 s sound at 96 kHz has 384000 samples.

Delete sound

The sounds uploaded to the device persist across power cycles. Writing a sound index (2–31) to the DeleteSound register deletes the sound stored at that index.

Warning

Deleting a sound cannot be undone. When a stored sound is deleted, any sound or pure tone that is playing also stops.

Delete sound

  • Insert a KeyDown operator and set the Filter property to S.
  • Insert a CreateMessage operator and configure the following properties:
    • Payload - Select DeleteSoundPayload.
    • DeleteSound - Set the index of the sound to delete (e.g. 2).
  • Insert a MulticastSubject operator named SoundCard Commands.

Run the workflow and press the S key to delete the sound stored at sound index 2. To store a new sound at that index, use the Sound Card app or follow the Upload waveforms with Bonsai tutorial.

Delete all sounds

Writing a non-zero value to the DeleteAllSounds register deletes every sound stored on the device.

Warning

Deleting a sound cannot be undone. When a stored sound is deleted, any sound or pure tone that is playing also stops.

Delete all sounds

  • Insert a KeyDown operator and set the Filter property to D.
  • Insert a CreateMessage operator and configure the following properties:
    • Payload - Select DeleteAllSoundsPayload.
    • DeleteAllSounds - Set the value to 1 (any non-zero value deletes the sounds).
  • Insert a MulticastSubject operator named SoundCard Commands.

Run the workflow and press the D key to delete all the stored sounds.



Documentation for release v3.0.0