I've got my prototype Hz# function working. Done with BASIC 
statements/functions with some macro help from TiddlyWiki.

A "Musical Notes Dictionary 
<https://basicanywheremachine.neocities.org/sample_programs/Musical%20Notes%20Dictionary.html>"
 
tiddler to store the name-value pairs of NoteNameAndOctave and frequency.

The "Hz#(note$) 
<https://basicanywheremachine.neocities.org/sample_programs/Hz_setup.png>" 
tiddler that defines the Hz# function.

   - 
   
   the quickest no-fuss-no-muss approach involves putting in browser local 
   storage all of the name-value pairs of musical notes, and getting the Hz# 
   function to take the note$ parameter and look it up in browser local storage
   - 
   
   the list of SetLocalStorage() statements is generated by TiddlyWiki at 
   program run time
   
For any program in which I want to use Hz#, I add an "include" macro call 
at the top of the program: <<include "Hz#(note$)">>

Sample program: Amazing Grace *(crude first attempt)*

   - 
   
   view the source code before run-time TiddlyWiki processing 
   
<https://basicanywheremachine.neocities.org/sample_programs/Amazing%20Grace.preinclude.bas.html>
   - 
   
   view the source code at run-time 
   
<https://basicanywheremachine.neocities.org/sample_programs/Amazing%20Grace.bas.html>
    *(i.e. the "wikified" source code)*
   - 
   
   run the program 
   
<https://basicanywheremachine.neocities.org/sample_programs/Amazing%20Grace.run.html>
   

On Monday, August 15, 2022 at 10:17:52 PM UTC-3 Charlie Veniot wrote:

> 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:*
> [image: Screenshot 2022-08-15 10.01.19 PM.png]
> *The data dictionary with NoteName+NoteOctave and frequency ("name-value") 
> pairs:*
> [image: Screenshot 2022-08-15 10.02.01 PM.png]
>
> *The "Hz#(note$) tiddler rendering the Hz# function:*
> [image: Screenshot 2022-08-15 10.03.04 PM.png]
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a081ea70-0aa1-4e73-945c-f33c02689c80n%40googlegroups.com.

Reply via email to