possible implementations to render a glissando.

• May 7, 2015 - 14:28

As an extension of my recent work on ornaments and articulations, I'm starting to work on the playback implementation of the glissando.
Screen Shot 2015-05-07 at 15.04.59.png

Please let me know your feedback if you like my suggestion, or if you have objections or concerns.

I can think of several different ways to implement this playback. Maybe there are more ways.

  1. a run of notes between the given notes respecting the key signature and any measure specific accidentals.
  2. just the white notes (as on a piano keyboard)
  3. just the black notes (as on a piano keyboard)
  4. the chromatic scale notes (as on a fretted guitar)
  5. a continuous frequency spectrum (as on an unfretted guitar, cello, or slide trombone)

BTW, can someone tell me whether musescore supports a concept such as #5?

Some might suggest that the default glissando style should be a based on which instrument it is. However, I don't know enough about all the possible instrument types to come up with reasonable defaults.

My suggestion is to have a new property on the glissando which specifies its playback style.

My idea would be to generate events for the appropriate intermediate notes, all of equal length except with the leading note being stretched a bit for emphasis.
Here are two possibilities, obeying key signature (in this case, just the white notes) and chromatic scale.

Screen Shot 2015-05-07 at 15.23.09.png

I look forward to your comments.


Comments

If 5. is possible, it should probably be the default setting for the straight glissando line, but not for the wiggly line.
Also bends could use that.

In reply to by [DELETED] 5

The Pitchbend controller is fine for bends, but for instruments capable of real glissandi such as voices, bowed strings, woodwind, synths etc the Portamento controller is the way forward.

It is a bit fiddly to set up, you use a combination of controllers #6, #65 and #84 to control it, but glissandi of 4 octaves are possible, so could be used for the playback of Ondes Martenot and Theremin parts, which currently require rendering outside MuseScore.

I have an initial implementation of glissando ready and pushed to the 1518-articulations branch.
I have implemented 4 styles of glissando playback.

Diatonic - plays notes of the scale between the designated notes, obeying accidentals
Chromatic - plays chromatic scale between the notes
White keys - plays notes corresponding to the white keys on the piano
Black keys - plays notes corresponding to the black keys on the piano

I'm attaching a couple of files (a midi and a pdf). Play back the midi to hear what the score sounds like.

Attachment Size
testGlissando.mid 1.51 KB
testGlissando.pdf 81.79 KB

In reply to by jim.newton.562

They sound good to me!

You know what I'm going to suggest now, don't you?
That's right, a "Play?" checkbox!

I was slightly confused for a moment by your definition of "diatonic". What you mean is "only the notes of the current key signature" (i.e. C major in your original example), but I thought you meant "notes from the scale of the starting note" (i.e. E major in your original example). Perhaps this could be another option? What do you think?

In reply to by jim.newton.562

