Skip to main content
100%

Audio Synth via d3-ease

✓ Published0🌍 Public
Aalexmacy
Last edited Nov 29, 2016
Created on Nov 29, 2016

This example generates an audio waveform from scratch by combining four different waves—elastic, sine, square, and triangle—whose ratios change based on mouse position, affecting the timbre. The waveform is rendered as an SVG path using `d3.line` with `d3.curveMonotoneX`, while audio is produced via the Web Audio API. Each wave is derived from D3 easing functions: `d3.easeElasticIn`, `d3.easeSinInOut`, `d3.easeLinear`, and `Math.round` for the square wave. Labels show the current percentage mix of each wave.

AI-generated description

This generates an audio waveform from scratch by combing different waves that have been generated using d3's easing functions. 'Elastic' is created using d3.easeElasticIn(), 'sine' uses d3.easeSinInOut(), 'triangle' uses d3.easeLinear(), and 'square' is generated using Math.round(). Moving the mouse causes the ratio of each wave to change, effecting the timbre.

For more Web Audio fun, check out:

  • <a href="http://bl.ocks.org/alexmacy/5f5d6f75a44f27f19a2eebf7771ed73e">Phase Shifting</a>

  • <a href="http://bl.ocks.org/alexmacy/f25c39867546f8c72af13cb7e5bc654a">I Am Sitting in a Room - Alvin Lucier</a>

  • <a href="http://bl.ocks.org/alexmacy/d31b0819f11fc881add341ace6483bd3">Web Audio Sampler with Effects</a>

  • <a href="http://bl.ocks.org/alexmacy/41bf2c3727c59a3366528807c2c708b2">Web Audio Theremin & Oscilloscope</a>

mit Licensed

Similar vizzes