Jump to content

Simple, powerful WebAudio with WAD.js


Recommended Posts

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

Link to post
Share on other sites
  • 8 months later...

Hi

Thank you for the lib. I am able to run the demo successfully.

But when I tried to change input to mic I'm getting the follwing errors.

 

Uncaught TypeError: Cannot read property 'interface' of undefinedwad.js:327
plugEmIn   wad.js:575
Wad.play    play.js:25
soundOn     test.html:182
onclick wad.js:217
 
Uncaught TypeError: Cannot read property '0' of undefined  wad.js:217
setUpMic             wad.js:197
(anonymous function)

 

 

This is the code I modified in play.js

 
 
settings = {
source  : 'mic',
filter  : {
type      : 'highpass',
frequency : 700
},
panning : -2
}
 
 
Please help me
 
regards
Wies
Link to post
Share on other sites
  • 10 months later...

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. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...