fix cracks + add tune

This commit is contained in:
Felix Roos 2022-06-18 17:25:36 +02:00
parent 71b6b83ab3
commit 925fb30e05
2 changed files with 43 additions and 7 deletions

View File

@ -82,6 +82,14 @@ Pattern.prototype.out = function () {
o.start(t);
o.stop(t + hap.duration + release);
chain.push(o);
// level down oscillators as they are really loud compared to samples i've tested
const g = ac.createGain();
g.gain.value = 0.5;
chain.push(g);
// TODO: make adsr work with samples without pops
// envelope
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + hap.duration);
chain.push(adsr);
} else {
// load sample
const samples = getLoadedSamples();
@ -111,19 +119,17 @@ Pattern.prototype.out = function () {
}
const src = ac.createBufferSource();
src.buffer = buffer;
let duration = src.buffer.duration;
const offset = begin * duration;
const sus = ((end - begin) * duration) / Math.abs(speed);
src.playbackRate.value = Math.abs(speed);
// TODO: nudge, unit, cut, loop
src.start(t, offset, sus);
let duration = src.buffer.duration;
const offset = begin * duration;
duration = ((end - begin) * duration) / Math.abs(speed);
src.start(t, offset, duration);
src.stop(t + duration);
chain.push(src);
}
}
// envelope
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + hap.duration);
chain.push(adsr);
// filters
cutoff !== undefined && chain.push(getFilter('lowpass', cutoff, resonance));
hcutoff !== undefined && chain.push(getFilter('highpass', hcutoff, hresonance));

View File

@ -865,3 +865,33 @@ export const bornagain = `stack(
.jux(rev)
.out()
.stack(s("bd(3,8),hh*4,~ sd").webdirt())`;
export const meltingsubmarine = `samples({
clubkick: 'clubkick/2.wav',
sd: ['808sd/SD0010.WAV','808sd/SD0050.WAV'],
hh: 'hh/000_hh3closedhh.wav',
clak: 'clak/000_clak1.wav',
jvbass: ['jvbass/000_01.wav','jvbass/001_02.wav','jvbass/003_04.wav','jvbass/004_05.wav','jvbass/005_06.wav']
}, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/');
stack(
"<clubkick*2>,[~ <sd!3 sd(3,4,2)>],hh(3,4)".s().n("<0 1 2>").speed(perlin.range(.7,.9)),
"<a1 b1*2 a1(3,8) e2>"
.off(1/8,x=>x.add(12).degradeBy(.5))
.add(perlin.range(0,.5))
.n().decay(.15).sustain(0).s("sawtooth")
.superimpose(x=>x.add(.08)).gain(.4)
.cutoff(sine.slow(7).range(300,5000)),
"<Am7!3 <Em7 E7b13 Em7 Ebm7b5>>".voicings().superimpose(x=>x.add(.04))
.add(perlin.range(0,.5))
.n().s('sawtooth')
.gain(.16)
.cutoff(500)
.attack(1),
"a4 c5 <e6 a6>".struct("x(5,8)")
.superimpose(x=>x.add(.04))
.add(perlin.range(0,.5)).n()
.decay(.1).sustain(0).s('triangle')
.degradeBy(perlin.range(0,.5)).echoWith(4,.125,(x,n)=>x.gain(.15*1/(n+1)))
)
.out()
.slow(3/2)`;