Discuss Scratch

Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

I'd like to be able to start sounds from a specific point, so I suggest the following blocks:
play sound [ v] from (x) secs :: sound // Plays the sound from that position

play sound [ v] from (x) secs until done :: sound // Likewise, except it waits until it's finished.

play sound [ v] from (x) secs until (y) secs :: sound // Similar, but only plays up to Y seconds.

(length of sound [ v]::sound) // Reports the length of the sound in seconds. It gives something like "213.40", you can use round if you don't want that.

Where would this be useful?
  • MP3 Players - You can skip forward and backward in sounds.
  • Radios - When the user tunes in, it skips to what everyone else is hearing (based on time or Cloud Data, your choice), creating a synchronized sound, like a real radio.
  • Time Travel Games - Imagine someone made a game similar to Braid. They could back up the music when the player reverses time.
  • MAPs - This could benefit maps greatly by avoiding sound cutting, as shown below:
broadcast [Part 1 v]
play sound [Song v] from (0) secs until (33) secs :: sound
broadcast [Part 2 v]
play sound [Song v] from (33) secs until (68) secs :: sound
...
The same MAP script can be applied to other things, too.

What if the user puts in more than 60 seconds/negative seconds/non-integer seconds?
More than 60 simply seeks to wherever that is - 0m and 78s seeks to 1 minute and 18 seconds (78 seconds) in.
Negative seconds don't play the sound in reverse, they simply cause the sound to start from the beginning, like 0 or the normal play sound blocks.
Non-integer seconds simply seek with more precision, for example, 12.5 seconds.

Why no hour or minute value?
@DaSpudLord makes a good point. The base value for everything in Scratch is in seconds - the timer reports seconds, wait _ secs, etc.

What happened to the seeking blocks?
stickfiregames pointed out that sprites can play more than one sound at a time, meaning those blocks can cause glitches. However, you can use this workaround to seek:
stop all sounds
play sound from (seconds) secs until done :: sound

What about playing in reverse?
Just make a reversed copy of the sound and sync them up. Scratch has a “reverse” tool built into the sound editor, to reverse an entire sound, simply use “Select All” and then “Reverse”.

Last edited by Paddle2See (Sept. 30, 2023 15:45:04)

alexphan
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

This would be cool! There can be lots of uses for this. Support.
Also, give me a sound that's an hour long :P

Last edited by alexphan (Feb. 9, 2016 20:02:38)

Birdlegs
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Supported! Though I don't think Scratch would even do well at holding a sound that's an hour long. But if it were ever somehow necessary, I think the user could just overflow the minutes like you said. So yeah, I like this, as long as it's only minutes and seconds.
Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

JoeyTheChicken wrote:

Supported! Though I don't think Scratch would even do well at holding a sound that's an hour long. But if it were ever somehow necessary, I think the user could just overflow the minutes like you said. So yeah, I like this, as long as it's only minutes and seconds.
Good point! I'll edit that in.
Sheep_tester
Scratcher
500+ posts

Sound Seeking - 30 Supporters

Support for only #1 and it should only be
play sound [ v] starting at (0) sec :: sound
so it's easier to put in variables in that parameter. All the other blocks can be workarounded.

Last edited by Sheep_tester (Feb. 10, 2016 01:16:54)

little_kitten
Scratcher
500+ posts

Sound Seeking - 30 Supporters

alexphan wrote:

This would be cool! There can be lots of uses for this. Support.
Also, give me a sound that's an hour long :P
*records* you will hear lots of loud typing, friend.

AAAAANYWAY support!
Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Sheep_tester wrote:

Support for only #1 and it should only be
play sound [ v] starting at (0) sec :: sound
so it's easier to put in variables in that parameter. All the other blocks can be workarounded.
They can, but it can be a pain.

For #2, would you really want to have to keep using “wait ( ) secs” blocks for sound?

