bugGnash - The GNU Flash player - Bugs: bug #24481, Gap in sound loop


bug #24481: Gap in sound loop

Submitter:  Benjamin Wolsey <bwy>
Submitted:  Wed 08 Oct 2008 06:40:54 AM UTC
Category:  sound Severity:  4 - Important
Release:  None Status:  None
Privacy:  Public Assigned to:  strk
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Wed 15 Jan 2014 01:17:42 AM UTC, comment #14: 

In addition to the gap in the audio, the sound continues to play even after clicking "clear" or unselecting the instrument. I'm using Gnash 0.8.10.

Jeremiah Wilson <jeremiahpwilson>
Mon 16 May 2011 12:26:58 PM UTC, comment #13: 

See also bug #33323 which sounds related

Sandro Santilli <strk>
Group Member
Wed 08 Jul 2009 08:37:25 AM UTC, comment #12: 

The playhead value just keeps going up and up now.

Benjamin Wolsey <bwy>
Group Member
Thu 09 Oct 2008 06:57:53 AM UTC, comment #11: 

Beside, the dox for sound_handler::play_sound are incorrect, they refer to streaming sound for both 'secondOffset' and 'start' parameter, while they are likely used for different purposes (one for streaming sounds, one for event sounds).
Also units don't convince me.

Sandro Santilli <strk>
Group Member
Thu 09 Oct 2008 06:55:12 AM UTC, comment #10: 

Doesn't look like we're really using the first parameter passed to Sound.start (offset).
It goes trough the sound_handler, gets set into active_sound::offset, but doesn't then seem to be used at all.

Sandro Santilli <strk>
Group Member
Wed 08 Oct 2008 09:09:07 PM UTC, comment #9: 

So if the sounds are getting out of sync with each other, and more importantly the playhead (silent wav), this should be because Gnash treats them as having a different length. There's no syncing mechanism at all besides the length of the tracks. The onSoundComplete() call relies on the partial track length from its starting position also being correct. I hope I've understood that right.

Benjamin Wolsey <bwy>
Group Member
Wed 08 Oct 2008 09:02:44 PM UTC, comment #8: 

From the author (Carlos Nazareno):

All of the sound samples are of exactly the same length, so that they
synch perfectly when they loop.

Next, I have a silent WAV file that's exactly the the same length as
all the other sound clips. This silent sound clip is what I use to
synch all of the other looping sound samples. This silent clip just
keeps playing looped, and then I just keep reading its Sound.position,
and this value is what I call the "playhead". The playhead value is
the position at which any of the other sound clips will start playing
when one of the trigger buttons in the SWF is pressed. All of the
other sounds are set to synchronize with silence_Master.wav, and thus
will all synch with each other when triggered.

Next, the triggered sounds:

I set them to start playing at the playhead's position in
milliseconds, and then when they finish playing, I trigger
onSoundComplete() and then have them just play from the beginning and
start looping 1000 times.

(file #16631)

Benjamin Wolsey <bwy>
Group Member
Wed 08 Oct 2008 08:26:12 PM UTC, comment #7: 

The position value doesn't correspond to the sound, that is.

Benjamin Wolsey <bwy>
Group Member
Wed 08 Oct 2008 08:25:37 PM UTC, comment #6: 

The duration is fixed, but not the other bugs. The gap is still there, and the playhead loop (position) doesn't correspond to the loop.

Benjamin Wolsey <bwy>
Group Member
Wed 08 Oct 2008 07:39:27 AM UTC, comment #5: 

oh I see now, there's no seek, the code only requests
to start the sound at offset 0 and loop 1000 times.
Carlos: is onSoundComplete expected to be called at the end
of all loops or only at the end of each iteration in it ?

Sandro Santilli <strk>
Group Member
Wed 08 Oct 2008 07:35:21 AM UTC, comment #4: 

duration bug fix committed as revision 9954.

Now for the loop.
Carlos: I see onSoundComplete being used, but I know gnash doesn't support it and still loops. So, is the onSoundCOmplete only used for seeking 1 second into the sound ?

Sandro Santilli <strk>
Group Member
Wed 08 Oct 2008 07:22:42 AM UTC, comment #3: 

silence_Master.wav is the symbol name for a DEFINESOUND:

Offset: 64 (0x0040)
Block type: 14 (SWF_DEFINESOUND)
Block length: 57625

 CharacterID: 1
 SoundFormat: MP3
 SoundRate: 22 KHz
 SoundSize: 16-bit
 SoundType: Stereo
 SoundSampleCount: 156800
  Mp3: SeekSamples 1670

Carlos, can you confirm it's an MP3, despite the name ?

Here's how gnash computes duration:
        unsigned int ret = sampleCount / sampleRate * 1000;
        ret += ((sampleCount % sampleRate) * 1000) / sampleRate;
        if (sounddata->soundinfo->isStereo()) ret = ret / 2;

If we don't divide by 2 when the sound is stereo we return the correct value.

Sandro Santilli <strk>
Group Member
Wed 08 Oct 2008 07:01:27 AM UTC, comment #2: 

Marking as important as we have the SWF author handy.
onSoundComplete isn't implemented yet, shouldn't be too hard
to do.

Sandro Santilli <strk>
Group Member
Wed 08 Oct 2008 06:44:56 AM UTC, comment #1: 

var silent = new Sound();


this.onEnterFrame = function (Void) {
  traceBox = ((silent.position+'/')+silent.duration)+'ms Playhead';

silent.duration is evidently wrong, and silent.position is out of sync with what's playing.

Benjamin Wolsey <bwy>
Group Member
Wed 08 Oct 2008 06:40:54 AM UTC, original submission:  


The playhead total with Gnash is 3555ms, with the pp 7111. The loop of the numbers bears no relation to the sound loop, unlike the pp.

When Gnash finishes the loop there is a short gap before it restarts, so that the rhythm is interrupted.

On the pp the end of the loop also takes very slightly too long (may be the design of the SWF), but it's not as noticeable as Gnash.

Benjamin Wolsey <bwy>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #16631:  bandTest.as added by bwy (10KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jeremiahpwilson (Posted a comment)
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by strk (SWF author)
  • -email is unavailable- added by bwy (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-10-08 bwy Attached File- Added bandTest.as, #16631
    2008-10-08 bwy StatusReady For Test None
    2008-10-08 strk StatusNone Ready For Test
        Assigned toNone strk
    2008-10-08 strk CategoryNone sound
        Severity3 - Normal 4 - Important
        Carbon-Copy- Added "carlos nazareno" <object404@gmail.com>

    Back to the top

    Powered by Savane 3.13-ee12.
    Corresponding source code