Sound effects html5 canvas

Explorer ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

I'm trying to learn the soundJS in order to add an effect on loading a frame. Struggling to get it to work.

Is there a particular method for html5 to add sound effects as in actionscript format?

I've tried the following without success:

createjs.Sound.on("fileload", this.loadHandler, this);
 createjs.Sound.registerSound("Blop.wav", "bloop");
 function loadHandler(event) {
     // This is fired for each sound that is registered.
     var instance = createjs.Sound.on("bloop");  
     instance.on("complete", this.handleComplete, this);
     instance.volume = 0.5;
 }

 

Views

190

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jan 26, 2021 Jan 26, 2021
in the actions panel at the frame where you want the sound to play: var sound1 = createjs.Sound.createInstance("bloop"); sound1.play(); or createjs.Sound.createInstance("bloop").play(); or  createjs.Sound.play("bloop");

Likes

Translate

Translate
Adobe Community Professional ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

what do you mean by "loading a frame"?

 

do you mean you want a sound to play when the playhead enters a particular frame?  or do you mean you are actually loading something from outside your project and you want a sound to play when loading is progressing or when loading is complete or something else?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

Sorry when it enters a particular frame.

 

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

is the sound an external file (eg, Blop.wav) that you want to load during run-time (more coding and forethought needed) or is the sound imported into your library (easier to code and implement)?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

It's in the library with a linkage "bloop".

Essentially I'd like the sound to play when particular boxes appear in the timeline, if possible.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

in the actions panel at the frame where you want the sound to play:

 

var sound1 = createjs.Sound.createInstance("bloop");

sound1.play();

 

or

 

createjs.Sound.createInstance("bloop").play();

 

or 

 

createjs.Sound.play("bloop");

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

Hello thanks for those.

 

I had tried the first one suggested before that didn't work.

Now tried the others and none work. 

I've added the script on frame 1 in an actions panel, I assume that's correct?

 

Thanks

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

if any of them failed, embed* a screenshot of showing your library (with the id "bloop" visible) and your actions panel showing the code that failed (and any other code in that frame).

 

 

*

kglad_0-1611759712829.png

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

Screenshot 2021-01-27 at 15.42.56.png

 

Thanks for your help on this

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

that looks ok.

 

select the wav file in the library and play the sound in the library window to make sure it's not corrupted.  or even better, import a different wav or mp3 and check that to see if it's a probem with your sound file.

 

if you confirm it's not a sound file issue, check if you have some unrelated error causing a problem by opening your browser's developer console and checking for an error.

 

if you seen none (other than the message port and css errors), upload your fla to to file server and post a link.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Yes the file was corrupt, tried another sound file that works, but not in Safari, tested it through Firefox and Chrome both working on there.

Does Safari require additional for this?

 

Thanks

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

open the safari developer console and see if there's an error.

 

if not, check if safari requires user interaction (eg, button click) to start sound.  (apple's a bit of a nanny about controling things.)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Yes it appears it requires a trigger, as the sounds worked after a mouse click event.

Is there any way around this on Safari?

 

Thanks

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

i doubt it but you should google it see if there's a (temporary) work-around (which will eventually fail when apple figures it out).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Ok thanks.

Will have a look.

 

Really appreciate all the assistance the forum gives, it's very welcoming to novices like me.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

LATEST

you're welcome.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines