Sound Workbench
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model demonstrates the capabilities of the sound extension. It allows modelers to experiment with different instruments.
The instrument section allows you to choose one of the 128 instruments provided by the sound extension. (For a complete list, see the Sound section of the NetLogo User Manual.) After you choose an instrument, you can listen to a C-major scale or chord in that instrument, or choose a particular pitch.
Each time the model plays a sound, it writes the command used to generate the sound to the output area. You can copy and paste the command to use in your models.
The memory bank lets you store the current sound for later retrieval, allowing you to hear how different sounds will sound together.
Comments and Questions
extensions [ sound ] globals [ instrument-index memory ] ;; initializes the instrument-index and the memory bank to startup set instrument-index 0 set memory (list "" "" "" "") end ;; plays the current note and prints it to the output area to play run generate-command output-print generate-command end ;; generates a NetLogo command to play the current instrument ;; at the current tone with the current velocity to-report generate-command report (word "sound:play-note \"" ( item instrument-index sound:instruments ) "\" " tone " " velocity " " duration) end ;; saves the current command in the nth memory slot to save [ n ] set memory replace-item n memory generate-command end ;; returns a list of tones comprising a middle-C major scale to-report c-major-scale report map [? + 60] [0 2 4 5 7 9 11 12] end ;; arrow keys to scroll through the instrument list to first-instrument set instrument-index 0 play end to last-instrument set instrument-index length sound:instruments - 1 play end to next-instrument if instrument-index < length sound:instruments - 1 [ set instrument-index instrument-index + 1 play ] end to prev-instrument if instrument-index > 0 [ set instrument-index instrument-index - 1 play ] end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Sound Workbench.png | preview | Preview for 'Sound Workbench' | over 12 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.