Calculator forms can be used to configure a web keyboard that can play notes, via the AudioKeys library.
This page outlines how to enable and configure the browser keyboard to play notes.
This may not work on a touch screen keyboard.
Here is a sample form on the page AudioKeysJustIntonation:
And here is the actual working form:
Other forms with AudioKeys:
_audiokeysoutputA read-only field named _audiokeysoutput needs to be placed in the form where the web keyboard image will be inserted.
This field can be of type @=hidden or @=area. If the latter, when notes play, their frequencies will be printed in this field.
akrowsOptional, default = 1
The keyboard can have 1 or 2 rows of keys, this is defined in a hidden or number field akrows:
Depending on this value, a different picture will appear showing the layout.
Note that international keyboards like French or German may work better with the 1-row layout.
osctypeOptional, default = sine
Can be a hidden field, or a set of radio buttons to let the user change them on the fly.
The values can be sine, triangle, square, sawtooth.
akpolyOptional, default = 4
The maximum umber of notes that can be played at the same time.
Can be a hidden field, or a number field to allow the user to change it.
akratiosOptional, default = equal_temp
By default, the keyboard will use the western standard Equal Temperament scale.
You can configure custom tunings, that can be fixed for a form, or you can let the user change them on-the-fly.
To configure different ratios, add them to a field named akratios. The field can be hidden, radio buttons, or text:
Hidden field holding the different ratios:
A hidden field cannot be changed by the user.
Radio buttons to toggle the tuning:
A user can select one of the radio buttons to enable that tuning.
Text area to input the ratios manually:
You can pre-fill the form with the initial ratios, but the user can modify them.
A special value ==equal_temp configures the keyboard for Equal temperament, otherwise you can define the different ratios.
The value of the field ==1 16/15 9/8 6/5 5/4 4/3 7/5 3/2 8/5 5/3 9/5 15/8 2 needs to contain 13 elements separated by spaces or commas. The elements can be either numbers or fractions. The ratios will be automatically ordered lowest to highest. The lowest/first element needs to be "1", the highest/last element needs to be "2".
akbasenote and frequency akfreq''Optional, default akbasenote=60 (C4), akfreq=261.6255653005986 Hz
Only for pure intervals.
These fields allow you to configure custom anchor note and frequency, which can be different from C4=261.6256 Hz.
For example, to configure the anchor to be note 69 (A4)=440Hz, you can set something like this:
In such a case, the frequencies of the notes will be configured so that pressing on the A4 key will play 440Hz, and the other notes calculated with the selected ratios
The fields akbasenote and akfreq can be hidden, numeric, or radio buttons.
Optional, by default one will be inserted at the end.
To disable the default reset button, use a "noreset" config field: