-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
38 lines (27 loc) · 991 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* test
*/
import kick from 'mwesselius/grotehangplek/master/percussion/percussion_samples/bd_oizokick1.wav';
import snare from 'jd-code/groovit/master/SAMPLES/SNAR_13D.WAV';
import hihat from 'pdv/webmpc/master/sounds/r909/909hat.wav';
import guitar from 'zillionk/AirInstruments/master/data/guitarAm.wav';
import Sampler from './index';
var drums = Sampler(8);
drums.tune(0.99);
drums.add('kick', kick);
drums.add('snare', snare);
drums.add('hihat', hihat);
var lead = Sampler(1);
lead.tune(1.1);
lead.add('guitar', guitar);
export function dsp(t){
var out = 0;
if ( (t*2) % 1 === 0 ) drums.play('kick', 1);
if ( (t+2/4) % 1 === 0 ) drums.play('snare', 1, 1.1);
if ( (t*2+2/4) % 1 === 0 ) drums.play('hihat', 0.4, 1.5);
if ( (t/4) % 1 === 0 ) lead.play('guitar', 0.7, 1);
if ( ((t+1/4)/4) % 1 === 0 ) lead.play('guitar', 0.7, 0.4);
if ( ((t+3/4)/4) % 1 === 0 ) lead.play('guitar', 0.7, 2);
out += drums.mix() + lead.mix();
return out;
}