rserota

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. If you want to know when the audio file is finished decoding, you can pass a callback to the Wad constructor. var bell = new Wad({ source : 'http://www.myserver.com/audio/bell.wav', callback : function(thisWad){ console.log(thisWad) } }) This function will run after the audio file has been downloaded and decoded, at the end of the audioContext's decodeAudioData callback. Playhead position is harder to access. As a workaround, you can check Wad.audioContext.currentTime when you trigger a sound, and then compare it to (e.g.) bell.decodedBuffer.duration, which tells you how long the audio clip is.
  2. Hello all, I'm the author of an open-source audio library that I think would be very useful to anyone making a game on the internet. WAD.js is the Web Audio DAW (digital audio workstation). The goal of WAD.js is to emulate the features you would find in a DAW like FL Studio, with an interface that is much, much simpler than working with native WebAudio. Instead of creating complex networks of audio nodes to make basic sounds, as you have to do in native web audio, WAD.js wraps everything that is needed for a single sound into a single object (a "wad") that has convenient methods that you can use to dynamically modify the sound. For example, if you want to simulate a bustling city, WAD.js makes it easy to pan sounds in 3-dimensions, so you can hear different people (or cars, or dogs, or whatever) moving around the main character. Or maybe your character just went into a tunnel, so you'll want to increase the reverb on all the sound effects. If you're really the DIY type, you can use WAD.js to combine oscillators, filters, and effects to make your own sound effects. WAD.js also supports MIDI input, so if you wanted to make some kind of rock-band like game, you could certainly do that without too much difficulty. I'm actively developing this project, so new features are being added all the time. Please check it out on github. Contributions are certainly welcome! https://github.com/rserota/wad Also, I have a demo online that shows off some of the basic features of this library, in case you want more information before you really dive into the code. http://www.codecur.io/us/songdemo