It all looks good, and the "Play" checkbox works as expected. I have no problem with calling it "Diatonic" (in fact I'd even consider making this the default setting), but when it comes to writing the Handbook it should say "Diatonic - plays all intermediate notes from the key signature, obeying any accidentals" rather than what you put before, which I found confusing.

I did suggest before that you add an option to play the major scale starting on the first note, but I've changed my mind. It would be better to do this manually by changing key signature or adding accidentals to allow someone playing the printed score to visually distinguish between the two cases.

The only way I can think to improve it would be to set a different default glissando style for each instrument, perhaps stored in "instruments.xml". Keyboard instruments would default to "White keys" while other instruments would default to "Diatonic" or "Chromatic" as appropriate. However, your current implementation is more than adequate for the time being. (But perhaps "Diatonic" would be a safer default since it is likely to be more pleasing to the ear than "Chromatic" in many cases.)

In reply to by jim.newton.562

Thanks for working on this, it sounds good.

I've got another suggestion: It would be great to support harp glissandos.
I didn't find a way to use your current code to playback something like this (La Valse by Ravel):
NOT FOUND: 01
I thought it might be possible to put in the "changed notes" in voice 2, make them small and set playback to false, but accidentals set for a different voice are not considered in your version.
NOT FOUND: 02
(I know I only set the notes for one octave, but it doesn't work anyway. One could consider using even another voice to set the correct accidentals for notes in all needed octaves and hide them to have correct playback and still printable output.)

Attachment Size
RavelHarp.png 16.04 KB
HarpGliss1.png 11.31 KB

In reply to by heuchi

hi Heuchi, I was wondering the same thing. If a low C is sharpened previously in the measure, and the glissando touches a higher C, should it be sharpened as well? In musescore notation it would not. In my opinion that is a bug in musescore, but I can understand that some people might consider it a feature, so that's the rule I held with. Accidentals earlier in a measure only effect exactly that line/space of that staff, not other octaves, and not other staffs.

You can already sort of do what you're wanting.
Screen Shot 2015-05-11 at 10.07.32.png
Just enter the glissando, then afterwards add the other accidentals you want to the chord,
but for each of those notes, mark it as play=false and visible=false. The glissando will then play obeying those accidentals, for explicitly the lines/spaces specified, unfortunately not for other octaves of the notes. E.g., in the image, the B is marked as natural. The glissando will descend as: Ab G F E D C B Ab G F Eb D.

A question for someone with more expertise? If I sharpen a low C in a particular staff, can I tell musescore to interpret all C's in that staff as being sharp for the rest of the measure?

Attachment Size
Screen Shot 2015-05-11 at 10.07.32.png 10.1 KB

In reply to by jim.newton.562

Just in case there is any doubt: no it is not a bug that accidentals in one octave apply to that octave only. Same octave, same staff only. That is the normal rule in music notation, even if some ancient / historical editions did it differently. The only possible ambiguity today is with multiple voices, where some people might exepct them to carry between voices (music written for one musician) but others might expect the opposite (music written for two musicians sharing one staff). So the usual recommendation is to assume accidentals carry between voices but use explicit cautionary accidentals where there is possible for confusion (eg, the second case I mentioned).

As for things like harp glissando with specific accidentals, the way to handle arbitrarily complex cases like that is with invisible notes in another voice/staff - or, perhaps eventually, with the Piano Roll. I don't think automatic glissando playback needed deal with every possible gliss that someone might want to play.

In reply to by Marc Sabatella

I don't really understand what makes a harp glissando 'arbitrarily complex', but anyway: If we let aside the harp, then there seem to be only three needed styles left: chromatic, white keys and black keys. Dropping the 'diatonic' type would keep things simple, every non-harp real-life glissando will be covered by these three types and we don't get confusion about what 'diatonic' might mean.

In reply to by Jojo-Schmitz

I don't think it's confusing, either. However, it has caused confusion here.
What instruments are you referring to? And what is "the correct key"?
Would you want to change the key signature for a glissando to playback correctly on a secondary dominant chord? What about minor keys?
I don't think automatic (key signature based) playback of that kind of glissando is very useful. It's almost the same as saying a trill should always use the upper neighbor according to the current key signature.
The key signature is not actually defining the music, it's merely a helper to make things easier to read.

In reply to by heuchi

A diatonic harmonica is tuned to a diatonic scale (as the name implies), but you only get the scla eby alternating blowing and drawing breath. So a simple "glissando" where all you do is blow air while sliding the harmonica sideways will indeed produce a chord. A true diatonic glissando seems like it would be next to impossible to perform on diatonic harmonica, unless you have just astounding breath control .

In reply to by heuchi

No, diatonic isn't confusing. It has a specific definition: "only notes in the key signature".

It was just jim's way of saying it that was confusing and made it sound like it could mean something else. If it is included without explanation the user will use Google to look it up and will find the correct definition (as I did).

In reply to by heuchi

What I mean when I say a harp glissando could be arbitrarily complex is that you can't just have a "harp" radio button to add along with "diatonic", "chromatic", "portamento". A harp playng a gliss from C to could conceivably be playing C-D-E-F-G-A-B-C, or C-D-Eb-F-G-Ab-Bb-C, or C-Db-E-F#-G-Ab-Bb-C, or any of dozens of other possibilities depending on its pedal settings. If you want to do it right, you would need seven separate drop down lists corresponding to the pedal settings (each of the seven pitches has three different pedal settings), or something like that. So what I am saying is, we really don't need to be in the business of providing automatic playback support for those dozens of different possibilities.

Anyhow, I agree there is nothing confusing about "diatonic" most of the time. It has a very specific meaning: staying within the key - that seems perfectly clear in the context of glissandi - assuming the start and ends notes are themselves diatonic. If they have accidentals, then it's not at all clear what "diatonic" might mean for the rest of the glissando. Realistically, it would depending on the harmonic context of the passage - an analysis of the function of the chord, etc. Which again becomes aribtrarily compelx to try to model. As some point, one has to accept you can't automate every possibility, and that invisible notes will be needed if for some reaosn you care about exact performance. Again, the Piano Roll editor could be part of the solution to that problem.

In reply to by Marc Sabatella

I still don't get the 'arbitrary' part of it. Since the harp player needs to know which pedal setting they are supposed to use, the information needs to be present somewhere in the score anyway, thus not being 'arbitrary' at all.
The idea was to find a way to add this information either in a human-readable way, that also the automatic playback would be able to understand, or, at least, to find a simpler approach than using seven separate drop down menus. Unfortunately it turns out it's not easy to find a solution to that problem.

In reply to by heuchi

OK, it's not "arbitrarily" complex. There are exactly 3*3*3*3*3*3*3 = 2187 combinations of pedal settings. So, sure, a finite number. Still, the point is, coming up with a UI to allow the user to specify the specific combinations is, I think, way beyond what an arepggio playback facility needs to accmplish. And besides, that's just harp. What about someone deciding they want to an arpeggio for piano to be played as C Db Eb E F Gb Ab Bb C, which doesn't correspond to any of those 2187 harp pedal combinations, nor is it diatonic, nor is it chromatic. Do we need a UI to allow the user to specify that as well?

Don't get me wrong, I *would* like to see harp pedalling facilities added to MuseScore - but I'[m much more interested in the *notation* than the playback. If someone were to create a new Harp Pedal Diagram element with corresponding editing controls that would then render appropriately (along the lines of the Fretboard Diagram facility, for example), that would be great, and indeed, potentially that information could be used by an arpeggio playback facility. But right now, we don't encode any such information, and I would not be in favor of build such complexity into the arpeggio playback facility itself. If we're going to deal with harp pedalling, let's deal with it for real, not just for apreggio playback. And come up with a UI that is optimized for the notation aspect of it.

In reply to by Marc Sabatella

I would agree tend to agree with this, even though I am a big fan of playback. All that is absolutely necessary is to give the listener an impression of a glissando, and the implementation jim has made already do this extremely well. A composer is now able to play the score and think "right, there will be a glissando there" even if it doesn't sound quite how they wanted.

There is some room for per-instrument customisation. Clearly the "white keys" and "black keys" presets only really make sense on keyboard instruments, but on those instruments they probably cover 99% of all real use cases. If somebody could create a single "Harp" algorithm that correctly interpreted ~60% of use cases on the harp then it might be worth considering. Otherwise it's probably not worth it, or at least best left to a plugin.

In reply to by shoogle

I'm not quite ready to throw in the towel on the Diatonic style. I think I could give first priority to the other notes at the same tick. These will either be part of the same chord, or other chord at the same tick. If a derived note of the glissando is on the same line as an explicit note (even if invisible silent) then render the derived note with the same accidental, else use the findAccidental function which checks the key signature and the ticks to the left in that staff/measure.

I think this will give an intuitive effect, and will probably work for the harp as well.
Let's see.

In reply to by heuchi

It has to do with the construction of the harp. Originally it was a diatonic instrument which limited its usefulness. So seven pedals were added that raised every string of the same note (i.e. all a's or c's) by a half note. Now the instrument was chromatic. To add flexibility the pedals were modified to allow two half steps up for every pedal (double pedal harp). With these pedals you can now set two neighboring strings to the same pitch and produce all sorts of glissando effects (have the harp sound just the notes of one chord--which is not called glissando on any other instrument). Arbitrarily complex.

In reply to by Marc Sabatella

Hi Marc, thanks for your explanation.
I have hit an assertion in the code which is confusing.
If I call findAccidental(segment,staffIdx,-1)
then the assertion line >= 0.

AccidentalVal AccidentalState::accidentalVal(int line) const
{
Q_ASSERT(line >= 0 && line < 75);
return AccidentalVal((state[line] & 0x0f) - 2);
}

This is confusing because the G above a treble clef staff has line=-1, right?
Does the accidentalVal concept simply not work for notes above the staff on ledger lines?

Am I confused?

In reply to by heuchi

Hi heuchi, I didn't realize that accidentals from a different voice are not considered in the accidental calculation. I notice that in note entry mode in the score editor GUI, that when entering the notes for the voice #2, it DOES recognize the accidentals from voice #1.

I'll look into it and see if I can similarly make a glissando on one voice also obey the accidentals of other voices. I'll update you on what I find out.

In reply to by jim.newton.562

Hi heuchi, I did a bit of investigation and discovered what I think is the confusing issue.
Screen Shot 2015-05-11 at 12.12.04.png
If the accidental appears at the same time (same tick) as the starting note of the glissando, then the accidental is not considered for the glissando. But, if the accidental appears to the left, it is considered. This is because the musescore api findAccidental() which I'm using, looks to the left, not considering the current note.

Look at the image above. The glissando in measure 2 will consider the Bb, but measures 1 and 3 will consider the B natural. The same effect happens if the Bb is in voice#1 or voice#2.

Here is what I propose, rather than looking to the left from the note STARTING the glissando, instead, I should look to the left from the note ENDING the glissando.

This will have a surprising effect in one strange case.
Screen Shot 2015-05-11 at 12.27.47.png
The glissando can attach two notes of different staffs. In this example, according to my proposal, only the accidentals of the lower staff will be considered.

In reply to by jim.newton.562

Hi heuchi,

I've fixed the glissando playback to work as described above.
Now, the accidentals are calculated by looking to the left of the glissando end-note, rather than the beginning note.
In the case that the end note is in a different staff, then the accidentals from that staff are considered, and not the accidentals from the staff of the starting note.

The effect is that if the start and end notes are in the same staff (which is the normal case I think), then you can add invisible, non-playable notes to the chord to set any desired accidentals which depart from the key signature. However, in the rare case that the end note is in a different staff, then you'll have to add an invisible, non-playable chord in that staff to specify exceptional accidentals.

BTW many thanks for the feedback. It is very valuable to me.

In reply to by jim.newton.562

C++03 paragraph 5.6 clause 4:
"The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second operand of / or % is zero the behavior is undefined; otherwise (a/b)*b + a%b is equal to a. If both operands are nonnegative then the remainder is nonnegative; if not, the sign of the remainder is implementation-defined."

In reply to by heuchi

Hi heuchi,

I've just uploaded a commit on the 1518-articulations branch which gets us closer to what you want, I hope. Try it out.
If you select style=Diatonic, and put another chord in the same staff at the same tick (or simply extend the chord which starts the glissando), then the notes in that chord will override any accidentals in the glissando, even in different octaves. E.g., if you put an F# in the chord (and perhaps turn off visibility and play on that note), then all F's in the glissando will be played as F#.

I'm interested to hear your feedback.

In reply to by jim.newton.562

Hi Jim,

one word: GREAT!
This is what the Ravel looks like: (I unchecked show hidden elements to get a print-like screen shot)
NOT FOUND: 01

It's pretty close to the printed example and playback is 100% correct.

I attach the score, so you can see how I did it. Yes, it's still quite a bit of work to get it done, but maybe later we can develop helpers (plugins) to make things easier. At least your additions make MuseScore capable of doing this!
(The most important thing to improve would be:
when adding a glissando, the target note seems to be chosen somewhat arbitrarily,
and to be able to shorten the line would be great, but that's a different topic...)

Thanks a lot for not giving up. ;-)

Attachment Size
HarpGlissando.png 7.32 KB
HarpGlissando.mscz 6.95 KB
HarpGlissando.mid 384 bytes

In reply to by heuchi

Some more information on the file HarpGlissando.mscz from my previous posting:

First notice, that all the notes and both glissando lines you see in the first measure of the screen shot in the previous posting are set to not playback.

Playback is done with hidden elements, that I have made visible here:
NOT FOUND: 01

The upper notes of the chords are set to not playback. In the whole first measure, the only objects set to playback are the bottom notes (A) of the two chords and the two glissando markings (set to Diatonic style).

This is really a very complicated example, but I wanted to show the full potential of this way to control playback.
Just making the upper notes of the chord invisible and adding a staff text saying "C#,Db,Fb" would also create a valid notation of the glissando. Eventually a plugin could be created to add these staff texts.
NOT FOUND: 02

Attachment Size
HarpGlissPlayback.png 6.65 KB
HarpGlissSimple.png 5.61 KB

In reply to by heuchi

Great to hear that it works for you.
I have some suggestions though.
You don't need to push the notes up that high. You can put the notes on any octave, so just bring them down an octave.
You can also put them in voice number 2, and turn off the stem.
But otherwise I'm happy to hear that it works for you.

In reply to by jim.newton.562

I put the notes into the higher octave, to make sure their accidentals would not interfere with those of the visible 32nd notes (otherwise I would have had to manually repeat the accidentals for the visible notes) and later just copied the chord to the bass staff.
Using a different voice is a good idea anyway, because it removes the need to adjust the stem height manually if you want the starting note of the glissando to be visible.
In my original example (which needs three voices that way) none of those notes would be visible anyway, so I didn't care about stem length and direction...

But I really like the way this can be done now.
So once again: Great Work. Thanks a lot.

In reply to by jim.newton.562

This is really awesome stuff and thank you!

Curiosity question: I do a lot of jazz/swing arranging, and use glissandos on trombone parts a lot. Would one consider this to be the one wind instrument with the more "analog/continuous" progression due to the nature of the horn?

This looks very promising! Nice work!

I may be jumping the gun a bit, but will this work for chord glissandi (i.e. sliding from one chord to another)? I suppose a workaround for the meantime would be to put each note of the chord in a different voice, but it's something to keep in mind.

Also, would there be a way to specify the ending note such that it has no time value? p. 144 of Behind Bars recommends using a grace note or small stemless note for this. In the past I've ended up using a different voice to create this note, since I believe glissandi to grace notes is not currently possible.

"I still don't get the 'arbitrary' part of it."

heuchi, I think the confusion is that Marc is using the word "arbitrary" as a mathematician does -- it just means that the complexity is unrestricted or unbounded in general. If you choose any (high) complexity level, there is some piece of music that has a glissando of that level. It does not mean that there is any arbitrariness or option that the musician has when performing the glissando in one particular piece.

Speaking of complexity, I find that when people reply to comments, rather than the original post, you get lots of sub-threads. Then I can't find the latest contributions. So when I occasionally post, I post at the bottom. Sorry if that upsets anyone. But the loss of logic seems minimal compared to the gain in simplicity...

Now that the code is merged, I've had a chance to try it out. Very nice!

One suggestion: an option for glissandi to not be a constant rate, but instead, to hold the first note for, say, 3/4 of its nominal duration, then cram the glissando into the last 1/4. This is going to more appropriate in at least some of the contexts in which a glissando is used. For lack of a better example, think (for people in US, anyhow) "Mister Griiiiii - inch" where "Griiiiii" is held the better part of the two beats, then there is a quick "rip" up to the "inch". One could get this effect by actually writing a dotted quarter tied to an eighth, but that's not really commonly done in my experience.

Hey Jim,

I hadn't checked the discussion of trills and turns in a while due to some concerts I had to prepare. So when I read the last comments I found out this new discussion of yours. I read it and noticed that you totally forgot about the portamento. I think the first answer in this forum: http://music.stackexchange.com/questions/27056/what-is-the-difference-b… eplains in detail the difference between Glissando and Portamento. Just so you know, if you don't already, Portamenti are played only by slide trombones, human voices and string instruments [mostly plucked (e.g. guitar, bass, harp etc.)]. So it would be nice if you could also implement playback on it. I know, there is no portamento in any pallete of MuseScore, but in the Arpeggio and Glissandi pallete, the straigth line next to the glissando (which also has the text "gliss") is actually the portamento. So the text should be changed to "port" like in the first picture below. Also don't forget about the Falls, Doits, Plops, Scoops and Slides. I include their playbacks in the attached file, except the last ones. As you'll see Falls, Doits, Plops and Scoops are all a kind of Glissando [that's why there are also notated with a glissando-kind-of line (wavy line, see in the second picture below), so it would be good if you had an option in the Inspector, so that users could choose between "straight" or "wavy" line], but not between 2 different notes. The same happens with slides, but these are associated with Portamento. More information can be found in the attached file. I'd appreciate playback implentation on as many notation features as possible.

Thanks in advance!
Regards,
KosrisP7

Attachment Size
Portamento.png 8.33 KB
Fall, Doit, Plop, Scoop.png 133.63 KB
Glissandi and Portamenti.mscz 17.36 KB

Do you still have an unanswered question? Please log in first to post your question.