Discuss Scratch
- Tymewalk
-
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:
Where would this be useful?
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:
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”.
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]The same MAP script can be applied to other things, too.
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
...
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
-
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
Also, give me a sound that's an hour long :P
Last edited by alexphan (Feb. 9, 2016 20:02:38)
- Birdlegs
-
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
-
1000+ posts
Sound Seeking - 30 Supporters
Good point! I'll edit that in. 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.
- Sheep_tester
-
500+ posts
Sound Seeking - 30 Supporters
Support for only #1 and it should only be
play sound [ v] starting at (0) sec :: soundso 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
-
500+ posts
Sound Seeking - 30 Supporters
*records* you will hear lots of loud typing, friend. This would be cool! There can be lots of uses for this. Support.
Also, give me a sound that's an hour long :P
AAAAANYWAY support!
- Tymewalk
-
1000+ posts
Sound Seeking - 30 Supporters
They can, but it can be a pain. Support for only #1 and it should only beplay sound [ v] starting at (0) sec :: soundso it's easier to put in variables in that parameter. All the other blocks can be workarounded.
For #2, would you really want to have to keep using “wait ( ) secs” blocks for sound?
For #3, you can use:
stop all soundsSo depending on what other people say, I'll remove it.
play sound [Whatever's Playing v] from (Minutes)m (Seconds)s :: sound
#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 :: soundsince more than 60 seconds wraps around.
- TheAwesomeMaster
-
1000+ posts
Sound Seeking - 30 Supporters
Support. This would make it easier to make many things.
- Tymewalk
-
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~
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
-
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
-
1000+ posts
Sound Seeking - 30 Supporters
I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite. 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.
- stickfiregames
-
1000+ posts
Sound Seeking - 30 Supporters
They can play more than one sound at once, I just checked.I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite. 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.
- Sheep_tester
-
500+ posts
Sound Seeking - 30 Supporters
Also support for a
(length of [sound v]::sound)which returns the length in seconds.
- DaSpudLord
-
1000+ posts
Sound Seeking - 30 Supporters
Support for
play sound [ v] at () secs::soundThe 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-
play sound [ v] at () until done::sound
(position of [ v]::sound)//If the sound is not playing, reports 0 (or something like that).
(((minutes::grey) * (60)) + (seconds::grey))
- Tymewalk
-
1000+ posts
Sound Seeking - 30 Supporters
Did not know that. I'll remove the last 3.They can play more than one sound at once, I just checked.I would assume sprites can only play one sound at one time, and “current sound” would seek the one playing in that sprite. 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'll add it in now, thanks. Also support for a(length of [sound v]::sound)which returns the length in seconds.
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? Support forplay sound [ v] at () secs::soundThe 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-
play sound [ v] at () until done::sound
(position of [ v]::sound)//If the sound is not playing, reports 0 (or something like that).(((minutes::grey) * (60)) + (seconds::grey))
I'll also remove minutes.
- Zarlog
-
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
-
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
-
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
-
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
-
1000+ posts
Sound Seeking - 30 Supporters
No support. There should also be a block called((1) mins (30) secs::operators)which returns the time given in seconds so you can doplay sound [sound v] starting at ((2) mins (14.56) secs::operators)secs::sound
(((minutes::grey) * (60)) + (seconds::grey))