Friday, 29 April 2016

JavaScript SynthPiano

I have been Experimenting with the Audio Context web API as of late. It lets you create sounds in JavaScript programs using sound wave primitives. This combined with a basic piano keyboard layout means I have made a pretty basic synthesizer.
The basic waveforms that the Audio Context provides are; square, sine, triangle and sawtooth. These wave shapes can be seen in the linked Wikipedia article and are pretty self descriptive. On a subjective level I would describe square and sawtooth waves as being the most artificial sounding, whilst triangle and sine are more 'natural'.

I've been messing around with taking the musical notes from piano sheet music and turing them into data to be played through a script, the Demo button will play a basic version of a simple tune. I've got a more advanced version of this project which can play recorded songs with chords and multiple channels at once but I want to improve the sound quality first. There are quite a few bugs in terms of audio distortions if many notes are played at once....

(Oh it doesn't fit into the blog format, argh need to fix that!)

JavaScript SynthPiano

Wave type: HTML5 canvas goes here

No comments:

Post a Comment