This is not about an issue with the TuneScope library, I just want to understand why something happens.
I have been experimenting with TuneScope. One thing I wanted to find out is how many notes (on different instruments) can be started at more or less the same time. One thing I tried was use primitive functions (coded in JavaScript, I suppose). I tried the one from:
It’s returning a string not a number. Id OF returns a number because the input slot is a number. But the identity one returns a string because the input is “any”
Still not sure if this is correct
Those aren’t accurate because snap doesn’t have numbers as their own data type. The primitive blocks use js and that does
So when the blocked are called inside of js it might cause some weirdness with what’s a string and what’s a number
And the reason you're getting an error is because it's expecting a number in the second input. This is type sensitive, which means you have to get a number, e.g. from a number input, in order to get it to work. If you put the number in the primitive block itself, then it will become a string.
Again, this is not an issue if you just use the library block that this primitive function is meant for.
I wanted to speed up the function for my experimentation, as the TuneScope library's does time-consuming stuff I didn't need. Indeed it appears Snap!'s types may be somewhat different from JavaScripts; that's probably what caused the "strange" phenomena I noticed. I solved it for now by using a calculation:
This function will play any playlist consisting of records with the following specs:
Actually, it's still very fast, and takes no time, so speed is not a reason to use the primitive blocks. It especially doesn't matter if you're putting in a wait block, which just tells me you don't actually need speed.
[tangent]
Why do you guys think the primitive block is faster than custom blocks? If you time it, it is only a couple milliseconds faster, which in this case, is not needed. Plus, you can turn on turbo mode and / or warp the script to make it run faster. Given the issue here, sometimes the primitive functions expect one value type, such as a number, which raises a lot of confusion, as strings and numbers are treated the same in snap. The primitive blocks are not meant for random snappers to put in their scripts, they're meant for library blocks only. So please stop using primitive blocks in your scripts just for the sake of speed, it really doesn't go much faster than the library blocks.
[/tangent]
The speed is for synchronization: making sure notes supposed to begin at the same time are actually started with the smallest possible timing difference. The waiting is for the next note to be started at a later time.