Make Squiffy display attribute values instead of {a} {b} {c}

My house is full of musicians, but I'm not one. Occasionally they ask me to familiarize myself with the base line of some quartet. I use the tool below to do that. It's really ugly but I know how it works and I didn't have any plans to publish it until now. The worst thing about it, is you have to paste one result back into the Squiffy code and run the thing again to make it work. I'd like to skip that step so you can use it from a browser.

@title Sheet Music Cheater

<big>**Sheet Music Cheater**</big><br>
Directions: Choose the staff you need to read from but can't. Count from the bottom up.
*   Is the note on a **L**ine? Count **L**ines by **L**etter, starting with "a". (If it's actually under the lines and it has a little line going through it, that's "u" for under.
*   Is the note in a space? Count spaces by number, starting with "1". (If it's actually touching the bottom line, that's "0" (Zero).)
*   Enter your results into the text area below. INCLUDE A SPACE BETWEEN EACH CHARACTER!

<textarea id="cheat">3 3 3 b 2 c 3 c 2 b</textarea>
 
Did you read this from the [[treble]](go, treble) (&#119070;) or [[bass]](go, bass) (&#119074;) clef?
 
[[go]]:

      var tabs = document.getElementById("cheat").value;
    var paste = tabs.replace(/ /g,"} {");
      squiffy.set("paste", paste);


&lcub;{paste}&rcub;

{if treble:
<!----Line Notes---->
{@t=s} {@a=f} {@b=h} {@c=k} {@d=z} {@e=c} 
<!----Space Notes---->
{@0=d} {@1=g} {@2=j} {@3=l} {@4=x} {@5=v}
}

{if bass:
<!----Bass---->
<!----Line Notes---->
{@t=0} {@a=w} {@b=r} {@c=y} {@d=i} {@e=p} 
<!----Space Notes---->
{@0=q} {@1=e} {@2=t} {@3=u} {@4=o} {@5=a}
}

[[results]]
[[results]]:
<!---------------------Paste Result Here (Yes, right below this line right here. This is the stupid part I want to change.)------------------------->

<!---Paste the letters at the bottom of the Output window into--->
[piano](https://virtualpiano.net/)

Anybody know how to do it?


I'm kind of guessing how this is supposed to work. But off the top of my head, would it be something like this?

@title Sheet Music Cheater

<big>**Sheet Music Cheater**</big><br>
Directions: Choose the staff you need to read from but can't. Count from the bottom up.
*   Is the note on a **L**ine? Count **L**ines by **L**etter, starting with "a". (If it's actually under the lines and it has a little line going through it, that's "u" for under.
*   Is the note in a space? Count spaces by number, starting with "1". (If it's actually touching the bottom line, that's "0" (Zero).)
*   Enter your results into the text area below. INCLUDE A SPACE BETWEEN EACH CHARACTER!

<textarea id="cheat">3 3 3 b 2 c 3 c 2 b</textarea>
 
Did you read this from the [[treble]](go, treble) (&#119070;) or [[bass]](go, bass) (&#119074;) clef?
 
[[go]]:

      var tabs = document.getElementById("cheat").value;
      var map = squiffy.get('treble') ? 
        t:'s', a:'f', b:'h', c:'k', d:'z', e:'c',
        '0':'d', '1':'g', '2':j', '3':'l', '4':'x', '5':'v'
      } : {
        t:'0', a:'w', b:'r', c:'y', d:'i', e:'p',
        '0':'q', '1':'e', '2':t', '3':'u', '4':'o', '5':'a'
      };
      squiffy.set("result", tabs.replace(/\s/g, '').replace(/./g, letter => (map[letter] || '?')));

Paste these letters: {result} into
[piano](https://virtualpiano.net)

Thanks, as always, mrangel! I love how your answers are consistently beautiful to look at, and feel like magic.

I'm kind of guessing how this is supposed to work.

I'm musically incompetent, so this lets me look at a bar of music and go, "Duhrr, this note is being stabbed by the bottom line. I call it 'a'. Grunt, grunt. The next note is in the second space from the bottom. I call it '2.' Snort." etc.

The program doesn't translate it into note names because that's basically meaningless to me. It translates it into the code used by several online virtual pianos I've found.

So even though I can't read music or play piano, I can just type the letters I see and it sounds like I'm playing piano with one finger. After doing that several times, I can learn to grumble out the bass line well enough to satisfy my singing relatives.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums