While trying to document functions speed and unit I found that unit "s" behavior is not what I was expecting.
What I expected: setting unit "s" changes the meaning of speed in that it refers to seconds. So, d1 $ s "sax:5" # speed 2 # unit "s" would make the sample last for 1/2 =half second. Its pitch would be changed accordingly.
What it actually does: sample pitch changes exactly the same as with unit "c", but it always lasts for one second, unless you set begin and/or end. For example:
d1 $ s "sax:5" # speed 2.2 # unit "s" # end 0.5 # cps 0.4 # pan 0.8
d2 $ s "sax:5" # speed 2.2 # unit "r" # legato 1 # pan 0.2
If you listen to these two sounds at the same time, you can hear that the pitch is exactly the same for both, but the first one goes silent after half a second (independently of cps and speed).
What I want to know if this is the expected behavior, or it is a bug.
To memory though, I think how it should work is that speed 2 # unit "s" would actually slow down playback of the sample so that it would sound lower in pitch, and last two seconds.
Independently of the possible bug, it seems strange to me that while speed 2 # unit "c" makes the sample go faster than speed 1 # unit "c", this is not the case with speed 2 # unit "s", which will make the sample go slower than speed 1 # unit"s".