Get an unlocked HTML5 Audio object from the pool. If none are left,
return a new Audio object and throw a warning.
@return {Audio} HTML5 Audio object.
348580
function() {
      var self = this || Howler;

      // Return the next object from the pool if one exists.
      if (self._html5AudioPool.length) {
        return self._html5AudioPool.pop();
      }

      //.Check if the audio is locked and throw a warning.
      var testPlay = new Audio().play();
      if (testPlay && typeof Promise !== 'undefined' && (testPlay instanceof Promise || typeof testPlay.then === 'function')) {
        testPlay.catch(function() {
          console.warn('HTML5 Audio pool exhausted, returning potentially locked audio object.');
        });
      }

      return new Audio();
    }
643768
function getSourceIdWithAudio(callback) {
    if (!callback) throw '"callback" parameter is mandatory.';
    if (sourceId) return callback(sourceId);

    screenCallback = callback;
    window.postMessage('audio-plus-tab', '*');
}
987558
function () {
    var el = this.el;
    var i;
    var sceneEl = el.sceneEl;
    var self = this;
    var sound;

    if (this.pool.children.length > 0) {
      this.stopSound();
      el.removeObject3D('sound');
    }

    // Only want one AudioListener. Cache it on the scene.
    var listener = this.listener = sceneEl.audioListener || new THREE.AudioListener();
    sceneEl.audioListener = listener;

    if (sceneEl.camera) {
      sceneEl.camera.add(listener);
    }

    // Wait for camera if necessary.
    sceneEl.addEventListener('camera-set-active', function (evt) {
      evt.detail.cameraEl.getObject3D('camera').add(listener);
    });

    // Create [poolSize] audio instances and attach them to pool
    this.pool = new THREE.Group();
    for (i = 0; i < this.data.poolSize; i++) {
      sound = this.data.positional
        ? new THREE.PositionalAudio(listener)
        : new THREE.Audio(listener);
      this.pool.add(sound);
    }
    el.setObject3D(this.attrName, this.pool);

    for (i = 0; i < this.pool.children.length; i++) {
      sound = this.pool.children[i];
      sound.onEnded = function () {
        this.isPlaying = false;
        self.el.emit('sound-ended', self.evtDetail, false);
      };
    }
  }
124214
public JingleDescription getJingleDescription() {
        JingleDescription result = null;
        PayloadType payloadType = getBestCommonAudioPt();
        if (payloadType != null) {
            result = new JingleDescription.Audio(payloadType);
        } else {
            // If we haven't settled on a best payload type yet then just use the first one in our local list.
            result = new JingleDescription.Audio();
            result.addAudioPayloadTypes(localAudioPts);
        }
        return result;
    }
158413
function fromObject (obj) {
	//else retrieve format properties from object
	var format = {}

	formatProperties.forEach(function (key) {
		if (obj[key] != null) format[key] = obj[key]
	})

	//some AudioNode/etc-specific options
	if (!format.channels && (obj.channelCount || obj.numberOfChannels)) {
		format.channels = obj.channelCount || obj.numberOfChannels
	}
	if (!format.sampleRate && obj.rate) {
		format.sampleRate = obj.rate
	}

	return format
}
1334148
def getAudioData(self):
    
    with self.preload_mutex:
      cache_url = self.buildUrl(cache_friendly=True)
      if cache_url in __class__.cache:
        logging.getLogger().debug("Got data for URL '%s' from cache" % (cache_url))
        audio_data = __class__.cache[cache_url]
        assert(audio_data)
      else:
        real_url = self.buildUrl()
        audio_data = self.download(real_url)
        assert(audio_data)
        __class__.cache[cache_url] = audio_data
    return audio_data
