Web Audio as HTML
October 19, 2017 ยท View on GitHub
Web Audio as HTML
Web Audio's API can often get a little daunting. This package provides HTML tags that simplify web audio and make wrapping sources in effects super simple!
API
<web-audio>
More to come...
<web-audio-source>
More to come...
<web-audio-effect>
More to come...
<web-audio-visualizer>
More to come...
<web-audio-visualizer-shader>
More to come...
<web-audio-sequencer>
More to come...
<web-audio-debugger>
More to come...
Midi controller support
More to come...
Examples
- Simplest "click to play" example https://codepen.io/splitinfinities/pen/pWpvbe
- Creating a sequencer https://codepen.io/splitinfinities/pen/Ewoaoe
- Effects and contextual hooks https://codepen.io/splitinfinities/pen/qPpEYv
- Midi controllers: https://codepen.io/splitinfinities/pen/VMyYoY
- Sequencer and callbacks with GSAP https://codepen.io/splitinfinities/pen/zEjKPN
Developing
To start building on to this package, clone this repo to a new directory:
git clone https://github.com/splitinfinities/web-audio-wc.git web-audio-wc
cd web-audio-wc
git remote rm origin
and run:
npm install
npm start
To watch for file changes during develop, run:
npm run dev
To build the component for production, run:
npm run build
Need help? Check out Stencil's docs here.
Using this component
Script tag
- Publish to NPM
- Put a script tag similar to this
<script src='https://unpkg.com/web-audio-wc/dist/webaudio.js'></script>in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
Node Modules
- Run
npm install web-audio-wc --save - Put a script tag similar to this
<script src='node_modules/web-audio-wc/dist/webaudio.js></script>in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
In a stencil-starter app
- Run
npm install web-audio-wc --save - Add
{ name: 'web-audio-wc' }to your collections - Then you can use the element anywhere in your template, JSX, html etc