Why does sound preclude downloading from a server?

New Here ,
Jan 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

   I have developed a series of programs for use by my students. They use a range of platforms and browsers, so I put the programs on a server and they work perfectly except for those that have sound. If I erase the sound code below (or erase the sounds folder) they download, but if I include the sound code then all I get is a blank screen. Also, it works when I publish it on my computer.

   Here is the part of the code that seems to be providing the problem:

for (i = 0; 1 <= 60; i++)
{
if (i == 14){var audio1 = createjs.Sound.play("beep");}
if (i == 39){var audio2 = createjs.Sound.play("beep");}

}

   The above is part of additional lines of code that draws on the screen. The student clicks the mouse when they hear the sound (beep), which is located in the library as beep.wav (linkage = "beep"). 

Views

88

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 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

well, that (your code) is a problem:

 

to understand why, you need to know your for-loop executes from beginning to end before anything is shown on stage.  ie, for practical purposes all 61 loops occur at that same time.  

 

you can't possibly want that to happen.  so you need to change your code.

 

what it should be changed to, i don't know because i can't even figure out what you want to occur.

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
New Here ,
Jan 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

   I am drawing an electrocardiogram trace by drawing a series of short connected lines on a virtual screen. Each ECG 'cycle' takes 60 of these short lines.. When i = 14 and i = 39, I aim to play a sound which represents the heart sounds. The students click their mouse when they hear each sound to correlate the ECG with the heart sound.

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 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

you need to convert from line segments to time (in ms).  you can then use a Ticker loop to trigger the beep every x ms, 

EaselJS v1.0.0 API Documentation : Ticker (createjs.com).  

 

(but you should have two different sounds, for a normal heart.)

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
New Here ,
Jan 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

Following the suggestion I used a ticker loop to draw but I'm still having a problem with the sounds. I have tried a "sound test" movie clip with the following code in frames 4 and 10:

 

var audio = createjs.Sound.play("beep");

 

As before, it works great when I publish through HTML/Canvas, but when I try to access the html file on the server I get a blank screen.

 

 

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 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

your sound should be in that (or a) ticker loop, too.  is it?

 

 

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
New Here ,
Jan 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

I made a new file containing the (new) sound, a movieclip (with the above code), a button (to play the movieclip), and code. Works great on my desktop (Chrome and Microsoft Edge), but gives me nothing (a blank page) when I try to open the html file on the server. Other programs with no sounds work fine off the server.

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 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

what's the code (relevant to the problematic sound)?

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
New Here ,
Jan 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

The movie clip is 20 frames long and frame 7 and 15 have the following code:

audio2 = createjs.Sound.play("beep");

The variable audio2 is declared on the time line and a button initates the movie clip loop.

Frame 1 of the movie clip has this.stop() and frame 20 has this.gotoAndPlay(1), to loop the clip.

 

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
New Here ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

LATEST

It's the server! Another server played the sound!

Sorry to waste your time.

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