/portable-synthesizer

Making sounds with JavaScript! 🎹🎼🎶

Primary LanguageJavaScript

portable-synthesizer Build Status

Making sounds with JavaScript! 🎹🎼🎶

portable-synthesizer is a wrapper around the Web Audio API aimed at making it easy to use the browser as a synthesizer. Currently, it has a fairly minimal API that allows users to define a set of oscillators and noises, play notes, and define custom sounds based on a mix of oscillators and noises.

Installation

portable-synthesizer is available on npm:

npm install portable-synthesizer --save

Usage Example

This library works in all browsers that support the Web Audio API.

import Synthesizer from 'portable-synthesizer'

const synth = Synthesizer(window.AudioContext || window.webkitAudioContext)

synth.setTone({
  oscillators: [{ waveform: 'triangle' }]
})

synth.play('C4') // middle C

setTimeout(() => {
  synth.stop('C4')
}, 500)