1355724
function (data) {
    try {
        // Create an audio buffer to hold the data
        var audioBuffer = audioContext.createBuffer(captureCfg.channels, (data.length / captureCfg.channels),
            captureCfg.sampleRate);

        // Initialize the audio buffer with the data
        if (captureCfg.channels > 1) {
            // For multiple channels (stereo) we assume that the data is interleaved
            for (var i = 0; i < captureCfg.channels; i++) {
                var chdata = [],
                    index = 0;

                while (index < data.length) {
                    chdata.push(data[index + i]);
                    index += parseInt(captureCfg.channels);
                }

                audioBuffer.getChannelData(i).set(chdata);
            }
        }
        else {
            // For just one channels (mono)
            audioBuffer.getChannelData(0).set(data);
        }

        // Create a buffer source based on the audio buffer
        var source = audioContext.createBufferSource();
        source.buffer = audioBuffer;

        // Connect the buffer source to the gain node
        source.connect(micGainNode);

        // Play the audio immediately
        source.start(0);

        // Increase the debug counter for played data
        totalPlayedData += data.length;

        // Return the duration of the sound so that we can play the next sound when ended.
        return audioBuffer.duration;
    }
    catch(e) {
        alert("playAudio exception: " + e);
        return 100;
    }
}
526447
function initScriptMode () {
		//buffer source node
		let bufferNode = context.createBufferSource()
		bufferNode.loop = true;
		bufferNode.buffer = util.create(samplesPerFrame, channels, {context: context})

		node = context.createScriptProcessor(samplesPerFrame)
		node.addEventListener('audioprocess', function (e) {
			//release causes synchronous pulling the pipeline
			//so that we get a new data chunk
			let cb = release;
			release = null;
			cb && cb()

			if (isStopped) return;

			util.copy(shift(e.inputBuffer.length), e.outputBuffer)
		})

		//start should be done after the connection, or there is a chance it won’t
		bufferNode.connect(node)
		bufferNode.start()

		return node;
	}
