GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — knowledge/audio.md at master · AndCollectiom/knowledge

Expand file tree

/

audio.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
94 lines (79 loc) · 3.09 KB
/

audio.md

Copy path

File metadata and controls

94 lines (79 loc) · 3.09 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

audio

Audio, the synthesis (in whichever way) of sound.

Chromatic scale

12 notes is a full octave.

                         -3  -1   1       4   6       9   11
                       -4  -2   0   2   3   5   7   8   10  12
  .___________________________________________________________________________.
  :  | |  |  | | | |  |  | | | | | |  |  | | | |  |  | | | | | |  |  | | | |  :
  :  | |  |  | | | |  |  | | | | | |  |  | | | |  |  | | | | | |  |  | | | |  :
  :  | |  |  | | | |  |  | | | | | |  |  | | | |  |  | | | | | |  |  | | | |  :
<-:  |_|  |  |_| |_|  |  |_| |_| |_|  |  |_| |_|  |  |_| |_| |_|  |  |_| |_|  :->
  :   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   :
  : A | B | C | D | E | F | G | A | B | C | D | E | F | G | A | B | C | D | E :
  :___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___:
    ^                           ^           ^               ^           ^
  220 Hz                      440 Hz      523.25 Hz       880 Hz     1174.65 Hz
(-1 Octave)                 (middle A)                 (+1 Octave)

In order to change the tune with the web audio api do:

const osc = ctx.createOscillator()

osc.type = 'sawtooth'
osc.frequency.value = 440
osc.detune.value = 3 * 100

Filters

Filters can modify values. Using .connect() they are analogous to through streams for audio.

const f = audioContext.createBiquadFilter()
f.type = 'highpass'
f.frequency.value = 10000
f.connect(ctx.destination)

filter types

lowpass    only values lower
highpass   only values higher
bandpass   only values in range
lowshelf
highshelf
peaking
notch
allpass

envelopes

Envelopes wrap sounds and smear them over time.

attack envelope

Attack envelopes ramp up the value.

const attack = audioContext.createGain()
attack.gain.value = 0
attack.gain.setTargetAtTime(1, startTime, 0.1)

release envelope

release envelopes decrease the value.

const release = audioContext.createGain()
release.gain.setTargetAtTime(0, endTime, 0.2)

Keep in mind when adding a release envelope, the sound needs to keep playing until the release finishes otherwise it will just stop.

// provide enough time for the exponential falloff
oscillator.stop(endTime + 2)

modulating audio parameters

Modules

  • baudio - generate audio streams with functions
  • jsynth - Generate audio/DSP with javascript functions in the browser

Alda - programming music

  • alda manifest & introduction

See Also

  • The science and mathematics of audio
  • making algorithmic music with baudio
  • understanding appregiators
  • web audio school
  • designing with sound
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.