Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/okaybenji/submono
a Web Audio subtractive, monophonic synthesizer
https://github.com/okaybenji/submono
javascript synth synthesizer webaudio
Last synced: 2 months ago
JSON representation
a Web Audio subtractive, monophonic synthesizer
- Host: GitHub
- URL: https://github.com/okaybenji/submono
- Owner: okaybenji
- License: mit
- Created: 2015-09-30T18:58:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-13T17:24:22.000Z (over 6 years ago)
- Last Synced: 2024-09-21T12:43:32.226Z (3 months ago)
- Topics: javascript, synth, synthesizer, webaudio
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-javascript-audio - okaybenji/submono - small mono-voice (monophonic) synth, define sounds as JS objects (MIDI instruments / Synths)
README
# submono
A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly/)!### Create a synth.
```
var audioCtx = new AudioContext();
var synth = new Monosynth(audioCtx);
```### Play a note.
`synth.start();`### Stop playing.
`synth.stop();`### Use methods to access pitch and waveform...
```
synth.pitch(440); // in hertz
console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square)
```### ...get or set any other properties directly.
```
synth.maxGain = 0.5; // out of 1
synth.attack = 1.0; // in seconds
```### Configure any or all the properties on initialization.
```
var config = {
waveform: 'sawtooth', // or sine, triangle, square
pitch: 440, // in hertz
maxGain: 0.5, // out of 1
attack: 0.1, // in seconds
decay: 0.0, // in seconds
sustain: 1.0, // out of 1
release: 0.8, // in seconds
cutoff: {
maxFrequency: 7500, // in hertz
attack: 0.1, // in seconds
decay: 2.5, // in seconds
sustain: 0.2 // 0-5; maxFrequency multiplied by this
}
};var synth = new Monosynth(audioCtx, config);
```### Demo
[Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/)