So this is a somewhat music philosophical thing. What is a tuplet? Essentially a tuplet is section which is rhythmically divided in a different manner than the general mode of the piece. And the Lilypond syntax can be read as exactly that: \tuplet 5/4
can be read as take 5 notes and put them into the space that would else be occupied by 4 notes. Except in Lilypond it is even more generic. In Lilypond \tuplet 5/4
is more or less a verbose way of \scaleDurations 4/5
. This means that in Lilypond we can have partial Tuplets such as this
{
\time 2/4
8 8 8 8
\tuplet 3/2 4 {
8 8 8 8 8 8
}
\time 2/6
\tuplet 3/2 4*2/3 {
8 8 8 8
8 8 8 8
}
\time 2/4
8 8 8 8
}
But most of the time we’d read a m/n tuplet as divide the space of n units into m units.
So what is the difference between a 5/4 tuplet and a 5/8 tuplet? Well the first one speeds up notes slightly, while the latter slows down significantly. So clearly if we have a quintuplet there needs to be a "conventional" reading (else it is also common to specify the tuplet ratio instead of just a number).
Take for example duplets, which are commonly found in 6/8. Traditionally such duplets would be notated like this:
{
\time 6/8
8 8 8 8 8 8
\tuplet 2/3 4. { 8 8 8 8 }
}
Now, there are some people who like to promote the convention that tuplets only speed up, so m/n with m > n. Then this would need to be notated as
{
\time 6/8
8 8 8 8 8 8
\tuplet 2/3 4. \scaleDurations 1/2 { 4 4 4 4 }
}
Which in my opinion looks totally weird (also is means things like 7-tuplets are really weird).
I suppose a more conservative convention would be to try to keep the ratio close (5/4 rather than 5/8), and in case there are multiple acceptable ways try to preserve the overall beat/subbeat structure. E.g. in 6/8 it makes sense to displace three 8ths by two 8ths, not to displace one dotted 4th by two undotted 4ths. But in 3/4 in totally makes sense to displace three 4ths by four 4ths rather than displacing three 4ths by four 8ths.
In fact if you use unconventional tuplets you can even do stuff like this:
<<
\new Staff { 4 8 8 4 16 16 16 16 4 }
\new Staff { 4 \tuplet 2/1 { 4 4 } 4 \tuplet 4/1 { 4 4 4 4 } 4 }
>>
So essentially: A tuplet does not change the beaming. The two cases you have are different tuplets, where one is canon (5/4) and one is a bit uncommon (5/8).