Audio Issue. Can't play wav file


Hi guys, I can’t play this wav file in my domain the first time it’s loaded:

I used Online converter ( do convert it from mp3 to wav 16bit/48kHz/mono (PCM S16 LE (s16l)).

I’ve an entity and If I enter into it I want play the wav audio:

this.enterEntity = function(entityID) {
   audioCiao = SoundCache.getSound('');
   Audio.playSound(audioCiao, { position: MyAvatar.position, volume: 0.8 });   

The first time I get into it, the progression bar appears and the log says:
[07/15 17:48:54] [DEBUG] Requesting sound at “
[07/15 17:48:54] [DEBUG] Starting request for:
[07/15 17:48:54] [DEBUG] AudioInjector::injectNextFrame() called with no samples to inject. Returning.

The SECOND time I get into it, it plays the wav audio :confused:


You must play if and only if the file is downloaded.

Run an if conditional on audioCiao.dowloaded?(playsound):(checklater)

Keep in mind that if you only check once… then it will not check again…

protip: setInterval is your friend.


I made, i noticved a few days ago i lazy solution. i made a 5 seconds delay before i start to play. I need to update that someday.

And yes, if you start play before it’s loaded. it’s not playing :frowning: Why does High Fidelity not have a that build in the code. SO users not need todo that check ?


hi @gorgo,

You have to preload the sound. audioCiao will not play if it is not completely loaded yet. Try using the preload function of your entity prototype/object to get the sound file from the soundCache.


var yourSoundFileURL = "";

var yourInjector = null;

var yourSound = SoundCache.getSound(yourSoundFileURL);

var yourSoundPlayFunction = function() {
    print('The sound should be playing here');
    yourInjector = Audio.playSound(yourSound, { position: MyAvatar.position, volume: 0.8 });

if (yourSound.downloaded) {
} else {

/// The following part goes in your unload, be sure that the lifetime of your entity is longer then your clip, otherwise unload will be called right after you play the sound-file:

if (yourInjector !== null && yourInjector.isPlaying()) {