QB64 Phoenix Edition
Numbers at end of Play strings - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Expanding Horizons (Libraries) (https://qb64phoenix.com/forum/forumdisplay.php?fid=21)
+---- Forum: Terry Ritchie (https://qb64phoenix.com/forum/forumdisplay.php?fid=31)
+---- Thread: Numbers at end of Play strings (/showthread.php?tid=1775)

Pages: 1 2


Numbers at end of Play strings - PhilOfPerth - 06-23-2023

In some music strings (eg. the William Tell Overture presented in the Tutorial), quite a lot of lines 
end with a number (mostly 4 or 8),  that's not related to length or anything that I can identify.
Are they just "strays", or is there a function that's not documented?


RE: Numbers at end of Play strings - mnrvovrfc - 06-23-2023

Why is this question here and not in your other thread?

It seems some of the numbers are attached to "O" command which is to set the octave. Like "o3" and "o4" instead of using angle-brackets like in my "musak". Otherwise a few lines are inconsistent with the rest of the song and they do set the length of notes. Things have to be looked at more closely. This song is quite complex especially to do with only one voice.


RE: Numbers at end of Play strings - PhilOfPerth - 06-23-2023

(06-23-2023, 06:47 AM)mnrvovrfc Wrote: Why is this question here and not in your other thread?

It seems some of the numbers are attached to "O" command which is to set the octave. Like "o3" and "o4" instead of using angle-brackets like in my "musak". Otherwise a few lines are inconsistent with the rest of the song and they do set the length of notes. Things have to be looked at more closely. This song is quite complex especially to do with only one voice.

Thanks for your response Minerva;
I didn't place this in my other thread because that question, I feel, has been answered very well by other members, and I wanted to start with a clearly stated question.

Some numbers are indeed related to the O command, but there are many that have no preceding letter.
Most of these are 8, but 4 and 2 are also present (see the sample four lines below), and I suspect they're superfluous,  or not covered by any of the Play documentation.

These are four examples, the last two being toward the end of the  piece.
M$ = M$ + "b8bbo2e8g#g#f#8d#8o1b8bbb8bbb8bbo2e8f#8g#8eg#mlb4bmsag#f#e8g#8e8o3bbb8bbb8bbo4e8f#8"
M$ = M$ + "g#8o4c#8o3g#8o4c#8o3g#8o4c#8o3g#8f#8e8d#8c#8g#g#g#8g#g#g#8g#g#g#8o4c#8o3g#8o4c#8"
M$ = M$ + "e8e8o2bbb8b8b8g#g#g#8g#8g#8eee8e8e8o1b8o2e8o1b8o2g#8e8b8g#8o3e8o2b8o3e8o2b8o3g#8e8b8g#8o4e4"
M$ = M$ + "p8eee8e8e8e8e4p8p16ee4p8p16o2ee2"

Edit: This is part of one of the lines (slightly modified):
m$ = "o4e8f#8"
PLAY m$
which plays E F#. But without the "8" it shortens the last note, so it is having some effect on play.


RE: Numbers at end of Play strings - mnrvovrfc - 06-23-2023

(06-23-2023, 08:31 AM)PhilOfPerth Wrote: Edit: This is part of one of the lines (slightly modified): 
m$ = "o4e8f#8"
PLAY m$
which plays E F#. But without the "8" it shortens the last note, so it is having some effect on play.

Code: (Select All)
__________|||
__________VVV
m$ = "o4e8f#8"

Put in a "code" block in an attempt to be better seen.

This is a black key in a piano. This is not different from "e8" which is a white key. "e8" is two keys to the right-hand side of the "c" depending on which octave. The "8" in "e8" indicates the length to play, in this case 1/8-note, or half a beat at the current tempo. Meanwhile, "f#" is the black key nearest the "e". "f#8" then is to play that black key at half a beat at the current tempo. In the PLAY statement "f#8" could be also written "f+8" although it looks confusing.

Must use sharps only for the black keys of the piano. Must use minus sign for "flat" notation, the symbol that comes from sheet music cannot be used because it looks very much like lowercase "B" and therefore it would be confused with "b" note.

The Wiki page about PLAY should really say something about note lengths directly attached to notes.


RE: Numbers at end of Play strings - TerryRitchie - 06-23-2023

Yep, mnrvovrfc explained what appears to be hanging values.

# is used to sharp a note (slightly above the standard) and - is used to flat a note (slightly below the standard).

So "c#8" means C sharp played at eighth note length.


----F------------------------
   # / -
E
   # / -
----D------------------------
   # / -
C
   # / -
----B------------------------
   # / -
A
   # / -
----G------------------------
   # / -
F
   # / -
----E------------------------

You may have learned in music class that the lines of a staff using treble clef , EGBDF, stands for "Every Good Boy Does Fine"
and in between the lines is FACE - spelling "face". These all equate to a piano's white keys. Black keys on the piano are slightly above or below the standard notes (depending on which key the music is written in). On a violin (the instrument I'm classically trained on) the 2 high strings equate to A and E on the treble clef staff.

When I was a kid the PLAY command was included in all versions of BASIC on the TRS-80 lines of computers. I could type my sheet music in and then play along during my violin practice sessions. The PLAY command was awesome because I could easily change the tempo as I progressed. My mother (also a violinist) would play the 2nd violin part. The Pachelbel Canon was one of our favorites -> https://www.youtube.com/watch?v=NlprozGcs80


RE: Numbers at end of Play strings - Jack - 06-23-2023

I love classical music Heart


RE: Numbers at end of Play strings - SMcNeill - 06-23-2023

To keep it simple:  # is SHARP, - is FLAT

So:

f# is a f sharp note.
f- is a f flat note.
f is just a plain f note.

The wiki has this well documented under https://qb64phoenix.com/qb64wiki/index.php/PLAY 

So what you're seeing at the end of those lines are calls to play a f sharp (or similar) note, for the length of the value after.  Smile


RE: Numbers at end of Play strings - PhilOfPerth - 06-23-2023

Thank you.
I think the only piece of all that that I was missing (I am also musically trained) is that a number can be appended to a note to change its length, instead of prepending it with "Ln", and I don't think this is documented in Wiki. It shortens the string by one character, so maybe it should be the preferred way of notation?

Edit: One difference I've just realized, is that the appended version can be used to change the length of single notes, while the Ln will "stick" until changed by another Ln.


RE: Numbers at end of Play strings - TerryRitchie - 06-24-2023

(06-23-2023, 11:25 PM)PhilOfPerth Wrote: Thank you.
(I am also musically trained)
Sorry for the long winded response. Smile


RE: Numbers at end of Play strings - PhilOfPerth - 06-24-2023

(06-24-2023, 02:42 AM)TerryRitchie Wrote:
(06-23-2023, 11:25 PM)PhilOfPerth Wrote: Thank you.
(I am also musically trained)
Sorry for the long winded response. Smile

No probs: I just wanted to save anyone from going through a whole music course unnecessarily. 
(It's usually better to assume someone doesn't have the background knowledge than go way over their heads)!

Did you notice the Edit in my post? This may be something you'd like to cover in your Tut, as it seems to be an
undocumented feature: L8A is not the same as A8, but it can appear to be (L8 will carry on into the next Play, while A8
only holds for the one note.