HTML5 Sound Distorted and Slow

Community Beginner ,
Feb 07, 2022 Feb 07, 2022

Copy link to clipboard

Copied

I'm sorry to keep asking, but Adobe Animate with HTML5 and Javascript is just acting so weird.

 

I'm simply trying to make a CLICK sound when a user clicks on a button.

 

I have a 1 second audio clip (or 1.018 seconds according to Audition).

 

The ONLY thing in this file is a this.stop(); and a simple button with the following code:

 

this.Key_1.addEventListener("click", fl_Down.bind(this));

function fl_Down()
{
createjs.Sound.play("ClickUp");
}

 

While it WORKS the sound is being stretched long and/or distorted into a completely different sound.

 

In the Library it sounds fine.

 

I've tried the sound as a WAV and MP3. 

I hope someone here can tell me what I'm doing wrong.

 

I'm still on Animate 21.0.9 at my office. I'll try it on the most recent version when I get home, but I don't think that's it.

 

Thank you again!

Views

84

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 , Feb 14, 2022 Feb 14, 2022
i thought you might be readding the listener (which occurs if the frame replays) and causing the distortion.  the code i suggested fixes that. you could open that sound in audition and then resave as a 16 bit sound and 44 khz sample rate (even if those are the current settings).  then reimport the sound. if that fails someone will probably need to download your fla to determine the cause and fix.

Likes

Translate

Translate
Adobe Community Professional ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

change this:

 

this.Key_1.addEventListener("click", fl_Down.bind(this));

 

to this:

 

if(!this.alreadyExecuted){

this.Key_1.addEventListener("click", fl_Down.bind(this));

this.alreadyExecuted = true;

}

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
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Okay, why does this need to happen? Why is it playing badly and what about this code fixes it?

I'm genuinely trying to understand why this is needed.

Thank you

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
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Sorry, no, that did not fix the audio issue. It still plays but sounds like it's playing in slow motion and stretched 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
Adobe Community Professional ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

i thought you might be readding the listener (which occurs if the frame replays) and causing the distortion.  the code i suggested fixes that.

 

you could open that sound in audition and then resave as a 16 bit sound and 44 khz sample rate (even if those are the current settings).  then reimport the sound.

 

if that fails someone will probably need to download your fla to determine the cause and fix.

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
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Dammit!

 

Even though Adobe Animate was SHOWING 44100 khz and 16  bit:

shawns45366351_0-1644856803756.png

 

The file was actually 24-bit when I opened it in Audition...

And yes that fixed it. Thank you!!!

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 ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

LATEST

that's great!

 

(p.s.  i've encountered the same issue and fix myself.)

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