This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-12-07 11:06:19

Nerd_Herd
Scratcher
Registered: 2012-10-12
Posts: 12

Music glitch fix

Sound block improvementWhen you do 1s1s, it's impossible to get a sound to play forever, like background music. I thought that there could be an 'if sound playing block', or something. This would let you sense if it's playing the music, then if it's not, play the music without that really annoying glitch.

when gf clicked
forever if <not <sound playing>>

Offline

 

#2 2012-12-07 21:32:02

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: Music glitch fix

1s1s projects are all about overcoming this kind of stuff. I'd use the timer, knowing exactly how long is the song, maybe even down to miliseconds (the online player has a timer this precise), constantly checking whether the timer has passed this length in the game loop.

It is a bit hard to do this if you can't know when the sound isn't playing, though. Closest thing to this is the "loudness" block, with the audio input set to "Stereo Mix".


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#3 2012-12-13 21:20:25

nitromian
Scratcher
Registered: 2012-09-02
Posts: 9

Re: Music glitch fix

Actually, I made a pretty good script for this:

when gf clicked
reset timer
play sound [background music v]
then, in the game play script:
if <(timer) > [length of song]>
reset timer
play sound [background music v]
end
I actually used this script in this game.http://scratch.mit.edu/projects/nitromian/2979324

Last edited by nitromian (2012-12-13 21:23:18)

Offline

 

Board footer