Avatar of ForLoop5
ForLoop5Flag for United States of America

asked on 

gapless sync and playback audio as3

I have 37 sounds that are all the same bpm.  I would like them to sync with each other when their button is clicked to be played.  
Currently I sync the sounds to a background sound using the sound_complete listener. It works but
the sound become slightly out of sync becuse I am relying on the flash sound_complete event listener.   If I just loop them play(0,9999); they loop great but I cannot sync them with each other.   Any solutions to this?

var sndSync:Sound = new b3();
var chnSync:SoundChannel=sndSync.play();
var myVolume003:Number=0; 
    var myTransform003:SoundTransform=new SoundTransform(myVolume003); 
        chnSync.soundTransform=myTransform003; 
		
chnSync.addEventListener(Event.SOUND_COMPLETE, loopSoundf);
function loopSoundf(e:Event):void{
	   
		chnSync = sndSync.play();
		chnSync.addEventListener(Event.SOUND_COMPLETE, loopSoundf);
		chnSync.soundTransform=myTransform003; 
		  
	}
	
	syncer.addEventListener(MouseEvent.MOUSE_DOWN,soundonlySync);
	stopper.addEventListener(MouseEvent.MOUSE_DOWN,soundonlySync);
function soundonlySync(event:MouseEvent){
		chnSync.stop();
		chnSync = sndSync.play();
		chnSync.soundTransform=myTransform003; 
		chnSync.addEventListener(Event.SOUND_COMPLETE, loopSoundf);
	}

Open in new window

Adobe Flash

Avatar of undefined
Last Comment
tailoreddigital
ASKER CERTIFIED SOLUTION
Avatar of tailoreddigital
tailoreddigital
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Adobe Flash
Adobe Flash

Adobe Flash (formerly Macromedia Flash) is a cross-platform multimedia and software platform used to embed animations, video, and interactive applications into web pages and desktop and mobile applications and games. Flash displays text, vector and raster graphics to provide animations, video games and applications. It allows streaming of audio and video, and can capture mouse, keyboard, microphone and camera input. The ActionScript programming language allows creation of interactive animations, video games, web applications, desktop applications and mobile applications.

29K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo