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.
Read sound metadata
Use the ReadSoundMetadata operator to read the metadata of a single stored sound or of every stored sound.
- Insert a
KeyDownoperator and set theFilterproperty toA. - Insert a
SelectManyoperator, the nested workflow will run once for every key press. - Insert a
VisualizerWindowoperator.
Double-click the SelectMany operator to open its nested workflow, and add the operator shown below:
- Insert a
ReadSoundMetadataoperator and connect it to theWorkflowOutputnode in place of theSource1node. 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.
- Insert a
KeyDownoperator and set theFilterproperty toS. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectDeleteSoundPayload.DeleteSound- Set the index of the sound to delete (e.g.2).
- Insert a
MulticastSubjectoperator namedSoundCard 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.
- Insert a
KeyDownoperator and set theFilterproperty toD. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectDeleteAllSoundsPayload.DeleteAllSounds- Set the value to1(any non-zero value deletes the sounds).
- Insert a
MulticastSubjectoperator namedSoundCard Commands.
Run the workflow and press the D key to delete all the stored sounds.
Documentation for release v3.0.0