Discuss Scratch

ten_6044
Scratcher
100+ posts

Is the music extension restricted to 100 beats per note?

Music blocks don't seem to play notes over 100 blocks long. Is it intended? If it is, why?

To test, go to this project: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1131687828/ This uses extension blocks, which is music. It uses the rest blocks. Try <100, it'll say correct. But if 100+, it'll say 100.

Intended? Why?
ten_6044
Scratcher
100+ posts

Is the music extension restricted to 100 beats per note?

撞 (zhuàng) - Chinese for Bump

It's in page 3 now
ten_6044
Scratcher
100+ posts

Is the music extension restricted to 100 beats per note?

Bump, I need an answer.

For some reason, my post count iis now 50
awesome-llama
Scratcher
1000+ posts

Is the music extension restricted to 100 beats per note?

Scratch's source code is on GitHub. I looked at the music extension and yes, it's limited to 100 beats.

https://github.com/scratchfoundation/scratch-vm/blob/develop/src/extensions/scratch3_music/index.js#L704

/**
 * The minimum and maximum beat values, for clamping the duration of play note, play drum and rest.
 * 100 beats at the default tempo of 60bpm is 100 seconds.
 * @type {{min: number, max: number}}
 */
static get BEAT_RANGE () {
    return {min: 0, max: 100};
}



Additional links if you are curious:

Last edited by awesome-llama (Feb. 12, 2025 07:25:01)

ten_6044
Scratcher
100+ posts

Is the music extension restricted to 100 beats per note?

awesome-llama wrote:

(#4)
Scratch's source code is on GitHub. I looked at the music extension and yes, it's limited to 100 beats.

https://github.com/scratchfoundation/scratch-vm/blob/develop/src/extensions/scratch3_music/index.js#L704

/**
 * The minimum and maximum beat values, for clamping the duration of play note, play drum and rest.
 * 100 beats at the default tempo of 60bpm is 100 seconds.
 * @type {{min: number, max: number}}
 */
static get BEAT_RANGE () {
    return {min: 0, max: 100};
}



Additional links if you are curious:
I have a question. Why do they do this?
awesome-llama
Scratcher
1000+ posts

Is the music extension restricted to 100 beats per note?

ten_6044 wrote:

I have a question. Why do they do this?
I assume it's to prevent someone accidentally setting it too high and getting confused why it does something unexpected. The limit at least allows the block to do something. There is also the possible issue of some values not being able to be handled by Scratch (think crashes or similar).

Scratch has a lot of seemingly arbitrary limits.

There is a mention of this limit here:
https://github.com/scratchfoundation/scratch-vm/pull/507

Last edited by awesome-llama (Yesterday 03:01:15)

Powered by DjangoBB