For #3, you can use:
stop all sounds
play sound [Whatever's Playing v] from (Minutes)m (Seconds)s :: sound
So depending on what other people say, I'll remove it.

#4 and #5 require a lot of math. I can't think of the code for them right now.

Also, minutes is there for convenience. You don't have to use it, this would work just as fine:
play sound [Sound v] from (0)m (Seconds)s :: sound
since more than 60 seconds wraps around.
TheAwesomeMaster
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Support. This would make it easier to make many things.
Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Bump.

Hey. If you see this, I needed a forum post for testing something. So… just kinda ignore this part, OK?

~UserBegin~Tymewalk~UserEnd~

~UserBegin~Tymewalk~UserEnd~

Last edited by Tymewalk (Feb. 24, 2016 14:58:18)

stickfiregames
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Support for all except the third, “current sound” doesn't mean anything since it could be playing more than one sound, and it is pretty much the same as the first/second one. Also I would just have seconds rather than minutes and seconds.

Last edited by stickfiregames (Feb. 23, 2016 23:30:41)

Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

stickfiregames wrote:

Support for all except the third, “current sound” doesn't mean anything since it could be playing more than one sound, and it is pretty much the same as the first/second one. Also I would just have seconds rather than minutes and seconds.
I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite.
stickfiregames
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Tymewalk wrote:

stickfiregames wrote:

Support for all except the third, “current sound” doesn't mean anything since it could be playing more than one sound, and it is pretty much the same as the first/second one. Also I would just have seconds rather than minutes and seconds.
I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite.
They can play more than one sound at once, I just checked.
Sheep_tester
Scratcher
500+ posts

Sound Seeking - 30 Supporters

Also support for a
(length of [sound v]::sound)
which returns the length in seconds.
DaSpudLord
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Support for
play sound [ v] at () secs::sound

play sound [ v] at () until done::sound

(position of [ v]::sound)//If the sound is not playing, reports 0 (or something like that).
The reason I removed the others is because they're quite easily workaroundable with these 3. The reason I removed the minutes is because the base measurement for time in Scratch is always seconds; the timer is in seconds, the wait _ secs block is in seconds, etc. Adding minutes would add unnecessary confusion. If you want minutes, the workaround is quite easy-
(((minutes::grey) * (60)) + (seconds::grey))
Tymewalk
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

stickfiregames wrote:

Tymewalk wrote:

stickfiregames wrote:

Support for all except the third, “current sound” doesn't mean anything since it could be playing more than one sound, and it is pretty much the same as the first/second one. Also I would just have seconds rather than minutes and seconds.
I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite.
They can play more than one sound at once, I just checked.
Did not know that. I'll remove the last 3.

Sheep_tester wrote:

Also support for a
(length of [sound v]::sound)
which returns the length in seconds.
I'll add it in now, thanks.

DaSpudLord wrote:

Support for
play sound [ v] at () secs::sound

play sound [ v] at () until done::sound

(position of [ v]::sound)//If the sound is not playing, reports 0 (or something like that).
The reason I removed the others is because they're quite easily workaroundable with these 3. The reason I removed the minutes is because the base measurement for time in Scratch is always seconds; the timer is in seconds, the wait _ secs block is in seconds, etc. Adding minutes would add unnecessary confusion. If you want minutes, the workaround is quite easy-
(((minutes::grey) * (60)) + (seconds::grey))
How about it reports -1 if it isn't playing, that way you can't get weird glitches if you get the position right when it starts?
I'll also remove minutes.
Zarlog
Scratcher
100+ posts

Sound Seeking - 30 Supporters

I support this. I am making a remix of “Scratchnapped”, and would like to be able to do this.
Skelepound
Scratcher
100+ posts

Sound Seeking - 30 Supporters

Support! When I saw your topic and title it was a bit confusing at first, but I got a good idea of what you meant. I definitely think being able to do this would be useful for animations! (Especially music videos)
Ninkancho
Scratcher
500+ posts

Sound Seeking - 30 Supporters

This would be great, but I suggest you change “s” to “secs” for consistency and clarity purposes. Support, anyway.
Sheep_tester
Scratcher
500+ posts

Sound Seeking - 30 Supporters

There should also be a block called
((1) mins (30) secs::operators)
which returns the time given in seconds so you can do
play sound [sound v] starting at ((2) mins (14.56) secs::operators)secs::sound
DaSpudLord
Scratcher
1000+ posts

Sound Seeking - 30 Supporters

Sheep_tester wrote:

There should also be a block called
((1) mins (30) secs::operators)
which returns the time given in seconds so you can do
play sound [sound v] starting at ((2) mins (14.56) secs::operators)secs::sound
No support.
(((minutes::grey) * (60)) + (seconds::grey))

Powered by DjangoBB