cookbook home ~ main site ~ links ~ podcast ~ mastodon

howler.js test

Details

EXAMPLE

This is quick test of howler.js

Was checking to see if it can pay multiple tracks with an explict sync, but I'm not seeing that.

The audio files aren't included here because I was using ones I can't publish during local testing





<head> Source

<script src="howler.core.js"></script>

HTML Source

<p>This is quick test of howler.js</p>

<p>Was checking to see if it can pay multiple tracks with
  an explict sync, but I'm not seeing that.
<p>

<p>The audio files aren't included here because
  I was using ones I can't publish during local
  testing</p>

JavaScript Source

const init = () => {
  var sound = new Howl({
    src: ['gracie.mp3', 'plucks.mp3'],
    sprite: {
      track01: [0, 20000],
      track02: [21000, 41000]
    }
  });

  // Play each of the track.s
  sound.play('track01');
  sound.play('track02');

  // Change the volume of both tracks.
  sound.volume(0.5);

  // // After a second, pause both sounds in the group.
  // setTimeout(function() {
  //   sound.pause();
  // }, 1000);

  console.log('init')
  console.log(c.alfa)
}

document.addEventListener('DOMContentLoaded', init)

JSON Data Source

{
  "note": "Example JSON data file"
}

Config JS Source

// This file can be used to represent
// and data that should be held outside
// of the main script

const c = {
  alfa: 'bravo',
}