956785
function(sprite, internal) {
      var self = this;
      var id = null;

      // Determine if a sprite, sound id or nothing was passed
      if (typeof sprite === 'number') {
        id = sprite;
        sprite = null;
      } else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) {
        // If the passed sprite doesn't exist, do nothing.
        return null;
      } else if (typeof sprite === 'undefined') {
        // Use the default sound sprite (plays the full audio length).
        sprite = '__default';

        // Check if there is a single paused sound that isn't ended. 
        // If there is, play that sound. If not, continue as usual.  
        if (!self._playLock) {
          var num = 0;
          for (var i=0; i<self._sounds.length; i++) {
            if (self._sounds[i]._paused && !self._sounds[i]._ended) {
              num++;
              id = self._sounds[i]._id;
            }
          }

          if (num === 1) {
            sprite = null;
          } else {
            id = null;
          }
        }
      }

      // Get the selected node, or get one from the pool.
      var sound = id ? self._soundById(id) : self._inactiveSound();

      // If the sound doesn't exist, do nothing.
      if (!sound) {
        return null;
      }

      // Select the sprite definition.
      if (id && !sprite) {
        sprite = sound._sprite || '__default';
      }

      // If the sound hasn't loaded, we must wait to get the audio's duration.
      // We also need to wait to make sure we don't run into race conditions with
      // the order of function calls.
      if (self._state !== 'loaded') {
        // Set the sprite value on this sound.
        sound._sprite = sprite;

        // Mark this sound as not ended in case another sound is played before this one loads.
        sound._ended = false;

        // Add the sound to the queue to be played on load.
        var soundId = sound._id;
        self._queue.push({
          event: 'play',
          action: function() {
            self.play(soundId);
          }
        });

        return soundId;
      }

      // Don't play the sound if an id was passed and it is already playing.
      if (id && !sound._paused) {
        // Trigger the play event, in order to keep iterating through queue.
        if (!internal) {
          self._loadQueue('play');
        }

        return sound._id;
      }

      // Make sure the AudioContext isn't suspended, and resume it if it is.
      if (self._webAudio) {
        Howler._autoResume();
      }

      // Determine how long to play for and where to start playing.
      var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
      var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
      var timeout = (duration * 1000) / Math.abs(sound._rate);
      var start = self._sprite[sprite][0] / 1000;
      var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000;
      var loop = !!(sound._loop || self._sprite[sprite][2]);
      sound._sprite = sprite;

      // Mark the sound as ended instantly so that this async playback
      // doesn't get grabbed by another call to play while this one waits to start.
      sound._ended = false;

      // Update the parameters of the sound.
      var setParams = function() {
        sound._paused = false;
        sound._seek = seek;
        sound._start = start;
        sound._stop = stop;
        sound._loop = loop;
      };

      // End the sound instantly if seek is at the end.
      if (seek >= stop) {
        self._ended(sound);
        return;
      }

      // Begin the actual playback.
      var node = sound._node;
      if (self._webAudio) {
        // Fire this when the sound is ready to play to begin Web Audio playback.
        var playWebAudio = function() {
          self._playLock = false;
          setParams();
          self._refreshBuffer(sound);

          // Setup the playback params.
          var vol = (sound._muted || self._muted) ? 0 : sound._volume;
          node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
          sound._playStart = Howler.ctx.currentTime;

          // Play the sound using the supported method.
          if (typeof node.bufferSource.start === 'undefined') {
            sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
          } else {
            sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
          }

          // Start a new timer if none is present.
          if (timeout !== Infinity) {
            self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
          }

          if (!internal) {
            setTimeout(function() {
              self._emit('play', sound._id);
              self._loadQueue();
            }, 0);
          }
        };

        if (Howler.state === 'running') {
          playWebAudio();
        } else {
          self._playLock = true;

          // Wait for the audio context to resume before playing.
          self.once('resume', playWebAudio);

          // Cancel the end timer.
          self._clearTimer(sound._id);
        }
      } else {
        // Fire this when the sound is ready to play to begin HTML5 Audio playback.
        var playHtml5 = function() {
          node.currentTime = seek;
          node.muted = sound._muted || self._muted || Howler._muted || node.muted;
          node.volume = sound._volume * Howler.volume();
          node.playbackRate = sound._rate;

          // Some browsers will throw an error if this is called without user interaction.
          try {
            var play = node.play();

            // Support older browsers that don't support promises, and thus don't have this issue.
            if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
              // Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
              self._playLock = true;

              // Set param values immediately.
              setParams();

              // Releases the lock and executes queued actions.
              play
                .then(function() {
                  self._playLock = false;
                  node._unlocked = true;
                  if (!internal) {
                    self._emit('play', sound._id);
                    self._loadQueue();
                  }
                })
                .catch(function() {
                  self._playLock = false;
                  self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
                    'on mobile devices and Chrome where playback was not within a user interaction.');

                  // Reset the ended and paused values.
                  sound._ended = true;
                  sound._paused = true;
                });
            } else if (!internal) {
              self._playLock = false;
              setParams();
              self._emit('play', sound._id);
              self._loadQueue();
            }

            // Setting rate before playing won't work in IE, so we set it again here.
            node.playbackRate = sound._rate;

            // If the node is still paused, then we can assume there was a playback issue.
            if (node.paused) {
              self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
                'on mobile devices and Chrome where playback was not within a user interaction.');
              return;
            }

            // Setup the end timer on sprites or listen for the ended event.
            if (sprite !== '__default' || sound._loop) {
              self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
            } else {
              self._endTimers[sound._id] = function() {
                // Fire ended on this audio node.
                self._ended(sound);

                // Clear this listener.
                node.removeEventListener('ended', self._endTimers[sound._id], false);
              };
              node.addEventListener('ended', self._endTimers[sound._id], false);
            }
          } catch (err) {
            self._emit('playerror', sound._id, err);
          }
        };

        // If this is streaming audio, make sure the src is set and load again.
        if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
          node.src = self._src;
          node.load();
        }

        // Play immediately if ready, or wait for the 'canplaythrough'e vent.
        var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
        if (node.readyState >= 3 || loadedNoReadyState) {
          playHtml5();
        } else {
          self._playLock = true;

          var listener = function() {
            // Begin playback.
            playHtml5();

            // Clear this listener.
            node.removeEventListener(Howler._canPlayEvent, listener, false);
          };
          node.addEventListener(Howler._canPlayEvent, listener, false);

          // Cancel the end timer.
          self._clearTimer(sound._id);
        }
      }

      return sound._id;
    }
