笔记:Chris Lowis: A Brief History of Synthesis with the Web Audio API
Chris Lowis: A Brief History of Synthesis with the Web Audio API 这是一个在JavaScript大会上,一位面向程序员谈论合成器的发展史,并且使用web audio api来进行展示的短小的视频,视频虽然不长,但是却非常好地勾勒了不同类的合成器的发展历史。
创造一个不存在的声音 or 创造和模仿存在的声音
其中提到的源代码都可以访问 github.com/chrislo/synth_history 来获得。
Monophonic Synthesis
Leon Theremin 1928 年 Theremin 特雷门琴
var context = new AudioContext
context.sampleRate
context.destination.maxChannelCount\\
通过audio processing graph来创造声音
Oscillator → Gain → Output
var osc = context.createOscillator()
var volume = context.createGain()
osc.connect(volume)
volume.connect(context.destination)
通过Ramp来推进声音变化
var now = context.currentTime;
osc.frequency.linearRampToValueAtTime(2000, now+2);
var param = volume.gain;
param.linearRampToValueAtTime(0, now+2);
所以作者将Web Audio的frequency与鼠标的pointer做了连接,使得创造出了特雷门琴式的一件乐器。
Addictive Synthesis
需要创造出一个真实的乐器需要有创造泛音列 - richer sound
类似 Hammond Organ 哈蒙德風琴
_.times(10,funciton( ){
var osc = context.createOscillator();
var gain = context.createGain();
osc.connect(gain);
gain.connect(context.destination);
})
Substractive Synthesis
减法合成器 moog synthesizer
var osc = context.createOscillator();
osc.type = "sawtooth";
使用filter
filter = context.createBiquadFilter();
filter.type = "lowpass"
oscillator.connect(filter);
filter.connect(context.destination);
通过LFO去改变频率
lfo = context.createOscillator();
lfo.frequency.value = 0.1;
lfo.type = "triangle";
lfo.connect(filter.frequency);
FM Synthesis
Frequency modulation synthesis (or FM synthesis) is a form of sound synthesis whereby the frequency of a waveform is changed by modulating its frequency with a modulator. 調頻合成
analog 可以进行链接waves
Bob Moog 在Bell Labs 创作computer music
John Channing - frequency modulation synthesis 在斯坦福大学
carrier = context.createOscillator();
modulator = context.createOscillator();
modulator.connect(carrier.frequency;)
carrier.connect(context.destination);
https://tonejs.github.io/docs/14.7.77/FMOscillator 在使用非常简单地方式创造
SEGA MEGA DRive 中使用 entry
FM Synthesis patent of Stanford 在很长一段时间中成为最令人恶心的专利
Sampling Synthesis
录制并且实时地操控,录制真实地键盘音乐
请求load一个文件,并且将其解码为raw bytes
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "arraybuffer";
request.onload = function(){
context.decodeAudioData(request.response, function(buffer)){
...
}
}
创建一个source来进行播放
source = context.createBufferSource();
source.buffer = buffer;
source.loop = true;
source.connect(context.destination);
source.start();
Amen的LOOP 4 - bars loops
大家做的是将他们切成piece然后map to 不同的按键并且创造他们自己的drum loops
Granular Synthesis
grains
windows
clouds of grains
for(var i = 0; i< N; i++){
// Hann window
window_fn = 0.5 * (1-Math.cos(2*Math.PI * i/(N-1)));
windowed_buffer[i] = buffer[i] * window_fn;
}
最后提到了一位最早制造出computer music的贝尔实验室的老前辈 max Matthews
the computer is the universal instrument 通过电子合成器技术,你可以创造世界上任何的声音,而这样的世界的音乐今天就在每个人的浏览器之中。
这边有一个talk Max Mathews & John Chowning - Music Meets the Computer