Sound Workbench

Sound Workbench preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 168 times • Downloaded 23 times • Run 0 times
Download the 'Sound Workbench' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

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.

Uploaded by When Description Download
Uri Wilensky over 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 10 years ago Updated version tag Download this version
Uri Wilensky over 10 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Sound Workbench Download this version
Uri Wilensky over 12 years ago Sound Workbench Download this version

Attached files

File Type Description Last updated
Sound Workbench.png preview Preview for 'Sound Workbench' over 9 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.