JavaScript Examples

Welcome to the Developer Tools JavaScript Examples.

These examples show you how to use JavaScript ES5 and the Wildword Soundworks interface to generate music and control your device. The first three examples include a brief overview of music theory and programming.

Click on the link in the table to open the example.

LinkConcepts
Chromatic Scale
Sound, Frequency, Pitch, Octave
Notes and Chromatic Scale
MIDI Notes, Note-On and Note-Off
JavaScript Programming and Events
Timing, Beats per Minute and Sleep
Diatonic Scale
Diatonic Scale and the 7 Note Names
Sharps and Flats
Minor and Major Scales and Modes
Terminology
Playing Scales
Chords
Sound, Frequency and Ratios
Structural Harmonies
Thirds, Fifths and Chords
Naming Sharps and Flats
Application to MIDI

Developer Tools

To run the examples, you need start the Developer Tools on your device. Use the Network menu on your device to connect your device to WiFi and start its web server. Then open the URL for the Developer Tools in a web browser. See Developer Tools Quick Start Guide for more information.

JavaScript ES5

The Developer Tools provide support for JavaScript ES5. This version of JavaScript is ideally suited for the limited hardware capabilities of small devices. It achieves this by not providing language features such as arrow functions, async promises, the let / const / class keywords and template literals.

Some may wonder why the devices don't use MicroPython or Lua or some other scripting language. The reality is that the language doesn't really matter that much. The core features of all these languages are very similar and the main purpose is to control the underlying device, which is easy given any modern scripting language.

Running an Example

Click on the link for the example in the table above. A new page opens with an overview and JavaScript. Take a look at the overview and scroll down to the JavaScript. Press the Copy button to copy the example to the clipboard.

Back in the Developer Tools, navigate to a folder on the device (e.g. local) and create a new folder for your examples using the New Folder menu item. Then click on the new folder to make it the current folder. Click on the New File menu item and paste the clipboard into the editor pane on the top right.

Press Save As to save the example to the current folder.

Press the Run button to run the example. If you want, you can press the Interrupt button to stop the example before it finishes.

Future Directions

More examples will be added as time permits. If you would like information on programming a specific function please Contact Wildwood Soundworks.