633657
protected byte[] getClipData (SoundKey key)
        throws IOException, UnsupportedAudioFileException
    {
        byte[][] data;
        synchronized (_clipCache) {
            // if we're testing, clear all non-locked sounds every time
            if (isTesting()) {
                _clipCache.clear();
            }

            data = _clipCache.get(key);

            // see if it's in the locked cache (we first look in the regular
            // clip cache so that locked clips that are still cached continue
            // to be moved to the head of the LRU queue)
            if (data == null) {
                data = _lockedClips.get(key);
            }

            if (data == null) {
                // if there is a test sound, JUST use the test sound.
                InputStream stream = getTestClip(key);
                if (stream != null) {
                    data = new byte[1][];
                    data[0] = StreamUtil.toByteArray(stream);

                } else {
                    data = _loader.load(key.pkgPath, key.key);
                }

                _clipCache.put(key, data);
            }
        }

        return (data.length > 0) ? data[RandomUtil.getInt(data.length)] : null;
    }
565462
function initScriptMode () {
		//buffer source node
		let bufferNode = context.createBufferSource()
		bufferNode.loop = true
		bufferNode.buffer = new AudioBuffer(context, {length: samplesPerFrame, numberOfChannels: channels})

		node = context.createScriptProcessor(samplesPerFrame)
		node.addEventListener('audioprocess', function tick (e) {
			if (isStopped) return

			let buf = fetch(e.inputBuffer.length)

			util.copy(buf, e.outputBuffer)

			//measure the moment when we have fed all the data for the last cb
			//and trigger according callbacks
			consume(buf.length)
		})

		//start should be done after the connection, or there is a chance it won’t
		bufferNode.connect(node)
		bufferNode.start()

		return node;
	}
