{"_id":"audiolib","_rev":"83-2e27485af49573420f1b1db88f0126f1","name":"audiolib","description":"audiolib.js is a powerful audio tools library for javascript.","dist-tags":{"latest":"0.6.6"},"versions":{"0.3.0":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.3.0","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"main":"./lib/audiolib","dependencies":{},"devDependencies":{},"_id":"audiolib@0.3.0","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"017a928ff3c1a7f470e8134ca9ef906e3b885201","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.3.0.tgz","integrity":"sha512-u/9DcSL1O/G7i9rC9n8YEE1oux/xyb5CVFl8rwd3jV1cuo5BL24jRQ2dz/0dc2y59dPA+sO6bgDya86l67g7EQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmJaja4HnN7gTkcZeL/VGo8E47XODoiTGKfnKOAHfDHAiB5Tg7FC44Uh2qgDDbCR0iu38mbxngbAgxdbvv/+phYrA=="}]},"scripts":{}},"0.4.0":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.4.0","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"main":"./lib/audiolib","dependencies":{},"devDependencies":{},"_id":"audiolib@0.4.0","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"7970367d23277d2f6bdda8fa82483fc96050ffcc","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.4.0.tgz","integrity":"sha512-f7qseihUs0UOvJtmuJ//Q86GSD1vgyFPrWN7LOTMojFIccRjmNDKd1/oGFjBG2R7iDqmSjSK/QvfLjj0BjAidw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDTj54/UIGthhYjTeoIImm11l8X8PbobZTkhf61IHsNjAIgV0fAYFPCfVumqHWIqYg//ycVE92oP58AueEYNuUlP/k="}]},"scripts":{}},"0.4.1":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.4.1","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"main":"./lib/audiolib","dependencies":{},"devDependencies":{},"_id":"audiolib@0.4.1","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"a5402b8fec06845c4d3e3ea8b9cd3698dc980a59","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.4.1.tgz","integrity":"sha512-gjhoOloUA3aViUljwi18Y3OVwCv/o4nCRG8UcYZHqXMIG2ZqBXE5t7HDyedypjbsJBuEvRmxL4TJSHnT3Jd5yg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIARirnYUUiql1NJlObBMUf70E2ubtx82YRY18waWaSdKAiAm8HjKkzcaP2GTRQufzCcqgVd1R9KxiKrZCVFf7Czcaw=="}]},"scripts":{}},"0.5.0":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.5.0","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"main":"./lib/audiolib","dependencies":{},"devDependencies":{},"_id":"audiolib@0.5.0","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"65c6ee55b1946c8b5b4c6f90294161eaeaab7607","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.5.0.tgz","integrity":"sha512-nZf6sld9O8DiA/WV1907fK3vps5LQeJKfqKToxtwN8J0H78JXuPiqlGwU5TlRR5Z7D7LxNuhJjKg+rptqA4bOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuSx/KOEKDsd4hh+gbdtSXt+Ssu0aOIUyEaT0xL4X7jgIhAMh8jjIX2APEq5/UoHXVuXTYAXPGG9kN3I9rHWHihipD"}]},"scripts":{},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.5.1":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.5.1","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"main":"./lib/audiolib","dependencies":{},"devDependencies":{},"_id":"audiolib@0.5.1","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"22bf4f231958b668e2dfb39108f8026335c40fc4","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.5.1.tgz","integrity":"sha512-YRqc1PlMFpDsb79Xo06w+CcKsK4Hpd128INGITDzrUYhaZG7j9acVFjy3Lc38u7FWM450wAOz2jbOzW0jwDEEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIELiGsUBjypRefXTUygqo2zrbvMrAxN/xnnHY/rSXU0ZAiEAjAf+g8rmGNLGv9VkgJkvimMYPNLWl0fyxoz6rkoWCao="}]},"scripts":{},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.0":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.0","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"scripts":{"preinstall":"make lib/audiolib.js"},"main":"./lib/audiolib","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"_id":"audiolib@0.6.0","dependencies":{},"devDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"0a0f4a2ac547804b0b960287fcb4cb3a60b750fa","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.0.tgz","integrity":"sha512-uCXrp9a0ICcUa5ekX0T/EH5S3Ca2X6Ee2VOt3qNFRtd0YZvw34uTCMV+Ub8vDb/SGjHyx5/voExBCCVOzEIiGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICuAXCgEGGFYytvgE+4JE0qu4rojeEGr9G3+hCcoeSxfAiEA7smTePdRM+oXSo52kHJZizxoNhbiXZ24EWrR9B6Swjk="}]},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.1":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.1","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"scripts":{"preinstall":"make lib/audiolib.js"},"main":"./lib/audiolib","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"_id":"audiolib@0.6.1","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"fdb2a60ca78ced0ceb7cbd74bd71f1b482a4ec6a","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.1.tgz","integrity":"sha512-+W2G27BPYCvXLQcFBvzrHdxuYTgwydFEEeARSiKOlbwgmP4SlC8IVfMAJjL76NL0xJSvN3ZKoT0MDiWNTlTuyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDtVw0B21hKNvvyVE+BL1jjcITKellmQXBRMNIMHbLrMAiEAzLYWx0VgcZdis+uXiE00yU/u+4+5z1N7T3VtbvRDuRU="}]},"readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://jsmad.org/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [ofmlabs codecs](http://codecs.ofmlabs.org/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs.\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing.\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT.\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea). The project is funded by the awesome [ofmlabs](http://ofmlabs.org) !\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.2":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.2","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"scripts":{"preinstall":"grunt --config Gruntfile.js"},"main":"./lib/audiolib","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"_id":"audiolib@0.6.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.16","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"e3041483e2092e98ec734b00cd74dde9af9d3e3b","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.2.tgz","integrity":"sha512-q9O2iNSyvuMPaoUfQjI9fkmt4FF1FGIObqMmtOwKZ9tvZL3YSCUtpMkiUymDrSGomQAQN2KosRdal+6t8scCjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFQ35ysAmdAApZJGVZx4BL0cTqI8ur7eYD2iQrf++I2wAiBpINcEl5KMFoRW0uLwx3l8zJSlOgY3P7Doi5eULVQpKA=="}]},"readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\n### Node\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nPlease note that you'll need [grunt](http://gruntjs.com/) for this to work.\n\n### Browser\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://jsmad.org/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [ofmlabs codecs](http://codecs.ofmlabs.org/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs. (project deprecated and adopted)\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing. (project deprecated and adopted)\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT. (project deprecated and adopted)\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea). The project is funded by the awesome [ofmlabs](http://ofmlabs.org) !\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.3":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.3","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"git://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"scripts":{"preinstall":"grunt --config Gruntfile.js concat:main"},"main":"./lib/audiolib","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"_id":"audiolib@0.6.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.16","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"a490ed5aeb519a2b9c5a2f8f5ce4cecb28b0bd7e","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.3.tgz","integrity":"sha512-NxekVH3CaWaLUmBLD1eIcgjsQc+FgxLzZxWPvSBu83ZWk4p8TDZhhFvAlXxX0mKIY/ASJp6ixm5gob89qS6B2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBHOfBFqP/NYdjJdtL19niXdBlDd/PrR+GjrdfRlGoWfAiEA2X5lXw1W4A0SFFCr/BU3+URRtgMVsvC8RQomA353fZE="}]},"readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\n### Node\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nPlease note that you'll need [grunt](http://gruntjs.com/) for this to work.\n\n### Browser\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://jsmad.org/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [ofmlabs codecs](http://codecs.ofmlabs.org/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs. (project deprecated and adopted)\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing. (project deprecated and adopted)\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT. (project deprecated and adopted)\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea). The project is funded by the awesome [ofmlabs](http://ofmlabs.org) !\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.4":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.4","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"http://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.2.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"scripts":{"preinstall":"grunt --config Gruntfile.js concat:main"},"main":"./lib/audiolib","readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\n### Node\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nPlease note that you'll need [grunt](http://gruntjs.com/) for this to work.\n\n### Browser\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://jsmad.org/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [ofmlabs codecs](http://codecs.ofmlabs.org/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs. (project deprecated and adopted)\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing. (project deprecated and adopted)\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT. (project deprecated and adopted)\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea). The project is funded by the awesome [ofmlabs](http://ofmlabs.org) !\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","_id":"audiolib@0.6.4","dist":{"shasum":"08e225d4f1d6a4e892e09539db3f289366a37922","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.4.tgz","integrity":"sha512-s4UsQaEI0alahvArOYb0SFXq3DfQ5tjfwU7th0downnPGcHQLBDxe0JiUS/ShiZ3l13/dmgIdl0D+dObudLeEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVvK17bC7sIZCYVOkJr1B5yApE1ILCXdBxr35HgMHRsgIhAOfdS347Y10qu2gi2hE5VE6kU5bxCPcNwgwxWN/menoZ"}]},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.5":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.5","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"http://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.8.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"dependencies":{"cubeb":"0.1.x"},"scripts":{"prepublish":"grunt --config Gruntfile.js concat:main"},"main":"./lib/audiolib","readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\n### Node\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nPlease note that you'll need [grunt](http://gruntjs.com/) for this to work.\n\n### Browser\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://jsmad.org/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [ofmlabs codecs](http://codecs.ofmlabs.org/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs. (project deprecated and adopted)\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing. (project deprecated and adopted)\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT. (project deprecated and adopted)\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea). The project is funded by the awesome [ofmlabs](http://ofmlabs.org) !\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","readmeFilename":"README.md","_id":"audiolib@0.6.5","dist":{"shasum":"d59810482eb4473cc2666194831ce608f8c8e84a","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.5.tgz","integrity":"sha512-+C4rkBlPIzllLarYCuZKsuZloN/XS2RRagD2DZCeExwNBzVTdDfOf7dwaO33tFB8/IJd0IWMwRKMKt7OtL8O0A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHtiFJ7+cZhvz/ScCj7l7zSZpu4vULZ0mEpvslgeQbaNAiEAicIJfl1Bo64P+/Z91z0njf8iacGybaxBISzdrCmbe9U="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]},"0.6.6":{"name":"audiolib","author":{"name":"Jussi Kalliokoski"},"version":"0.6.6","description":"audiolib.js is a powerful audio tools library for javascript.","repository":{"type":"git","url":"http://github.com/jussi-kalliokoski/audiolib.js.git"},"engines":{"node":">=0.10.0-0"},"licenses":[{"type":"MIT"}],"bugs":{"url":"http://github.com/jussi-kalliokoski/audiolib.js/issues"},"directories":{"lib":"./lib"},"dependencies":{"cubeb":"0.2.x"},"scripts":{"prepublish":"./node_modules/.bin/grunt concat"},"main":"./lib/audiolib","devDependencies":{"grunt-contrib-concat":"~0.3.0","grunt-contrib-clean":"~0.5.0","grunt-cli":"~0.1.9","grunt-contrib-compress":"~0.5.2","grunt-contrib-uglify":"~0.2.2","grunt":"~0.4.1","paramon":"~0.1.1","script-builder":"~0.3.3"},"readme":"# audiolib.js\n## Overview\n\naudiolib.js is a powerful toolkit for audio written in JS.\n\nIt ships with most of the common tools such as:\n\n* Reverbs\n* Comb/IIR/Biquad/All-Pass/Low-Pass/Band-Pass/High-Pass filters\n* Delays\n* Oscillators\n* FFT and other analyzing tools\n* Step sequencers\n* Envelope controls\n* Noise generators\n* Samplers\n\nIn addition, it hosts these tools in a comprehensive framework, that makes it simple to write a single effect and provides the higher level abstraction on top of that, making the whole system comfortable for both users and plugin authors.\n\nAs for the higher level abstraction, audiolib.js features a sophisticated automation API, alongside with pre-processing hooks, sample level access and buffer level management.\n\naudiolib.js is bundled with some tools to make an audio developer's life in a browser much easier, such as sink.js for a consistent API between the experimental browser audio APIs. To complement that, audiolib.js also bundles pcmdata.js that is a WAV encoder/decoder, so that you can turn the recordings you make using Sink.js into WAV files that the user can save. Other tools include the AudioWorker API that allows you to create web workers from strings or functions, bundling audiolib.js and its plugins, all ready to use from the worker.\n\n\n## How to get it\n\naudiolib.js is available both in browser and CLI environments.\n\n### Node\n\nTo install via npm:\n\n```\n$ npm install audiolib\n```\n\nPlease note that you'll need [grunt](http://gruntjs.com/) for this to work.\n\n### Browser\n\nFor browser environments, download the latest version [here](https://github.com/jussi-kalliokoski/audiolib.js/downloads), or get the [source code](https://github.com/jussi-kalliokoski/audiolib.js) from GitHub and build it yourself. Don't worry, instructions are included.\n\n## Documentation\n\nDocumentation is available at http://docs.audiolibjs.org/ . Tutorials can be found in the [wiki](https://github.com/jussi-kalliokoski/audiolib.js/wiki)\n\n## Demos\n\n(if you have your own, please fork & add | msg me)\n\n* [JSMad](http://audiocogs.org/codecs/mp3/)\n* [Orbisyn](http://niiden.com/orbisyn/)\n* [jams.no.de](http://jams.no.de)\n* [Audiocogs codecs](http://audiocogs.org/codecs/)\n\n## Libraries bundled with audiolib.js\n\n* [sink.js](https://github.com/jussi-kalliokoski/sink.js), for output and buffer handling.\n* [PCMData.js](https://github.com/jussi-kalliokoski/pcmdata.js), for WAV codecs. (project deprecated and adopted)\n* [binary.js](https://github.com/jussi-kalliokoski/binary.js), for PCMData.js and general binary data processing. (project deprecated and adopted)\n* [fft.js](https://github.com/jussi-kalliokoski/fft.js), for super fast FT. (project deprecated and adopted)\n\n## Related libraries\n\n* [XAudioJS](https://github.com/grantgalitz/XAudioJS) is an alternative audio sink with built-in resampling and a Flash fallback. More developer-controlled output environment, that might be more sane for example games.\n* [dynamicaudio.js](http://github.com/bfirsh/dynamicaudio.js) is a Flash fallback for Mozilla Audio Data API.\n* [Audiolet](https://github.com/oampo/Audiolet) is a graph-based audio routing framework with a lot of nice stuff.\n* [DSP.js](https://github.com/corbanbrook/dsp.js) is an extensive DSP toolkit originally designed for the Mozilla Audio Data API.\n\n## Plugins\n\nSpecifications for plugin developers can be found in https://github.com/jussi-kalliokoski/audiolib.js/tree/master/specs\n\n## Credits \n\nThis project is maintained by [Jussi Kalliokoski](https://github.com/jussi-kalliokoski), with significant contributions from [David Govea](https://github.com/davidgovea).\n\n## License\n\nLicensed under MIT license.\n\n## Example usage\n\n```javascript\n/* Create an output. */\n\nvar dev = audioLib.Sink(function(sampleBuffer){\n\t// Fill the buffer here.\n}, channelCount, preBufferSize, sampleRate);\n\n/*\n Note that all the arguments are optional,\n so if you want to create a write-only\n device, you can leave the arguments blank.\n Also, it is highly discouraged to set any\n of the arguments if you aren't sure that you\n need them. Use null if you need to skip\n arguments.\n*/\n\n/* Writing buffers: */\ndev.writeBuffer(buffer);\n\n/*\n You can also attach multiple listeners\n to the same Sink instance.\n*/\ndev.on('audioprocess', function(...){});\n\n\n/* Effects */\n\nvar del = audioLib.Delay(sampleRate, delay, feedback);\n\nvar flt = audioLib.IIRFilter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.LP12Filter(sampleRate, cutoffFreq, resonance);\n\nvar flt = audioLib.Reverb(sampleRate, channelCount, wet, dry, roomSize, damping);\n\nvar dist = audioLib.BiquadFilter(sampleRate, b0, b1, b2, a1, a2);\n\n/* to feed a new input sample */\neffect.pushSample(sample);\n/* to get the output */\nsample = effect.getMix();\n\n/* Synthesis */\n\nvar osc = audioLib.Oscillator(sampleRate, frequency);\n\n/* to generate a new sample */\nosc.generate();\n/* to get the output */\nosc.getMix();\n\n/* Sampler */\n\nvar sampler = audioLib.Sampler(sampleRate, sampleBuffer, defaultPitch);\n\n/* Envelopes */\n\nvar adsr = audioLib.ADSREnvelope(sampleRate, attack, decay, sustain, release);\n\n/* to trigger the gate */\nadsr.triggerGate(isOpen);\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nadsr.generate();\n/* Get the value */\nadsr.value; // 0.0 - 1.0, unless you put something more as sustain\n\nvar stepSeq = new audioLib.StepSequencer(sampleRate, stepLength, stepArray, attack);\n\n/* To start the sequence over */\nstepSeq.triggerGate();\n/* to update the value ** Do this on every sample fetch for this to work properly. */\nstepSeq.generate();\n/* Get the value */\nstepSeq.value; // 0.0 - 1.0\n\n/* Recording */\n\nvar rec = dev.record();\n\n/* To stop */\nrec.stop();\n// To export wav\nvar audioElement = new Audio(\n\t'data:audio/wav;base64,' +\n\tbtoa( rec.toWav() ) // presuming btoa is supported\n);\n\n/* Resampling buffers */\naudioLib.Sampler.resample(buffer, fromSampleRate,\n\tfromFrequency, toSampleRate, toFrequency);\n\n/*\n If you are used to buffer based approach (for example DSP.js)\n and don't need to do any raw manipulation, all the effects\n can be used as buffer based too.\n*/\n\nvar bufFx = audioLib.Delay/* or any effect */.createBufferBased(\n\tchannelCount, /* the parameters needed by the specific effect */);\n\nbufFx.append(buffer);\n\n```\n\n### Audio Workers\n\nYou can also use audiolib.js inside Audio Workers (Firefox 6.0+ only), but this is a whole another story. There are many approaches to that, you can include audiolib.js via an external javascript worker file, but audiolib.js offers an alternative approach to this: inline workers. Inline audio workers include the source code already downloaded, and thus creates a new worker that already contains audiolib.js. Inline Audio Workers also allow you to inject code into workers. Here is some code to get started, also see tests/audioworker.html.\n\n```javascript\n\nvar worker = audioLib.AudioWorker(function(){\n\tdevice = audioLib.Sink(function(buffer, channelCount){\n\t\t/* Do some audio processing, like you weren't in a worker. */\n\t});\n}, true /* enables injections */);\n\n/* Injection */\n\nworker.inject(function(){\n\t/* Execute some code inside the worker. */\n});\n\n/* Close the worker */\n\nworker.terminate();\n\n```\n\nIt's important to remember that even though that code looks like it's running in the same environment as the code it's written in, it's actually not and runs in the context of the worker, meaning you can't cross-reference variables. Also, the injections are sandboxed, so if you need to create a global variable, drop var.\n","readmeFilename":"README.md","_id":"audiolib@0.6.6","dist":{"shasum":"469f26380296e08965cc4683f6bc25514afd3552","tarball":"https://registry.npmjs.org/audiolib/-/audiolib-0.6.6.tgz","integrity":"sha512-7Nj1QMkgIeVKqeu2JpMEAU0jCujmVyt3tcSvj7HE4aJMzBRo5R9XeCqnFZv1awga4DKu5Eta3iJJ9MooKSeINQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEk5Q6z/7C6ltC3hl3PXBpKXQu6brT0nrIXoy+7wsV0PAiAQfyXQ5cls6I4pXmhXMqRpVU2MtdZFxLOe8GTRpGUP4Q=="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}]}},"maintainers":[{"name":"jussi-kalliokoski","email":"jussi.kalliokoski@gmail.com"}],"time":{"modified":"2022-06-13T03:43:59.492Z","created":"2011-05-17T19:23:05.773Z","0.3.0":"2011-05-17T19:23:06.527Z","0.4.0":"2011-05-23T10:56:15.575Z","0.4.1":"2011-05-23T11:53:15.290Z","0.5.0":"2011-09-08T17:52:13.691Z","0.5.1":"2011-10-21T12:51:26.638Z","0.6.0":"2011-12-20T18:00:01.341Z","0.6.1":"2012-02-26T17:14:40.303Z","0.6.2":"2012-04-25T11:30:26.035Z","0.6.3":"2012-05-07T11:49:12.915Z","0.6.4":"2012-07-03T14:12:35.205Z","0.6.5":"2013-01-12T11:19:59.905Z","0.6.6":"2013-09-01T10:58:32.373Z"},"author":{"name":"Jussi Kalliokoski"},"repository":{"type":"git","url":"http://github.com/jussi-kalliokoski/audiolib.js.git"},"users":{"rchk":true,"hq":true,"filipve":true,"mrdain":true,"jits":true}}