• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Why does sound preclude downloading from a server?

Community Beginner ,
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

216

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 Expert ,
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.

Votes

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 ,
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.

Votes

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 Expert ,
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.)

Votes

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 ,
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.

 

 

Votes

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

Copy link to clipboard

Copied

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

 

 

Votes

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 ,
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.

Votes

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

Copy link to clipboard

Copied

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

Votes

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 ,
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.

 

Votes

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 ,
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.

Votes

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