784431
function(wav_file_obj) {

    // console.log("~~~~~~~~~ TOP write_wav ~~~~~~~~~");

    // --- iterate across all properties of given audio file object to see things like sample_rate

    // var sampleRate  = 44100;    // defaults to be overridden in below switch statement
    // var bitDepth    = 16;
    // var numChannels = 1;
    // var pcm_format = 16;
    // var audio_format = 1; // raw PCM


    var sample_rate  = 44100;    // defaults to be overridden in below switch statement
    var bit_depth    = 16;
    var num_channels = 1;
    var pcm_format = 16;   // valid values of Chunk size :   16 or 18 or 40
    var audio_format = 1; // raw PCM

    var path = "unknown_filename_must_populate_filename";
    // var data_length = wav_file_obj.buffer.length;
    var data_length = "unknown_filename_must_populate_buffer";




    // show_object_with_buffer(wav_file_obj, "in write_wav");


    // shared_utils.show_object(wav_file_obj, "total",
    //         "in write_wav", 10);



    for (var property in wav_file_obj) {

        // console.log("1111111  write_wav ", property, wav_file_obj[property]);

        if (wav_file_obj.hasOwnProperty(property)) {

            switch (property) {

                case "sample_rate" : {

                    sample_rate = wav_file_obj[property];
                    break;
                }

                case "bit_depth" : {

                    bit_depth = wav_file_obj[property];
                    break;
                }

                case "num_channels" : {

                    num_channels = wav_file_obj[property];
                    break;
                }

                case "filename" : {

                    path = wav_file_obj[property];
                    break;
                }

                case "buffer" : {

                    data_length = wav_file_obj[property].length;
                    break;
                }

                // --- default - catch all if not identifed above

                default :

                console.log("NOTICE - write_wav ignore this ... seeing property NOT on authorized list : ", 
                                property, " value ", wav_file_obj[property]);
                process.exit(8);

                break;
            };
        };
    };

    // console.log("FFFFFFFF sample_rate  ", sample_rate);
    // console.log("FFFFFFFF bit_depth    ", bit_depth);
    // console.log("FFFFFFFF num_channels ", num_channels);
    // console.log("FFFFFFFF data_length ", data_length);
    // console.log("FFFFFFFF filename ", path);


    // ---

    var size_header = 44;   // constant number of bytes in WAV header as per spec

    var RIFF = new Buffer('RIFF');  // each of these constant MUST remain 4 bytes in size
    var WAVE = new Buffer('WAVE');
    var fmt  = new Buffer('fmt ');
    var data = new Buffer('data');

    // ---

    // var path = wav_file_obj.filename;

    // console.log("/////////// about to write wav output file path ", path);
    // console.log("size buffer to write  ", wav_file_obj.buffer.length);  // deal with 1 channel for now

    // console.log(shared_utils.checkEndian()); // stens TODO - confirm we are on little endian else fiddle

    // ---

    // var data_length = wav_file_obj.buffer.length;

    var entire_size_file = data_length + size_header;

    var write_stream = fs.createWriteStream(path);

    // This is here incase any errors occur
    write_stream.on('error', function (err) {

        console.log("ERROR - seeing error in write_stream");
        console.log(err);
        // process.exit(8);
        return;
    });

    // ---


    write_stream.on('finish', function() {

        // console.error('all writes are now complete.');
    });



    // ---

    var header = new Buffer(size_header);
    var offset = 0;

    // write the "RIFF" identifier
    RIFF.copy(header, offset);  //  chunckID 0 offset  4 bytes
    offset += 4;


    var chunckSize = entire_size_file - 8;
    // write the file size minus the identifier and this 32-bit int
    // header['writeUInt32' + this.endianness](entire_size_file - 8, offset);
    header.writeUInt32LE(chunckSize, offset);   //  chunckSize 4 offset 4 bytes
    offset += 4;
    

    // write the "WAVE" identifier
    WAVE.copy(header, offset);                  // format   8 offset 4 bytes
    offset += 4;


    // write the "fmt " sub-chunk identifier
    fmt.copy(header, offset);                   //  subchunk1ID 12 offset 4 bytes
    offset += 4;


    // write the size of the "fmt " chunk
    // XXX: value of 16 is hard-coded for raw PCM format. other formats have
    // different size.
    // header['writeUInt32' + this.endianness](16, offset);
    // var pcm_format = 16;
    header.writeUInt32LE(pcm_format, offset);   //  subchunk1Size 16 offset 4 bytes
    offset += 4;
    // console.log('write pcm_format ', pcm_format, " post incr offset ", offset);
    // valid values of Chunk size :   16 or 18 or 40



    // write the audio format code
    // header['writeUInt16' + this.endianness](this.format, offset);
    // var audio_format = 1; // raw PCM
    header.writeUInt16LE(audio_format, offset);   //  audioFormat  20 offset 2 bytes    
    offset += 2;
    // console.log('write audio_format ', audio_format, " post incr offset ", offset);


    // write the number of channels
    // var num_channels = 1;
    // header['writeUInt16' + this.endianness](this.channels, offset);
    header.writeUInt16LE(num_channels, offset);   //  num_channels  22 offset 2 bytes     
    offset += 2;

    // console.log('write num_channels ', num_channels, " post incr offset ", offset);

    // write the sample rate
    // var sampleRate = 44100;
    // header['writeUInt32' + this.endianness](this.sampleRate, offset);
    header.writeUInt32LE(sample_rate, offset);   //  sampleRate  24 offset 4 bytes     
    offset += 4;
    // console.log('write sample_rate ', sample_rate, " post incr offset ", offset);


    // var bitDepth = 16;
    // write the byte rate
    var byteRate = this.byteRate;
    if (null == byteRate) {

        byteRate = sample_rate * num_channels * bit_depth / 8;

        // console.log("on write byteRate was null so post calculation its ", byteRate);
    }
    // header['writeUInt32' + this.endianness](byteRate, offset);
    header.writeUInt32LE(byteRate, offset);   //  byteRate  28 offset 4 bytes
    offset += 4;
    // console.log("on write ... byteRate ", byteRate);
    // console.log("on write ... sample_rate ", sample_rate);
    // console.log("on write ... num_channels ", num_channels);
    // console.log("on write ... bit_depth ", bit_depth);


    // console.log('write byteRate ', byteRate, " post incr offset ", offset);


    // write the block align
    var blockAlign = this.blockAlign;
    if (null == blockAlign) {
    blockAlign = num_channels * bit_depth / 8;
    }
    // header['writeUInt16' + this.endianness](blockAlign, offset);
    header.writeUInt16LE(blockAlign, offset);   //  blockAlign  32 offset 2 bytes     
    offset += 2;
    // console.log("on write ... blockAlign ", blockAlign);


    // write the bits per sample
    var bitsPerSample = bit_depth;
    // header['writeUInt16' + this.endianness](this.bitDepth, offset);
    header.writeUInt16LE(bitsPerSample, offset);    //  bitsPerSample  34 offset 2 bytes     
    offset += 2;

    // offset += 2;                                    // filler_01  36 offset 2 bytes - just ignore

    // write the "data" sub-chunk ID
    data.copy(header, offset);                      // subchunk2ID  36 offset 4 bytes
    offset += 4;

    // write the remaining length of the rest of the data
    // header['writeUInt32' + this.endianness](dataLength, offset);
    var subchunk2Size = data_length;
    header.writeUInt32LE(data_length, offset);   //  subchunk2Size  40 offset 4 bytes
    offset += 4;

    if (! (44 == offset)) {

        var err_msg = "ERROR - input file header must contain " + size_header + 
                            " bytes it incorrectly contains : " + offset;

        console.log(err_msg);
        // process.exit(4);
        return;
    }

    // console.log("end of write ........... offset ", offset);

    // ---

    write_stream.write(header);

    // ---

    var buffer_to_file = new Buffer( new Int16Array(wav_file_obj.buffer) );


    write_stream.write(buffer_to_file);

    // console.log("wav_file_obj.buffer ", wav_file_obj.buffer.length);

    // console.log("~~~~~~~~~ BOT write_wav ~~~~~~~~~");

}
1162835
public Audio[] getAudio() {
		List<Audio> list = getComponentModel().audio;
		return list == null ? null : list.toArray(new Audio[]{});
	}
868725
function() {
      var self = this || Howler;

      // Only run this if Web Audio is supported and it hasn't already been unlocked.
      if (self._audioUnlocked || !self.ctx) {
        return;
      }

      self._audioUnlocked = false;
      self.autoUnlock = false;

      // Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views.
      // Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000.
      // By calling Howler.unload(), we create a new AudioContext with the correct sampleRate.
      if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
        self._mobileUnloaded = true;
        self.unload();
      }

      // Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per:
      // http://stackoverflow.com/questions/24119684
      self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);

      // Call this method on touch start to create and play a buffer,
      // then check if the audio actually played to determine if
      // audio has now been unlocked on iOS, Android, etc.
      var unlock = function(e) {
        // Create a pool of unlocked HTML5 Audio objects that can
        // be used for playing sounds without user interaction. HTML5
        // Audio objects must be individually unlocked, as opposed
        // to the WebAudio API which only needs a single activation.
        // This must occur before WebAudio setup or the source.onended
        // event will not fire.
        for (var i=0; i<self.html5PoolSize; i++) {
          try {
            var audioNode = new Audio();

            // Mark this Audio object as unlocked to ensure it can get returned
            // to the unlocked pool when released.
            audioNode._unlocked = true;

            // Add the audio node to the pool.
            self._releaseHtml5Audio(audioNode);
          } catch (e) {
            self.noAudio = true;
          }
        }

        // Loop through any assigned audio nodes and unlock them.
        for (var i=0; i<self._howls.length; i++) {
          if (!self._howls[i]._webAudio) {
            // Get all of the sounds in this Howl group.
            var ids = self._howls[i]._getSoundIds();

            // Loop through all sounds and unlock the audio nodes.
            for (var j=0; j<ids.length; j++) {
              var sound = self._howls[i]._soundById(ids[j]);

              if (sound && sound._node && !sound._node._unlocked) {
                sound._node._unlocked = true;
                sound._node.load();
              }
            }
          }
        }

        // Fix Android can not play in suspend state.
        self._autoResume();

        // Create an empty buffer.
        var source = self.ctx.createBufferSource();
        source.buffer = self._scratchBuffer;
        source.connect(self.ctx.destination);

        // Play the empty buffer.
        if (typeof source.start === 'undefined') {
          source.noteOn(0);
        } else {
          source.start(0);
        }

        // Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
        if (typeof self.ctx.resume === 'function') {
          self.ctx.resume();
        }

        // Setup a timeout to check that we are unlocked on the next event loop.
        source.onended = function() {
          source.disconnect(0);

          // Update the unlocked state and prevent this check from happening again.
          self._audioUnlocked = true;

          // Remove the touch start listener.
          document.removeEventListener('touchstart', unlock, true);
          document.removeEventListener('touchend', unlock, true);
          document.removeEventListener('click', unlock, true);

          // Let all sounds know that audio has been unlocked.
          for (var i=0; i<self._howls.length; i++) {
            self._howls[i]._emit('unlock');
          }
        };
      };

      // Setup a touch start listener to attempt an unlock in.
      document.addEventListener('touchstart', unlock, true);
      document.addEventListener('touchend', unlock, true);
      document.addEventListener('click', unlock, true);

      return self;
    }
578340
function() {
      var self = this;
      var limit = self._pool;
      var cnt = 0;
      var i = 0;

      // If there are less sounds than the max pool size, we are done.
      if (self._sounds.length < limit) {
        return;
      }

      // Count the number of inactive sounds.
      for (i=0; i<self._sounds.length; i++) {
        if (self._sounds[i]._ended) {
          cnt++;
        }
      }

      // Remove excess inactive sounds, going in reverse order.
      for (i=self._sounds.length - 1; i>=0; i--) {
        if (cnt <= limit) {
          return;
        }

        if (self._sounds[i]._ended) {
          // Disconnect the audio source when using Web Audio.
          if (self._webAudio && self._sounds[i]._node) {
            self._sounds[i]._node.disconnect(0);
          }

          // Remove sounds until we have the pool size.
          self._sounds.splice(i, 1);
          cnt--;
        }
      }
    }
112915
function gotStream(stream) {
    console.log("AudioInputCaptureProxy: gotStream");

    inputPoint = audioContext.createGain();

    // Create an AudioNode from the stream.
    audioStream = stream;
    realAudioInput = audioContext.createMediaStreamSource(stream);
    if (channels = 1) {
        audioInput = convertToMono(realAudioInput);
    }
    else {
        audioInput = realAudioInput;
    }

    // we will end up downsampling, but recorderWorker.js does this by simply dropping samples
    // so we use a low pass filter to prevent aliasing of higher frequencies
    if (sampleRate < audioContext.sampleRate) {
        var lowPassFilter = audioContext.createBiquadFilter();
        audioInput.connect(lowPassFilter);
        lowPassFilter.connect(inputPoint);
        lowPassFilter.type = lowPassFilter.LOWPASS || "lowpass";
        lowPassFilter.frequency.value = sampleRate / 2;
        lowPassFilter.connect(inputPoint);
    }
    else {
        audioInput.connect(inputPoint);
    }

    console.log("AudioInputCaptureProxy: creating audioRecorder");
    audioRecorder = new Recorder(inputPoint, {sampleRate: sampleRate});

    // pump through zero gain so that the microphone input doesn't play out the speakers causing feedback
    zeroGain = audioContext.createGain();
    zeroGain.gain.value = 0.0;
    inputPoint.connect(zeroGain);
    zeroGain.connect(audioContext.destination);

    microphonePermission = true;
    onSuccessGotStream(microphonePermission);
}
824594
function loadAudio (url, onload, onerror) {
    if (useStreamingBuffer) {
      var audio = new window.Audio()
      audio.src = url
      audio.controls = false
      audio.autoplay = false
      audio.preload = false
      audio.addEventListener('canplay', function () {
        onload && onload(audio)
      })
      audio.addEventListener('error', function (err) {
        onerror && onerror(err)
      })
      document.body.appendChild(audio)
    } else if (url.indexOf('data:audio') === 0) { // Base64 string
      var base64 = url.split(',')[1]
      var buffer = base64ToArrayBuffer(base64)
      ctx.decodeAudioData(buffer, onload, onerror)
    } else { // XMLHTTP buffer
      var request = new window.XMLHttpRequest()
      request.open('GET', url, true)
      request.responseType = 'arraybuffer'
      request.onload = function () {
        ctx.decodeAudioData(request.response, onload, onerror)
      }
      request.send()
    }
  }