In BASIC Anywhere Machine, the SOUND statement is used to play sound frequencies for a specified length of time.
Syntax: SOUND frequency, duration
Typing in frequencies for specific musical notes is a pain.
Intead of typing in frequency numbers for every note, it would be nice to be able to just type in the note (i.e. note name and octave.) For example:
SOUND Hz#(“C1”), 18 instead of SOUND 32.703, 18
If I am going to associate a NoteName+NoteOctave with a frequency for every note and octave, I want to do that just once. Only once, with ability to reuse that everywhere for all needs, in particular: documentation and an auto-generated code library.
As per screenshots below, using TiddlyWiki to store date and generate code: that’s pretty cool.
(Might be tweaking this if I run into problems, but working fine so far.)
The basic program with macro to include the Hz# tiddler, which takes care of generating the Hz# function:
The data dictionary with NoteName+NoteOctave and frequency (“name-value”) pairs:
The "Hz#(note$) tiddler rendering the Hz# function: