From 7da75544933d9f5c4b5a20ae7fad611171955e37 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Fri, 15 Dec 2023 11:32:23 -0700 Subject: [PATCH 01/55] it works --- packages/superdough/helpers.mjs | 16 ++++++++++++++++ packages/superdough/sampler.mjs | 5 +++-- packages/superdough/synth.mjs | 11 +++++++++-- src-tauri/src/oscbridge.rs | 4 ++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index d87ea94d..91bc17bc 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -89,6 +89,22 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { return new DynamicsCompressorNode(ac, options); } +const adsrmin = 0.001; +export const getADSRDefaults = ( + a, + d, + s, + r, + def = { attack: adsrmin, decay: adsrmin, sustain: 1, release: adsrmin }, +) => { + console.log(a, d, s, r); + if (a == null && d == null && s == null && r == null) { + return def; + } + const sustain = s ?? ((a != null && d == null) || (a == null && d == null)) ? def.sustain : adsrmin; + return { attack: a ?? adsrmin, decay: d ?? adsrmin, sustain, release: r ?? adsrmin }; +}; + export function createFilter( context, type, diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index 6df5a6b6..e4ead52e 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -1,6 +1,6 @@ import { noteToMidi, valueToMidi, nanFallback } from './util.mjs'; import { getAudioContext, registerSound } from './index.mjs'; -import { getEnvelope } from './helpers.mjs'; +import { getADSRDefaults, getEnvelope } from './helpers.mjs'; import { logger } from './logger.mjs'; const bufferCache = {}; // string: Promise @@ -251,7 +251,8 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { loop = s.startsWith('wt_') ? 1 : value.loop; const ac = getAudioContext(); // destructure adsr here, because the default should be different for synths and samples - const { attack = 0.001, decay = 0.001, sustain = 1, release = 0.001 } = value; + + const { attack, decay, sustain, release } = getADSRDefaults(value.attack, value.decay, value.sustain, value.release); //const soundfont = getSoundfontKey(s); const time = t + nudge; diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index edc3c01e..a715947e 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -1,6 +1,6 @@ import { midiToFreq, noteToMidi } from './util.mjs'; import { registerSound, getAudioContext } from './superdough.mjs'; -import { gainNode, getEnvelope, getExpEnvelope } from './helpers.mjs'; +import { gainNode, getADSRDefaults, getEnvelope, getExpEnvelope } from './helpers.mjs'; import { getNoiseMix, getNoiseOscillator } from './noise.mjs'; const mod = (freq, range = 1, type = 'sine') => { @@ -30,7 +30,14 @@ export function registerSynthSounds() { s, (t, value, onended) => { // destructure adsr here, because the default should be different for synths and samples - let { attack = 0.001, decay = 0.05, sustain = 0.6, release = 0.01 } = value; + const { attack, decay, sustain, release } = getADSRDefaults( + value.attack, + value.decay, + value.sustain, + value.release, + { attack: 0.001, decay: 0.05, sustain: 0.6, release: 0.01 }, + ); + console.log({ attack, decay, sustain, release }); let sound; if (waveforms.includes(s)) { diff --git a/src-tauri/src/oscbridge.rs b/src-tauri/src/oscbridge.rs index 6060cd9d..8148622e 100644 --- a/src-tauri/src/oscbridge.rs +++ b/src-tauri/src/oscbridge.rs @@ -53,8 +53,8 @@ pub fn init( /* ........................................................... Open OSC Ports ............................................................*/ - let sock = UdpSocket::bind("127.0.0.1:57122").unwrap(); - let to_addr = String::from("127.0.0.1:57120"); + let sock = UdpSocket::bind("169.254.248.82:57122").unwrap(); + let to_addr = String::from("169.254.180.239:57120"); sock.set_nonblocking(true).unwrap(); sock.connect(to_addr).expect("could not connect to OSC address"); From 9663c2ec858cc37ede5211d59297b8b849761d84 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Fri, 15 Dec 2023 12:16:28 -0700 Subject: [PATCH 02/55] fileter envelopes --- packages/superdough/helpers.mjs | 19 +++++++---------- packages/superdough/sampler.mjs | 4 ++-- packages/superdough/superdough.mjs | 33 ++++++++++++++++++------------ packages/superdough/synth.mjs | 14 +++++-------- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 91bc17bc..94bdc11f 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -88,21 +88,16 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { }; return new DynamicsCompressorNode(ac, options); } - -const adsrmin = 0.001; -export const getADSRDefaults = ( - a, - d, - s, - r, - def = { attack: adsrmin, decay: adsrmin, sustain: 1, release: adsrmin }, -) => { +const envmin = 0.001; +export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin]) => { + const [a, d, s, r] = params; + const [defA, defD, defS, defR] = defaultValues; console.log(a, d, s, r); if (a == null && d == null && s == null && r == null) { - return def; + return defaultValues; } - const sustain = s ?? ((a != null && d == null) || (a == null && d == null)) ? def.sustain : adsrmin; - return { attack: a ?? adsrmin, decay: d ?? adsrmin, sustain, release: r ?? adsrmin }; + const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? defS : envmin; + return [a ?? envmin, d ?? envmin, sustain, r ?? envmin]; }; export function createFilter( diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index e4ead52e..fb1dfda9 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -1,6 +1,6 @@ import { noteToMidi, valueToMidi, nanFallback } from './util.mjs'; import { getAudioContext, registerSound } from './index.mjs'; -import { getADSRDefaults, getEnvelope } from './helpers.mjs'; +import { getADSRValues, getEnvelope } from './helpers.mjs'; import { logger } from './logger.mjs'; const bufferCache = {}; // string: Promise @@ -252,7 +252,7 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { const ac = getAudioContext(); // destructure adsr here, because the default should be different for synths and samples - const { attack, decay, sustain, release } = getADSRDefaults(value.attack, value.decay, value.sustain, value.release); + const [attack, decay, sustain, release] = getADSRValues([value.attack, value.decay, value.sustain, value.release]); //const soundfont = getSoundfontKey(s); const time = t + nudge; diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 3be97615..036e63ba 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -9,7 +9,7 @@ import './reverb.mjs'; import './vowel.mjs'; import { clamp, nanFallback } from './util.mjs'; import workletsUrl from './worklets.mjs?url'; -import { createFilter, gainNode, getCompressor } from './helpers.mjs'; +import { createFilter, gainNode, getADSRValues, getCompressor } from './helpers.mjs'; import { map } from 'nanostores'; import { logger } from './logger.mjs'; import { loadBuffer } from './sampler.mjs'; @@ -269,26 +269,16 @@ export const superdough = async (value, deadline, hapDuration) => { // low pass cutoff, lpenv, - lpattack = 0.01, - lpdecay = 0.01, - lpsustain = 1, - lprelease = 0.01, resonance = 1, // high pass hpenv, hcutoff, - hpattack = 0.01, - hpdecay = 0.01, - hpsustain = 1, - hprelease = 0.01, + hresonance = 1, // band pass bpenv, bandf, - bpattack = 0.01, - bpdecay = 0.01, - bpsustain = 1, - bprelease = 0.01, + bandq = 1, channels = [1, 2], //phaser @@ -322,6 +312,7 @@ export const superdough = async (value, deadline, hapDuration) => { compressorAttack, compressorRelease, } = value; + gain = nanFallback(gain, 1); //music programs/audio gear usually increments inputs/outputs from 1, so imitate that behavior @@ -366,7 +357,15 @@ export const superdough = async (value, deadline, hapDuration) => { // gain stage chain.push(gainNode(gain)); + const filterEnvDefaults = [0.01, 0.01, 1, 0.01]; + if (cutoff !== undefined) { + const [lpattack, lpdecay, lpsustain, lprelease] = getADSRValues( + [value.lpattack, value.lpdecay, value.lpsustain, value.lprelease], + filterEnvDefaults, + ); + console.log(lpattack, 'atta'); + let lp = () => createFilter( ac, @@ -389,6 +388,10 @@ export const superdough = async (value, deadline, hapDuration) => { } if (hcutoff !== undefined) { + const [hpattack, hpdecay, hpsustain, hprelease] = getADSRValues( + [value.hpattack, value.hpdecay, value.hpsustain, value.hprelease], + filterEnvDefaults, + ); let hp = () => createFilter( ac, @@ -411,6 +414,10 @@ export const superdough = async (value, deadline, hapDuration) => { } if (bandf !== undefined) { + const [bpattack, bpdecay, bpsustain, bprelease] = getADSRValues( + [value.bpattack, value.bpdecay, value.bpsustain, value.bprelease], + filterEnvDefaults, + ); let bp = () => createFilter( ac, diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index a715947e..5977e9ac 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -1,6 +1,6 @@ import { midiToFreq, noteToMidi } from './util.mjs'; import { registerSound, getAudioContext } from './superdough.mjs'; -import { gainNode, getADSRDefaults, getEnvelope, getExpEnvelope } from './helpers.mjs'; +import { gainNode, getADSRValues, getEnvelope, getExpEnvelope } from './helpers.mjs'; import { getNoiseMix, getNoiseOscillator } from './noise.mjs'; const mod = (freq, range = 1, type = 'sine') => { @@ -29,15 +29,11 @@ export function registerSynthSounds() { registerSound( s, (t, value, onended) => { - // destructure adsr here, because the default should be different for synths and samples - const { attack, decay, sustain, release } = getADSRDefaults( - value.attack, - value.decay, - value.sustain, - value.release, - { attack: 0.001, decay: 0.05, sustain: 0.6, release: 0.01 }, + const defaultADSRValues = [0.001, 0.05, 0.6, 0.01]; + const [attack, decay, sustain, release] = getADSRValues( + [value.attack, value.decay, value.sustain, value.release], + defaultADSRValues, ); - console.log({ attack, decay, sustain, release }); let sound; if (waveforms.includes(s)) { From 88f677e9100276597406793a07e271895b6ca3f5 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Fri, 15 Dec 2023 18:54:04 -0500 Subject: [PATCH 03/55] fix envelope behavior --- packages/superdough/helpers.mjs | 2 +- packages/superdough/superdough.mjs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index d75f5b14..d628d851 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -77,7 +77,7 @@ export const getParamADSR = (param, attack, decay, sustain, release, min, max, b param.setValueAtTime(min, begin); param.linearRampToValueAtTime(peak, begin + attack); param.linearRampToValueAtTime(sustainLevel, begin + attack + decay); - param.setValueAtTime(sustainLevel, end); + // param.setValueAtTime(sustainLevel, end); param.linearRampToValueAtTime(min, end + Math.max(release, 0.1)); }; diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 036e63ba..9a35c277 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -364,7 +364,6 @@ export const superdough = async (value, deadline, hapDuration) => { [value.lpattack, value.lpdecay, value.lpsustain, value.lprelease], filterEnvDefaults, ); - console.log(lpattack, 'atta'); let lp = () => createFilter( From 96e0cce2d267d797e10f68d9d254d7325de0ed46 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Sat, 16 Dec 2023 00:30:35 -0500 Subject: [PATCH 04/55] improve response --- packages/superdough/helpers.mjs | 34 ++++++++++++------------------ packages/superdough/superdough.mjs | 31 ++++++++++++--------------- 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index d628d851..1bc1a878 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -71,14 +71,17 @@ export const getADSR = (attack, decay, sustain, release, velocity, begin, end) = }; export const getParamADSR = (param, attack, decay, sustain, release, min, max, begin, end) => { + // let phase = begin; const range = max - min; const peak = min + range; const sustainLevel = min + sustain * range; param.setValueAtTime(min, begin); - param.linearRampToValueAtTime(peak, begin + attack); - param.linearRampToValueAtTime(sustainLevel, begin + attack + decay); - // param.setValueAtTime(sustainLevel, end); - param.linearRampToValueAtTime(min, end + Math.max(release, 0.1)); + param.exponentialRampToValueAtTime(peak, begin + attack); + param.exponentialRampToValueAtTime(sustainLevel, begin + attack + decay); + //stop current envelope ramp at event end, and begin release ramp + console.log(param); + param.cancelAndHoldAtTime(end); + param.exponentialRampToValueAtTime(min, end + Math.max(release, 0.1)); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { @@ -91,11 +94,14 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { }; return new DynamicsCompressorNode(ac, options); } + +// changes the default values of the envelope based on what parameters the user has defined +// so it behaves more like you would expect/familiar as other synthesis tools +// ex: sound(val).decay(val) will behave as a decay only envelope. sound(val).attack(val).decay(val) will behave like an "ad" env, etc. const envmin = 0.001; export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin]) => { const [a, d, s, r] = params; const [defA, defD, defS, defR] = defaultValues; - console.log(a, d, s, r); if (a == null && d == null && s == null && r == null) { return defaultValues; } @@ -103,20 +109,8 @@ export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin return [a ?? envmin, d ?? envmin, sustain, r ?? envmin]; }; -export function createFilter( - context, - type, - frequency, - Q, - attack, - decay, - sustain, - release, - fenv, - start, - end, - fanchor = 0.5, -) { +export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { + const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.01, 0.01, 1, 0.01]); const filter = context.createBiquadFilter(); filter.type = type; filter.Q.value = Q; @@ -129,8 +123,6 @@ export function createFilter( const min = clamp(2 ** -offset * frequency, 0, 20000); const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - // console.log('min', min, 'max', max); - getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end); return filter; } diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 9a35c277..b4c16a53 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -9,7 +9,7 @@ import './reverb.mjs'; import './vowel.mjs'; import { clamp, nanFallback } from './util.mjs'; import workletsUrl from './worklets.mjs?url'; -import { createFilter, gainNode, getADSRValues, getCompressor } from './helpers.mjs'; +import { createFilter, gainNode, getCompressor } from './helpers.mjs'; import { map } from 'nanostores'; import { logger } from './logger.mjs'; import { loadBuffer } from './sampler.mjs'; @@ -269,16 +269,26 @@ export const superdough = async (value, deadline, hapDuration) => { // low pass cutoff, lpenv, + lpattack, + lpdecay, + lpsustain, + lprelease, resonance = 1, // high pass hpenv, hcutoff, - + hpattack, + hpdecay, + hpsustain, + hprelease, hresonance = 1, // band pass bpenv, bandf, - + bpattack, + bpdecay, + bpsustain, + bprelease, bandq = 1, channels = [1, 2], //phaser @@ -357,14 +367,7 @@ export const superdough = async (value, deadline, hapDuration) => { // gain stage chain.push(gainNode(gain)); - const filterEnvDefaults = [0.01, 0.01, 1, 0.01]; - if (cutoff !== undefined) { - const [lpattack, lpdecay, lpsustain, lprelease] = getADSRValues( - [value.lpattack, value.lpdecay, value.lpsustain, value.lprelease], - filterEnvDefaults, - ); - let lp = () => createFilter( ac, @@ -387,10 +390,6 @@ export const superdough = async (value, deadline, hapDuration) => { } if (hcutoff !== undefined) { - const [hpattack, hpdecay, hpsustain, hprelease] = getADSRValues( - [value.hpattack, value.hpdecay, value.hpsustain, value.hprelease], - filterEnvDefaults, - ); let hp = () => createFilter( ac, @@ -413,10 +412,6 @@ export const superdough = async (value, deadline, hapDuration) => { } if (bandf !== undefined) { - const [bpattack, bpdecay, bpsustain, bprelease] = getADSRValues( - [value.bpattack, value.bpdecay, value.bpsustain, value.bprelease], - filterEnvDefaults, - ); let bp = () => createFilter( ac, From 93a4efcf6d0ac943298d118de56a0203928c3003 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Sat, 16 Dec 2023 13:21:23 -0500 Subject: [PATCH 05/55] updated fontloader --- packages/soundfonts/fontloader.mjs | 12 +++++++-- packages/superdough/helpers.mjs | 43 +++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/packages/soundfonts/fontloader.mjs b/packages/soundfonts/fontloader.mjs index 017ba763..b6c8c8b4 100644 --- a/packages/soundfonts/fontloader.mjs +++ b/packages/soundfonts/fontloader.mjs @@ -1,5 +1,5 @@ import { noteToMidi, freqToMidi } from '@strudel.cycles/core'; -import { getAudioContext, registerSound, getEnvelope } from '@strudel.cycles/webaudio'; +import { getAudioContext, registerSound, getEnvelope, getADSRValues } from '@strudel.cycles/webaudio'; import gm from './gm.mjs'; let loadCache = {}; @@ -131,7 +131,15 @@ export function registerSoundfonts() { name, async (time, value, onended) => { const { n = 0 } = value; - const { attack = 0.001, decay = 0.001, sustain = 1, release = 0.001 } = value; + const [attack, decay, sustain, release] = getADSRValues([ + value.attack, + value.decay, + value.sustain, + value.release, + ]); + + console.log(attack, decay, sustain, release); + const font = fonts[n % fonts.length]; const ctx = getAudioContext(); const bufferSource = await getFontBufferSource(font, value, ctx); diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 1bc1a878..e8c695b8 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -70,18 +70,41 @@ export const getADSR = (attack, decay, sustain, release, velocity, begin, end) = return gainNode; }; -export const getParamADSR = (param, attack, decay, sustain, release, min, max, begin, end) => { - // let phase = begin; +export const getParamADSR = ( + context, + param, + attack, + decay, + sustain, + release, + min, + max, + begin, + end, + //exponential works better for frequency modulations (such as filter cutoff) due to human ear perception + curve = 'exponential', +) => { + const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; + let phase = begin; const range = max - min; const peak = min + range; - const sustainLevel = min + sustain * range; + param.setValueAtTime(min, begin); - param.exponentialRampToValueAtTime(peak, begin + attack); - param.exponentialRampToValueAtTime(sustainLevel, begin + attack + decay); - //stop current envelope ramp at event end, and begin release ramp - console.log(param); - param.cancelAndHoldAtTime(end); - param.exponentialRampToValueAtTime(min, end + Math.max(release, 0.1)); + phase += attack; + //attack + param[ramp](peak, phase); + phase += decay; + const sustainLevel = min + sustain * range; + //decay + param[ramp](sustainLevel, phase); + //this timeout can be replaced with cancelAndHoldAtTime once it is implemented in Firefox + setTimeout(() => { + //sustain at current value + param.cancelScheduledValues(0); + phase += Math.max(release, 0.1); + //release + param[ramp](min, phase); + }, (end - context.currentTime) * 1000); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { @@ -123,7 +146,7 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe const min = clamp(2 ** -offset * frequency, 0, 20000); const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end); + getParamADSR(context, filter.frequency, attack, decay, sustain, release, min, max, start, end); return filter; } From b5dc65d52a1a2550011beb5cb84419aff38135d1 Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Sat, 16 Dec 2023 13:36:05 -0500 Subject: [PATCH 06/55] format --- packages/soundfonts/fontloader.mjs | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/soundfonts/fontloader.mjs b/packages/soundfonts/fontloader.mjs index b6c8c8b4..f8b10d38 100644 --- a/packages/soundfonts/fontloader.mjs +++ b/packages/soundfonts/fontloader.mjs @@ -137,9 +137,6 @@ export function registerSoundfonts() { value.sustain, value.release, ]); - - console.log(attack, decay, sustain, release); - const font = fonts[n % fonts.length]; const ctx = getAudioContext(); const bufferSource = await getFontBufferSource(font, value, ctx); From fe60f3401510fa7a51cfcd424989448d7e4bafed Mon Sep 17 00:00:00 2001 From: Jade Rowland Date: Sun, 17 Dec 2023 12:13:05 -0500 Subject: [PATCH 07/55] removed accidental file commit --- src-tauri/src/oscbridge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/oscbridge.rs b/src-tauri/src/oscbridge.rs index 8148622e..6060cd9d 100644 --- a/src-tauri/src/oscbridge.rs +++ b/src-tauri/src/oscbridge.rs @@ -53,8 +53,8 @@ pub fn init( /* ........................................................... Open OSC Ports ............................................................*/ - let sock = UdpSocket::bind("169.254.248.82:57122").unwrap(); - let to_addr = String::from("169.254.180.239:57120"); + let sock = UdpSocket::bind("127.0.0.1:57122").unwrap(); + let to_addr = String::from("127.0.0.1:57120"); sock.set_nonblocking(true).unwrap(); sock.connect(to_addr).expect("could not connect to OSC address"); From d7fae2620e2ce87b01079537bc45a195e4f0a3c5 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 00:21:14 -0500 Subject: [PATCH 08/55] create release audio param method, make volume envelopes consistant --- packages/superdough/helpers.mjs | 42 +++++++++++++++++++++------------ packages/superdough/synth.mjs | 2 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index e8c695b8..011feb25 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -1,6 +1,27 @@ import { getAudioContext } from './superdough.mjs'; import { clamp } from './util.mjs'; +AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') { + const ctx = getAudioContext(); + const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; + const param = this; + if (AudioParam.prototype.cancelAndHoldAtTime == null) { + //this replicates cancelAndHoldAtTime behavior for Firefox + setTimeout(() => { + //sustain at current value + const currValue = param.value; + param.cancelScheduledValues(0); + param.setValueAtTime(currValue, 0); + //release + param[ramp](endValue, endTime); + }, (startTime - ctx.currentTime) * 1000); + } else { + param.cancelAndHoldAtTime(startTime); + //release + param[ramp](endValue, endTime); + } +}; + export function gainNode(value) { const node = getAudioContext().createGain(); node.gain.value = value; @@ -21,13 +42,10 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => return { node: gainNode, stop: (t) => { - // to make sure the release won't begin before sustain is reached - phase = Math.max(t, phase); - // see https://github.com/tidalcycles/strudel/issues/522 - gainNode.gain.setValueAtTime(sustainLevel, phase); - phase += release; - gainNode.gain.linearRampToValueAtTime(0, phase); // release - return phase; + const endTime = t + release; + gainNode.gain.setRelease(t, endTime, 0); + // helps prevent pops from overlapping sounds + return endTime - 0.01; }, }; }; @@ -97,14 +115,8 @@ export const getParamADSR = ( const sustainLevel = min + sustain * range; //decay param[ramp](sustainLevel, phase); - //this timeout can be replaced with cancelAndHoldAtTime once it is implemented in Firefox - setTimeout(() => { - //sustain at current value - param.cancelScheduledValues(0); - phase += Math.max(release, 0.1); - //release - param[ramp](min, phase); - }, (end - context.currentTime) * 1000); + phase += Math.max(release, 0.1); + param.setRelease(end, phase, min, curve); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 74255dbf..3d93b8cd 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -42,7 +42,7 @@ export function registerSynthSounds() { let { density } = value; sound = getNoiseOscillator(s, t, density); } - + console.log(sound); let { node: o, stop, triggerRelease } = sound; // turn down From 34ba81a84119b557f5b8e8eeb6ece9da7ef277a4 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 00:25:56 -0500 Subject: [PATCH 09/55] fixed test complaint --- packages/superdough/helpers.mjs | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 011feb25..a9d5a05a 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -1,26 +1,28 @@ import { getAudioContext } from './superdough.mjs'; import { clamp } from './util.mjs'; -AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') { - const ctx = getAudioContext(); - const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; - const param = this; - if (AudioParam.prototype.cancelAndHoldAtTime == null) { - //this replicates cancelAndHoldAtTime behavior for Firefox - setTimeout(() => { - //sustain at current value - const currValue = param.value; - param.cancelScheduledValues(0); - param.setValueAtTime(currValue, 0); +if (AudioParam != null) { + AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') { + const ctx = getAudioContext(); + const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; + const param = this; + if (AudioParam.prototype.cancelAndHoldAtTime == null) { + //this replicates cancelAndHoldAtTime behavior for Firefox + setTimeout(() => { + //sustain at current value + const currValue = param.value; + param.cancelScheduledValues(0); + param.setValueAtTime(currValue, 0); + //release + param[ramp](endValue, endTime); + }, (startTime - ctx.currentTime) * 1000); + } else { + param.cancelAndHoldAtTime(startTime); //release param[ramp](endValue, endTime); - }, (startTime - ctx.currentTime) * 1000); - } else { - param.cancelAndHoldAtTime(startTime); - //release - param[ramp](endValue, endTime); - } -}; + } + }; +} export function gainNode(value) { const node = getAudioContext().createGain(); From f6d9ad51c62bc478bc2947509afcc0e064e8a489 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 01:44:34 -0500 Subject: [PATCH 10/55] trying to fix divergent firefox behavior --- packages/superdough/helpers.mjs | 56 ++++++++++++++++----------------- packages/superdough/synth.mjs | 5 +-- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index a9d5a05a..bcc92cdd 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -1,28 +1,25 @@ import { getAudioContext } from './superdough.mjs'; import { clamp } from './util.mjs'; -if (AudioParam != null) { - AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') { - const ctx = getAudioContext(); - const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; - const param = this; - if (AudioParam.prototype.cancelAndHoldAtTime == null) { - //this replicates cancelAndHoldAtTime behavior for Firefox - setTimeout(() => { - //sustain at current value - const currValue = param.value; - param.cancelScheduledValues(0); - param.setValueAtTime(currValue, 0); - //release - param[ramp](endValue, endTime); - }, (startTime - ctx.currentTime) * 1000); - } else { - param.cancelAndHoldAtTime(startTime); +const setRelease = (param, startTime, endTime, endValue, curve = 'linear') => { + const ctx = getAudioContext(); + const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; + if (param.cancelAndHoldAtTime == null) { + //this replicates cancelAndHoldAtTime behavior for Firefox + setTimeout(() => { + //sustain at current value + const currValue = param.value; + param.cancelScheduledValues(0); + param.setValueAtTime(currValue, 0); //release param[ramp](endValue, endTime); - } - }; -} + }, (startTime - ctx.currentTime) * 1000); + } else { + param.cancelAndHoldAtTime(startTime); + //release + param[ramp](endValue, endTime); + } +}; export function gainNode(value) { const node = getAudioContext().createGain(); @@ -45,9 +42,9 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => node: gainNode, stop: (t) => { const endTime = t + release; - gainNode.gain.setRelease(t, endTime, 0); + setRelease(gainNode.gain, t, endTime, 0); // helps prevent pops from overlapping sounds - return endTime - 0.01; + return endTime; }, }; }; @@ -117,8 +114,8 @@ export const getParamADSR = ( const sustainLevel = min + sustain * range; //decay param[ramp](sustainLevel, phase); - phase += Math.max(release, 0.1); - param.setRelease(end, phase, min, curve); + phase += release; + setRelease(param, end, phase, min, curve); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { @@ -135,19 +132,20 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { // changes the default values of the envelope based on what parameters the user has defined // so it behaves more like you would expect/familiar as other synthesis tools // ex: sound(val).decay(val) will behave as a decay only envelope. sound(val).attack(val).decay(val) will behave like an "ad" env, etc. -const envmin = 0.001; -export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin]) => { + +export const getADSRValues = (params, defaultValues, min = 0, max = 1) => { + defaultValues = defaultValues ?? [min, min, max, min]; const [a, d, s, r] = params; const [defA, defD, defS, defR] = defaultValues; if (a == null && d == null && s == null && r == null) { return defaultValues; } - const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? defS : envmin; - return [a ?? envmin, d ?? envmin, sustain, r ?? envmin]; + const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? max : min; + return [a ?? min, d ?? min, sustain, r ?? min]; }; export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { - const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.01, 0.01, 1, 0.01]); + const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.001, 0.1, 1, 0.01], 0.001, 1); const filter = context.createBiquadFilter(); filter.type = type; filter.Q.value = Q; diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 3d93b8cd..fcf63893 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -29,10 +29,12 @@ export function registerSynthSounds() { registerSound( s, (t, value, onended) => { - const defaultADSRValues = [0.001, 0.05, 0.6, 0.01]; + const defaultADSRValues = [0.001, 0.1, 0.6, 0.01]; const [attack, decay, sustain, release] = getADSRValues( [value.attack, value.decay, value.sustain, value.release], defaultADSRValues, + 0, + 0.6, ); let sound; @@ -42,7 +44,6 @@ export function registerSynthSounds() { let { density } = value; sound = getNoiseOscillator(s, t, density); } - console.log(sound); let { node: o, stop, triggerRelease } = sound; // turn down From 30e402b9f14c47324d2ce80d09174e6be39ffb91 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 01:52:43 -0500 Subject: [PATCH 11/55] fixed release bug --- packages/superdough/helpers.mjs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index bcc92cdd..17999529 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -114,8 +114,8 @@ export const getParamADSR = ( const sustainLevel = min + sustain * range; //decay param[ramp](sustainLevel, phase); - phase += release; - setRelease(param, end, phase, min, curve); + + setRelease(param, end, end + release, min, curve); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { @@ -132,20 +132,19 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { // changes the default values of the envelope based on what parameters the user has defined // so it behaves more like you would expect/familiar as other synthesis tools // ex: sound(val).decay(val) will behave as a decay only envelope. sound(val).attack(val).decay(val) will behave like an "ad" env, etc. - -export const getADSRValues = (params, defaultValues, min = 0, max = 1) => { - defaultValues = defaultValues ?? [min, min, max, min]; +const envmin = 0.001; +export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin]) => { const [a, d, s, r] = params; const [defA, defD, defS, defR] = defaultValues; if (a == null && d == null && s == null && r == null) { return defaultValues; } - const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? max : min; - return [a ?? min, d ?? min, sustain, r ?? min]; + const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? defS : envmin; + return [a ?? envmin, d ?? envmin, sustain, r ?? envmin]; }; export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { - const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.001, 0.1, 1, 0.01], 0.001, 1); + const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.01, 0.01, 1, 0.01]); const filter = context.createBiquadFilter(); filter.type = type; filter.Q.value = Q; From e0a7fb8290fe31000895006f464137f7ea3939ce Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 09:28:40 -0500 Subject: [PATCH 12/55] filter should decay to set frequency --- packages/superdough/helpers.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 17999529..451412d5 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -157,7 +157,7 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe const min = clamp(2 ** -offset * frequency, 0, 20000); const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - getParamADSR(context, filter.frequency, attack, decay, sustain, release, min, max, start, end); + getParamADSR(context, filter.frequency, attack, decay, sustain, release, frequency, max, start, end); return filter; } From 2dea3911ba18256043db39868e87d29767905344 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 09:29:07 -0500 Subject: [PATCH 13/55] remove unused variable --- packages/superdough/helpers.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 451412d5..a2329cda 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -154,7 +154,6 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe if (!isNaN(fenv) && fenv !== 0) { const offset = fenv * fanchor; - const min = clamp(2 ** -offset * frequency, 0, 20000); const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); getParamADSR(context, filter.frequency, attack, decay, sustain, release, frequency, max, start, end); From deb973afa5dfd85d7d3ec935903c1bd7b5a073f2 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 10:17:12 -0500 Subject: [PATCH 14/55] fixed hold behavior --- packages/superdough/helpers.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index a2329cda..9ef0a113 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -16,6 +16,7 @@ const setRelease = (param, startTime, endTime, endValue, curve = 'linear') => { }, (startTime - ctx.currentTime) * 1000); } else { param.cancelAndHoldAtTime(startTime); + param.setValueAtTime(param.value, startTime); //release param[ramp](endValue, endTime); } @@ -146,6 +147,7 @@ export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.01, 0.01, 1, 0.01]); const filter = context.createBiquadFilter(); + filter.type = type; filter.Q.value = Q; filter.frequency.value = frequency; From fb81f6f268debc3374dfead211ef3cae5c45ed95 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 10:50:06 -0500 Subject: [PATCH 15/55] still working on popping issue with firefox --- packages/superdough/helpers.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 9ef0a113..d6e397c6 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -1,7 +1,7 @@ import { getAudioContext } from './superdough.mjs'; import { clamp } from './util.mjs'; -const setRelease = (param, startTime, endTime, endValue, curve = 'linear') => { +const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = 'linear') => { const ctx = getAudioContext(); const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; if (param.cancelAndHoldAtTime == null) { @@ -15,9 +15,10 @@ const setRelease = (param, startTime, endTime, endValue, curve = 'linear') => { param[ramp](endValue, endTime); }, (startTime - ctx.currentTime) * 1000); } else { + if (phase < startTime) { + param.setValueAtTime(sustain, startTime); + } param.cancelAndHoldAtTime(startTime); - param.setValueAtTime(param.value, startTime); - //release param[ramp](endValue, endTime); } }; @@ -43,7 +44,7 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => node: gainNode, stop: (t) => { const endTime = t + release; - setRelease(gainNode.gain, t, endTime, 0); + setRelease(gainNode.gain, phase, sustain, t, endTime, 0); // helps prevent pops from overlapping sounds return endTime; }, @@ -113,10 +114,11 @@ export const getParamADSR = ( param[ramp](peak, phase); phase += decay; const sustainLevel = min + sustain * range; + //decay param[ramp](sustainLevel, phase); - setRelease(param, end, end + release, min, curve); + setRelease(param, phase, sustain, end, end + release, min, curve); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { From dec039ead3dccd68f343418ac81891798d728160 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 13:09:04 -0500 Subject: [PATCH 16/55] fixed filter envelope popping... --- packages/superdough/helpers.mjs | 44 +++++++++------------------------ packages/superdough/synth.mjs | 13 +++++----- 2 files changed, 18 insertions(+), 39 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index d6e397c6..51361e79 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -67,30 +67,7 @@ export const getExpEnvelope = (attack, decay, sustain, release, velocity, begin) }; }; -export const getADSR = (attack, decay, sustain, release, velocity, begin, end) => { - const gainNode = getAudioContext().createGain(); - gainNode.gain.setValueAtTime(0, begin); - gainNode.gain.linearRampToValueAtTime(velocity, begin + attack); // attack - gainNode.gain.linearRampToValueAtTime(sustain * velocity, begin + attack + decay); // sustain start - gainNode.gain.setValueAtTime(sustain * velocity, end); // sustain end - gainNode.gain.linearRampToValueAtTime(0, end + release); // release - // for some reason, using exponential ramping creates little cracklings - /* let t = begin; - gainNode.gain.setValueAtTime(0, t); - gainNode.gain.exponentialRampToValueAtTime(velocity, (t += attack)); - const sustainGain = Math.max(sustain * velocity, 0.001); - gainNode.gain.exponentialRampToValueAtTime(sustainGain, (t += decay)); - if (end - begin < attack + decay) { - gainNode.gain.cancelAndHoldAtTime(end); - } else { - gainNode.gain.setValueAtTime(sustainGain, end); - } - gainNode.gain.exponentialRampToValueAtTime(0.001, end + release); // release */ - return gainNode; -}; - export const getParamADSR = ( - context, param, attack, decay, @@ -118,7 +95,7 @@ export const getParamADSR = ( //decay param[ramp](sustainLevel, phase); - setRelease(param, phase, sustain, end, end + release, min, curve); + setRelease(param, phase, sustainLevel, end, end + release, min, curve); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { @@ -135,19 +112,22 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { // changes the default values of the envelope based on what parameters the user has defined // so it behaves more like you would expect/familiar as other synthesis tools // ex: sound(val).decay(val) will behave as a decay only envelope. sound(val).attack(val).decay(val) will behave like an "ad" env, etc. -const envmin = 0.001; -export const getADSRValues = (params, defaultValues = [envmin, envmin, 1, envmin]) => { + +export const getADSRValues = (params, curve = 'linear', defaultValues) => { + const envmin = curve === 'exponential' ? 0.001 : 0; + const releaseMin = 0.01; + const envmax = 1; const [a, d, s, r] = params; - const [defA, defD, defS, defR] = defaultValues; if (a == null && d == null && s == null && r == null) { - return defaultValues; + return defaultValues ?? [envmin, envmin, envmax, releaseMin]; } - const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? defS : envmin; - return [a ?? envmin, d ?? envmin, sustain, r ?? envmin]; + const sustain = s != null ? s : (a != null && d == null) || (a == null && d == null) ? envmax : envmin; + return [Math.max(a ?? 0, envmin), Math.max(d ?? 0, envmin), Math.min(sustain, envmax), Math.max(r ?? 0, releaseMin)]; }; export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { - const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], [0.01, 0.01, 1, 0.01]); + const curve = 'exponential'; + const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], curve, [0.005, 0.14, 0, 0.1]); const filter = context.createBiquadFilter(); filter.type = type; @@ -160,7 +140,7 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - getParamADSR(context, filter.frequency, attack, decay, sustain, release, frequency, max, start, end); + getParamADSR(filter.frequency, attack, decay, sustain, release, frequency, max, start, end, curve); return filter; } diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index fcf63893..09c8163b 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -29,13 +29,12 @@ export function registerSynthSounds() { registerSound( s, (t, value, onended) => { - const defaultADSRValues = [0.001, 0.1, 0.6, 0.01]; - const [attack, decay, sustain, release] = getADSRValues( - [value.attack, value.decay, value.sustain, value.release], - defaultADSRValues, - 0, - 0.6, - ); + const [attack, decay, sustain, release] = getADSRValues([ + value.attack, + value.decay, + value.sustain, + value.release, + ]); let sound; if (waveforms.includes(s)) { From 5671b40707b86f9e9be5d0eb319a2bcbe2e0e4de Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 15:24:14 -0500 Subject: [PATCH 17/55] account for phase complete --- packages/superdough/helpers.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 51361e79..b5c01b08 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -4,7 +4,11 @@ import { clamp } from './util.mjs'; const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = 'linear') => { const ctx = getAudioContext(); const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; - if (param.cancelAndHoldAtTime == null) { + // if the decay stage is complete before the note event is done, we don't need to do anything special + if (phase < startTime) { + param.setValueAtTime(sustain, startTime); + param[ramp](endValue, endTime); + } else if (param.cancelAndHoldAtTime == null) { //this replicates cancelAndHoldAtTime behavior for Firefox setTimeout(() => { //sustain at current value @@ -15,9 +19,7 @@ const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = param[ramp](endValue, endTime); }, (startTime - ctx.currentTime) * 1000); } else { - if (phase < startTime) { - param.setValueAtTime(sustain, startTime); - } + //stop the envelope, hold the value, and then set the release stage param.cancelAndHoldAtTime(startTime); param[ramp](endValue, endTime); } From 77fee0b8661dfbee9565ed35d6aa9002d02115be Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 20 Dec 2023 17:39:11 -0500 Subject: [PATCH 18/55] fixed popping on font envelope --- packages/superdough/helpers.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index b5c01b08..8b7d9631 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -46,7 +46,7 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => node: gainNode, stop: (t) => { const endTime = t + release; - setRelease(gainNode.gain, phase, sustain, t, endTime, 0); + setRelease(gainNode.gain, phase, sustainLevel, t, endTime, 0); // helps prevent pops from overlapping sounds return endTime; }, From 9756d63cf114742c5cf51f2817dc363c89e15cc5 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 31 Dec 2023 11:58:06 -0500 Subject: [PATCH 19/55] prettier --- packages/soundfonts/fontloader.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/soundfonts/fontloader.mjs b/packages/soundfonts/fontloader.mjs index a986481f..683c249b 100644 --- a/packages/soundfonts/fontloader.mjs +++ b/packages/soundfonts/fontloader.mjs @@ -1,4 +1,3 @@ - import { noteToMidi, freqToMidi, getSoundIndex } from '@strudel.cycles/core'; import { getAudioContext, registerSound, getEnvelope, getADSRValues } from '@strudel.cycles/webaudio'; import gm from './gm.mjs'; From 83c820a18c92b4dbc430ed978c4876584b57d348 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Mon, 1 Jan 2024 18:50:23 -0500 Subject: [PATCH 20/55] prettier again --- packages/superdough/helpers.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 8b7d9631..68e88e87 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -15,6 +15,7 @@ const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = const currValue = param.value; param.cancelScheduledValues(0); param.setValueAtTime(currValue, 0); + //release param[ramp](endValue, endTime); }, (startTime - ctx.currentTime) * 1000); @@ -89,6 +90,7 @@ export const getParamADSR = ( param.setValueAtTime(min, begin); phase += attack; + //attack param[ramp](peak, phase); phase += decay; @@ -139,13 +141,10 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe // Apply ADSR to filter frequency if (!isNaN(fenv) && fenv !== 0) { const offset = fenv * fanchor; - const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - getParamADSR(filter.frequency, attack, decay, sustain, release, frequency, max, start, end, curve); return filter; } - return filter; } From d582bbbb601c4b7e4fe0ecc8969be634504d64da Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 3 Jan 2024 22:17:11 +0100 Subject: [PATCH 21/55] fix: format --- packages/superdough/helpers.mjs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 68e88e87..7544ab7f 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -10,15 +10,18 @@ const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = param[ramp](endValue, endTime); } else if (param.cancelAndHoldAtTime == null) { //this replicates cancelAndHoldAtTime behavior for Firefox - setTimeout(() => { - //sustain at current value - const currValue = param.value; - param.cancelScheduledValues(0); - param.setValueAtTime(currValue, 0); + setTimeout( + () => { + //sustain at current value + const currValue = param.value; + param.cancelScheduledValues(0); + param.setValueAtTime(currValue, 0); - //release - param[ramp](endValue, endTime); - }, (startTime - ctx.currentTime) * 1000); + //release + param[ramp](endValue, endTime); + }, + (startTime - ctx.currentTime) * 1000, + ); } else { //stop the envelope, hold the value, and then set the release stage param.cancelAndHoldAtTime(startTime); From 2ecc6b30aa3829c73660f9ae4a3d0500489685fc Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 3 Jan 2024 22:37:35 +0100 Subject: [PATCH 22/55] add ad function --- packages/core/controls.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index d979ff23..5bb0a37f 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -1394,6 +1394,11 @@ controls.adsr = register('adsr', (adsr, pat) => { const [attack, decay, sustain, release] = adsr; return pat.set({ attack, decay, sustain, release }); }); +controls.ad = register('ad', (t, pat) => { + t = !Array.isArray(t) ? [t] : t; + const [attack, decay = attack] = t; + return pat.attack(attack).decay(decay); +}); controls.ds = register('ds', (ds, pat) => { ds = !Array.isArray(ds) ? [ds] : ds; const [decay, sustain] = ds; From 041a809b07106765edf83cbd9e3223bc0af0b325 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 3 Jan 2024 22:41:03 +0100 Subject: [PATCH 23/55] add ar function --- packages/core/controls.mjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 5bb0a37f..993f1c1d 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -1399,10 +1399,15 @@ controls.ad = register('ad', (t, pat) => { const [attack, decay = attack] = t; return pat.attack(attack).decay(decay); }); -controls.ds = register('ds', (ds, pat) => { - ds = !Array.isArray(ds) ? [ds] : ds; - const [decay, sustain] = ds; +controls.ds = register('ds', (t, pat) => { + t = !Array.isArray(t) ? [t] : t; + const [decay, sustain = 0] = t; return pat.set({ decay, sustain }); }); +controls.ds = register('ar', (t, pat) => { + t = !Array.isArray(t) ? [t] : t; + const [attack, release = attack] = t; + return pat.set({ attack, release }); +}); export default controls; From a2974099c1932961cac391ae2341fe7ef2ed2776 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 3 Jan 2024 23:06:23 +0100 Subject: [PATCH 24/55] add dec synonym for decay --- packages/core/controls.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 993f1c1d..60372522 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -234,7 +234,7 @@ const generic_params = [ * note("c3 e3").decay("<.1 .2 .3 .4>").sustain(0) * */ - ['decay'], + ['decay', 'dec'], /** * Amplitude envelope sustain level: The level which is reached after attack / decay, being sustained until the offset. * From 2ee392be9b28ccdc9f65d5ffd18f9e90536aba0f Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Fri, 5 Jan 2024 01:00:22 -0500 Subject: [PATCH 25/55] fixed all the things --- packages/core/util.mjs | 2 +- packages/soundfonts/fontloader.mjs | 22 +++-- packages/superdough/helpers.mjs | 121 ++++++++++----------------- packages/superdough/sampler.mjs | 31 ++++--- packages/superdough/synth.mjs | 61 +++++++++----- packages/superdough/util.mjs | 2 +- website/src/repl/panel/SoundsTab.jsx | 56 +++++++------ 7 files changed, 145 insertions(+), 150 deletions(-) diff --git a/packages/core/util.mjs b/packages/core/util.mjs index 6c0439b6..ef55de95 100644 --- a/packages/core/util.mjs +++ b/packages/core/util.mjs @@ -86,7 +86,7 @@ export const midi2note = (n) => { // modulo that works with negative numbers e.g. _mod(-1, 3) = 2. Works on numbers (rather than patterns of numbers, as @mod@ from pattern.mjs does) export const _mod = (n, m) => ((n % m) + m) % m; -export function nanFallback(value, fallback) { +export function nanFallback(value, fallback = 0) { if (isNaN(Number(value))) { logger(`"${value}" is not a number, falling back to ${fallback}`, 'warning'); return fallback; diff --git a/packages/soundfonts/fontloader.mjs b/packages/soundfonts/fontloader.mjs index 683c249b..8d8fb02b 100644 --- a/packages/soundfonts/fontloader.mjs +++ b/packages/soundfonts/fontloader.mjs @@ -1,5 +1,5 @@ import { noteToMidi, freqToMidi, getSoundIndex } from '@strudel.cycles/core'; -import { getAudioContext, registerSound, getEnvelope, getADSRValues } from '@strudel.cycles/webaudio'; +import { getAudioContext, registerSound, getParamADSR, getADSRValues } from '@strudel.cycles/webaudio'; import gm from './gm.mjs'; let loadCache = {}; @@ -136,23 +136,27 @@ export function registerSoundfonts() { value.sustain, value.release, ]); + + const { duration } = value; const n = getSoundIndex(value.n, fonts.length); const font = fonts[n]; const ctx = getAudioContext(); const bufferSource = await getFontBufferSource(font, value, ctx); bufferSource.start(time); - const { node: envelope, stop: releaseEnvelope } = getEnvelope(attack, decay, sustain, release, 0.3, time); - bufferSource.connect(envelope); - const stop = (releaseTime) => { - const silentAt = releaseEnvelope(releaseTime); - bufferSource.stop(silentAt); - }; + const envGain = ctx.createGain(); + const node = bufferSource.connect(envGain); + const holdEnd = time + duration; + getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, time, holdEnd, 'linear'); + let envEnd = holdEnd + release + 0.01; + + bufferSource.stop(envEnd); + const stop = (releaseTime) => {}; bufferSource.onended = () => { bufferSource.disconnect(); - envelope.disconnect(); + node.disconnect(); onended(); }; - return { node: envelope, stop }; + return { node, stop }; }, { type: 'soundfont', prebake: true, fonts }, ); diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 7544ab7f..ac22fc7c 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -1,33 +1,5 @@ import { getAudioContext } from './superdough.mjs'; -import { clamp } from './util.mjs'; - -const setRelease = (param, phase, sustain, startTime, endTime, endValue, curve = 'linear') => { - const ctx = getAudioContext(); - const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; - // if the decay stage is complete before the note event is done, we don't need to do anything special - if (phase < startTime) { - param.setValueAtTime(sustain, startTime); - param[ramp](endValue, endTime); - } else if (param.cancelAndHoldAtTime == null) { - //this replicates cancelAndHoldAtTime behavior for Firefox - setTimeout( - () => { - //sustain at current value - const currValue = param.value; - param.cancelScheduledValues(0); - param.setValueAtTime(currValue, 0); - - //release - param[ramp](endValue, endTime); - }, - (startTime - ctx.currentTime) * 1000, - ); - } else { - //stop the envelope, hold the value, and then set the release stage - param.cancelAndHoldAtTime(startTime); - param[ramp](endValue, endTime); - } -}; +import { clamp, nanFallback } from './util.mjs'; export function gainNode(value) { const node = getAudioContext().createGain(); @@ -35,44 +7,13 @@ export function gainNode(value) { return node; } -// alternative to getADSR returning the gain node and a stop handle to trigger the release anytime in the future -export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => { - const gainNode = getAudioContext().createGain(); - let phase = begin; - gainNode.gain.setValueAtTime(0, begin); - phase += attack; - gainNode.gain.linearRampToValueAtTime(velocity, phase); // attack - phase += decay; - let sustainLevel = sustain * velocity; - gainNode.gain.linearRampToValueAtTime(sustainLevel, phase); // decay / sustain - // sustain end - return { - node: gainNode, - stop: (t) => { - const endTime = t + release; - setRelease(gainNode.gain, phase, sustainLevel, t, endTime, 0); - // helps prevent pops from overlapping sounds - return endTime; - }, - }; +const getSlope = (y1, y2, x1, x2) => { + const denom = x2 - x1; + if (denom === 0) { + return 0; + } + return (y2 - y1) / (x2 - x1); }; - -export const getExpEnvelope = (attack, decay, sustain, release, velocity, begin) => { - sustain = Math.max(0.001, sustain); - velocity = Math.max(0.001, velocity); - const gainNode = getAudioContext().createGain(); - gainNode.gain.setValueAtTime(0.0001, begin); - gainNode.gain.exponentialRampToValueAtTime(velocity, begin + attack); - gainNode.gain.exponentialRampToValueAtTime(sustain * velocity, begin + attack + decay); - return { - node: gainNode, - stop: (t) => { - // similar to getEnvelope, this will glitch if sustain level has not been reached - gainNode.gain.exponentialRampToValueAtTime(0.0001, t + release); - }, - }; -}; - export const getParamADSR = ( param, attack, @@ -86,23 +27,47 @@ export const getParamADSR = ( //exponential works better for frequency modulations (such as filter cutoff) due to human ear perception curve = 'exponential', ) => { + attack = nanFallback(attack); + decay = nanFallback(decay); + sustain = nanFallback(sustain); + release = nanFallback(release); + const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime'; - let phase = begin; + if (curve === 'exponential') { + min = Math.max(0.0001, min); + } const range = max - min; const peak = min + range; + const sustainVal = min + sustain * range; + const duration = end - begin; + + const envValAtTime = (time) => { + if (attack > time) { + return time * getSlope(min, peak, 0, attack) + 0; + } else { + return (time - attack) * getSlope(peak, sustainVal, 0, decay) + peak; + } + }; param.setValueAtTime(min, begin); - phase += attack; - - //attack - param[ramp](peak, phase); - phase += decay; - const sustainLevel = min + sustain * range; - - //decay - param[ramp](sustainLevel, phase); - - setRelease(param, phase, sustainLevel, end, end + release, min, curve); + if (attack > duration) { + //attack + param[ramp](envValAtTime(duration), end); + } else if (attack + decay > duration) { + //attack + param[ramp](envValAtTime(attack), begin + attack); + //decay + param[ramp](envValAtTime(duration), end); + } else { + //attack + param[ramp](envValAtTime(attack), begin + attack); + //decay + param[ramp](envValAtTime(attack + decay), begin + attack + decay); + //sustain + param.setValueAtTime(sustainVal, end); + } + //release + param[ramp](min, end + release); }; export function getCompressor(ac, threshold, ratio, knee, attack, release) { diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index ac39da66..f0e46221 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -1,6 +1,6 @@ import { noteToMidi, valueToMidi, getSoundIndex } from './util.mjs'; import { getAudioContext, registerSound } from './index.mjs'; -import { getADSRValues, getEnvelope } from './helpers.mjs'; +import { getADSRValues, getParamADSR } from './helpers.mjs'; import { logger } from './logger.mjs'; const bufferCache = {}; // string: Promise @@ -243,6 +243,7 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { begin = 0, loopEnd = 1, end = 1, + duration, vib, vibmod = 0.5, } = value; @@ -255,7 +256,7 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { const ac = getAudioContext(); // destructure adsr here, because the default should be different for synths and samples - const [attack, decay, sustain, release] = getADSRValues([value.attack, value.decay, value.sustain, value.release]); + let [attack, decay, sustain, release] = getADSRValues([value.attack, value.decay, value.sustain, value.release]); //const soundfont = getSoundfontKey(s); const time = t + nudge; @@ -299,25 +300,29 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { bufferSource.loopEnd = loopEnd * bufferSource.buffer.duration - offset; } bufferSource.start(time, offset); - const { node: envelope, stop: releaseEnvelope } = getEnvelope(attack, decay, sustain, release, 1, t); - bufferSource.connect(envelope); + const envGain = ac.createGain(); + const node = bufferSource.connect(envGain); + const holdEnd = t + duration; + getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear'); + const out = ac.createGain(); // we need a separate gain for the cutgroups because firefox... - envelope.connect(out); + node.connect(out); bufferSource.onended = function () { bufferSource.disconnect(); vibratoOscillator?.stop(); - envelope.disconnect(); + node.disconnect(); out.disconnect(); onended(); }; + let envEnd = holdEnd + release + 0.01; + bufferSource.stop(envEnd); const stop = (endTime, playWholeBuffer = clip === undefined && loop === undefined) => { - let releaseTime = endTime; - if (playWholeBuffer) { - const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value; - releaseTime = t + (end - begin) * bufferDuration; - } - const silentAt = releaseEnvelope(releaseTime); - bufferSource.stop(silentAt); + // did not reimplement this behavior, because it mostly seems to confuse people... + // if (playWholeBuffer) { + // const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value; + // envEnd = t + (end - begin) * bufferDuration; + // } + // bufferSource.stop(envEnd); }; const handle = { node: out, bufferSource, stop }; diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 09c8163b..cfe3567c 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -1,6 +1,6 @@ import { midiToFreq, noteToMidi } from './util.mjs'; import { registerSound, getAudioContext } from './superdough.mjs'; -import { gainNode, getADSRValues, getEnvelope, getExpEnvelope } from './helpers.mjs'; +import { gainNode, getADSRValues, getParamADSR } from './helpers.mjs'; import { getNoiseMix, getNoiseOscillator } from './noise.mjs'; const mod = (freq, range = 1, type = 'sine') => { @@ -43,26 +43,30 @@ export function registerSynthSounds() { let { density } = value; sound = getNoiseOscillator(s, t, density); } + let { node: o, stop, triggerRelease } = sound; // turn down const g = gainNode(0.3); - // gain envelope - const { node: envelope, stop: releaseEnvelope } = getEnvelope(attack, decay, sustain, release, 1, t); + const { duration } = value; o.onended = () => { o.disconnect(); g.disconnect(); onended(); }; + + const envGain = gainNode(1); + let node = o.connect(g).connect(envGain); + const holdEnd = t + duration; + getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear'); + const envEnd = holdEnd + release + 0.01; + triggerRelease?.(envEnd); + stop(envEnd); return { - node: o.connect(g).connect(envelope), - stop: (releaseTime) => { - const silentAt = releaseEnvelope(releaseTime); - triggerRelease?.(releaseTime); - stop(silentAt); - }, + node, + stop: (releaseTime) => {}, }; }, { type: 'synth', prebake: true }, @@ -122,6 +126,7 @@ export function getOscillator( fmrelease: fmRelease, fmvelocity: fmVelocity, fmwave: fmWaveform = 'sine', + duration, }, ) { let ac = getAudioContext(); @@ -151,26 +156,38 @@ export function getOscillator( o.start(t); // FM - let stopFm, fmEnvelope; + let stopFm; + let envGain = ac.createGain(); if (fmModulationIndex) { const { node: modulator, stop } = fm(o, fmHarmonicity, fmModulationIndex, fmWaveform); if (![fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity].find((v) => v !== undefined)) { // no envelope by default modulator.connect(o.frequency); } else { - fmAttack = fmAttack ?? 0.001; - fmDecay = fmDecay ?? 0.001; - fmSustain = fmSustain ?? 1; - fmRelease = fmRelease ?? 0.001; - fmVelocity = fmVelocity ?? 1; - fmEnvelope = getEnvelope(fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity, t); + const [attack, decay, sustain, release] = getADSRValues([fmAttack, fmDecay, fmSustain, fmRelease]); + + const holdEnd = t + duration; + // let envEnd = holdEnd + release + 0.01; + + getParamADSR( + envGain.gain, + attack, + decay, + sustain, + release, + 0, + 1, + t, + holdEnd, + fmEnvelopeType === 'exp' ? 'exponential' : 'linear', + ); + if (fmEnvelopeType === 'exp') { - fmEnvelope = getExpEnvelope(fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity, t); - fmEnvelope.node.maxValue = fmModulationIndex * 2; - fmEnvelope.node.minValue = 0.00001; + envGain.maxValue = fmModulationIndex * 2; + envGain.minValue = 0.00001; } - modulator.connect(fmEnvelope.node); - fmEnvelope.node.connect(o.frequency); + modulator.connect(envGain); + envGain.connect(o.frequency); } stopFm = stop; } @@ -202,7 +219,7 @@ export function getOscillator( o.stop(time); }, triggerRelease: (time) => { - fmEnvelope?.stop(time); + // envGain?.stop(time); }, }; } diff --git a/packages/superdough/util.mjs b/packages/superdough/util.mjs index 29eaa7bc..cebabfda 100644 --- a/packages/superdough/util.mjs +++ b/packages/superdough/util.mjs @@ -54,7 +54,7 @@ export const valueToMidi = (value, fallbackValue) => { return fallbackValue; }; -export function nanFallback(value, fallback) { +export function nanFallback(value, fallback = 0) { if (isNaN(Number(value))) { logger(`"${value}" is not a number, falling back to ${fallback}`, 'warning'); return fallback; diff --git a/website/src/repl/panel/SoundsTab.jsx b/website/src/repl/panel/SoundsTab.jsx index a3639dfb..7c16b266 100644 --- a/website/src/repl/panel/SoundsTab.jsx +++ b/website/src/repl/panel/SoundsTab.jsx @@ -57,32 +57,36 @@ export function SoundsTab() { settingsMap.setKey('soundsFilter', 'user')} />
- {soundEntries.map(([name, { data, onTrigger }]) => ( - { - const ctx = getAudioContext(); - const params = { - note: ['synth', 'soundfont'].includes(data.type) ? 'a3' : undefined, - s: name, - clip: 1, - release: 0.5, - }; - const time = ctx.currentTime + 0.05; - const onended = () => trigRef.current?.node?.disconnect(); - trigRef.current = Promise.resolve(onTrigger(time, params, onended)); - trigRef.current.then((ref) => { - connectToDestination(ref?.node); - }); - }} - > - {' '} - {name} - {data?.type === 'sample' ? `(${getSamples(data.samples)})` : ''} - {data?.type === 'soundfont' ? `(${data.fonts.length})` : ''} - - ))} + {soundEntries.map(([name, { data, onTrigger }]) => { + return ( + { + const ctx = getAudioContext(); + const params = { + note: ['synth', 'soundfont'].includes(data.type) ? 'a3' : undefined, + s: name, + clip: 1, + release: 0.5, + sustain: 1, + duration: 0.5, + }; + const time = ctx.currentTime + 0.05; + const onended = () => trigRef.current?.node?.disconnect(); + trigRef.current = Promise.resolve(onTrigger(time, params, onended)); + trigRef.current.then((ref) => { + connectToDestination(ref?.node); + }); + }} + > + {' '} + {name} + {data?.type === 'sample' ? `(${getSamples(data.samples)})` : ''} + {data?.type === 'soundfont' ? `(${data.fonts.length})` : ''} + + ); + })} {!soundEntries.length ? 'No custom sounds loaded in this pattern (yet).' : ''}
From b2f63897f9644a2c1e25d576b3b6a82f1b21a638 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Fri, 5 Jan 2024 01:07:54 -0500 Subject: [PATCH 26/55] change default FM env to exp because it modulates frequency and sounds way better :) --- packages/superdough/synth.mjs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index cfe3567c..c4586e92 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -119,7 +119,7 @@ export function getOscillator( // fm fmh: fmHarmonicity = 1, fmi: fmModulationIndex, - fmenv: fmEnvelopeType = 'lin', + fmenv: fmEnvelopeType = 'exp', fmattack: fmAttack, fmdecay: fmDecay, fmsustain: fmSustain, @@ -165,10 +165,7 @@ export function getOscillator( modulator.connect(o.frequency); } else { const [attack, decay, sustain, release] = getADSRValues([fmAttack, fmDecay, fmSustain, fmRelease]); - const holdEnd = t + duration; - // let envEnd = holdEnd + release + 0.01; - getParamADSR( envGain.gain, attack, @@ -181,11 +178,6 @@ export function getOscillator( holdEnd, fmEnvelopeType === 'exp' ? 'exponential' : 'linear', ); - - if (fmEnvelopeType === 'exp') { - envGain.maxValue = fmModulationIndex * 2; - envGain.minValue = 0.00001; - } modulator.connect(envGain); envGain.connect(o.frequency); } From 150a1b8eed86f39136a638788d91595478d1fe4e Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Fri, 5 Jan 2024 17:45:09 -0500 Subject: [PATCH 27/55] restore buffer hold behavior --- packages/superdough/sampler.mjs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index f0e46221..36f71277 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -302,7 +302,12 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { bufferSource.start(time, offset); const envGain = ac.createGain(); const node = bufferSource.connect(envGain); - const holdEnd = t + duration; + let holdEnd = t + duration; + if (clip == null && loop == null && value.release == null) { + const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value; + holdEnd = t + bufferDuration; + } + getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear'); const out = ac.createGain(); // we need a separate gain for the cutgroups because firefox... @@ -316,14 +321,7 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { }; let envEnd = holdEnd + release + 0.01; bufferSource.stop(envEnd); - const stop = (endTime, playWholeBuffer = clip === undefined && loop === undefined) => { - // did not reimplement this behavior, because it mostly seems to confuse people... - // if (playWholeBuffer) { - // const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value; - // envEnd = t + (end - begin) * bufferDuration; - // } - // bufferSource.stop(envEnd); - }; + const stop = (endTime, playWholeBuffer) => {}; const handle = { node: out, bufferSource, stop }; // cut groups From 46510664725b1c65d84fe7390e1f9827e5976dc9 Mon Sep 17 00:00:00 2001 From: Richard Julian Date: Sat, 6 Jan 2024 11:55:00 -0800 Subject: [PATCH 28/55] Remove hideHeader for better mobile UI and consistency --- .../src/pages/de/workshop/first-effects.mdx | 39 ++++------ website/src/pages/de/workshop/first-notes.mdx | 42 ++++------- .../src/pages/de/workshop/first-sounds.mdx | 72 +++++++++---------- .../src/pages/de/workshop/pattern-effects.mdx | 29 +++----- website/src/pages/de/workshop/recap.mdx | 66 ++++++++--------- website/src/pages/workshop/first-effects.mdx | 39 ++++------ website/src/pages/workshop/first-notes.mdx | 41 ++++------- website/src/pages/workshop/first-sounds.mdx | 72 +++++++++---------- .../src/pages/workshop/pattern-effects.mdx | 29 +++----- website/src/pages/workshop/recap.mdx | 66 ++++++++--------- 10 files changed, 203 insertions(+), 292 deletions(-) diff --git a/website/src/pages/de/workshop/first-effects.mdx b/website/src/pages/de/workshop/first-effects.mdx index b408a343..aa89de9c 100644 --- a/website/src/pages/de/workshop/first-effects.mdx +++ b/website/src/pages/de/workshop/first-effects.mdx @@ -15,7 +15,6 @@ import Box from '@components/Box.astro'; **low-pass filter** /2") .sound("sawtooth").lpf(800)`} @@ -33,7 +32,6 @@ lpf = **l**ow **p**ass **f**ilter **filter automatisieren** /2") .sound("sawtooth").lpf("200 1000")`} @@ -51,7 +49,6 @@ Später sehen wir, wie man mit Wellenformen Dinge automatisieren kann. **vowel = Vokal** /2") .sound("sawtooth").vowel("/2")`} @@ -60,7 +57,6 @@ Später sehen wir, wie man mit Wellenformen Dinge automatisieren kann. **gain = Verstärkung** ") .sound("sawtooth").lpf(600) @@ -145,7 +139,6 @@ Kannst du erraten, was die einzelnen Werte machen? **adsr-Kurznotation** ") .sound("sawtooth").lpf(600) @@ -156,7 +149,6 @@ Kannst du erraten, was die einzelnen Werte machen? **delay = Verzögerung** ~]") @@ -188,7 +180,6 @@ Was passiert, wenn du `.delay(".8:.06:.8")` schreibst? Kannst du erraten, was di **room aka reverb = Hall** ~@16] ~>/2") .scale("D4:minor").sound("gm_accordion:2") @@ -206,7 +197,6 @@ Füg auch ein Delay hinzu! **kleiner Dub-Tune** ~]") @@ -221,7 +211,6 @@ Füg auch ein Delay hinzu! Für echten Dub fehlt noch der Bass: ~]") @@ -245,7 +234,6 @@ Füg `.hush()` ans Ende eines Patterns im stack... **pan = Panorama** ").room(.2)`} /> +").room(.2)`} /> **fast and slow = schnell und langsam** Mit `fast` und `slow` kann man das Tempo eines Patterns außerhalb der Mini-Notation ändern: - + @@ -272,13 +260,13 @@ Was passiert, wenn du den Wert automatisierst? z.b. `.fast("<1 [2 4]>")` ? Übrigens, innerhalb der Mini-Notation: `fast` ist `*` und `slow` ist `/`. -")`} /> +")`} /> ## Automation mit Signalen Anstatt Werte schrittweise zu automatisieren, können wir auch sogenannte Signale benutzen: - + @@ -294,7 +282,7 @@ Der `gain`-Wert (Verstärkung) wird in der Visualisierung als Transparenz darges Signale bewegen sich standardmäßig zwischen 0 und 1. Wir können das mit `range` ändern: - + `range` ist nützlich wenn wir Funktionen mit einem anderen Wertebereich als 0 und 1 automatisieren wollen (z.b. `lpf`) @@ -307,7 +295,6 @@ Was passiert wenn du die beiden Werte vertauschst? Wir können die Geschwindigkeit der Automation mit slow / fast ändern: /2") .sound("sawtooth") @@ -324,13 +311,13 @@ Die ganze Automation braucht nun 8 cycle bis sie sich wiederholt. | Name | Beispiel | | ----- | -------------------------------------------------------------------------------------------------- | -| lpf | ")`} /> | -| vowel | ")`} /> | -| gain | | -| delay | | -| room | | -| pan | | -| speed | ")`} /> | -| range | | +| lpf | ")`} /> | +| vowel | ")`} /> | +| gain | | +| delay | | +| room | | +| pan | | +| speed | ")`} /> | +| range | | Lass uns nun die für Tidal typischen [Pattern-Effekte anschauen](/de/workshop/pattern-effects). diff --git a/website/src/pages/de/workshop/first-notes.mdx b/website/src/pages/de/workshop/first-notes.mdx index c44969df..e80495a1 100644 --- a/website/src/pages/de/workshop/first-notes.mdx +++ b/website/src/pages/de/workshop/first-notes.mdx @@ -17,7 +17,6 @@ Jetzt schauen wir uns an wie man mit Tönen mit der `note` Funktion spielt. **Töne mit Zahlen** + @@ -126,7 +121,6 @@ Probier ein paar sounds aus: **Zwischen Sounds hin und her wechseln** + @@ -171,7 +164,7 @@ Wenn eine Sequenz unabhängig von ihrem Inhalt immer gleich schnell bleiben soll **Eins pro Cycle per \< \>** -").sound("gm_acoustic_bass")`} punchcard /> +").sound("gm_acoustic_bass")`} punchcard /> @@ -190,7 +183,6 @@ usw.. **Eine Sequenz pro Cycle** ") .sound("gm_acoustic_bass")`} @@ -200,7 +192,6 @@ usw.. oder auch... /2") .sound("gm_acoustic_bass")`} @@ -212,7 +203,6 @@ oder auch... Ähnlich wie Unter-Sequenzen, kann auch `<...>` innerhalb einer Sequenz verwendet werden: ") .sound("gm_xylophone")`} @@ -222,7 +212,6 @@ oder auch... Das ist auch praktisch für atonale Sounds: , [~ hh]*2") .bank("RolandTR909")`} @@ -235,7 +224,6 @@ Es kann mühsam sein die richtigen Noten zu finden wenn man alle zur Verfügung Mit Skalen ist das einfacher: ") .scale("C:minor").sound("piano")`} @@ -262,7 +250,6 @@ Probier verschiedene Skalen: Wie alle Funktionen können auch Skalen mit einem Pattern automatisiert werden: , 2 4 <[6,8] [7,9]>") .scale("/4") @@ -283,7 +270,7 @@ Nimm dir Zeit um herauszufinden welche Skalen du magst. **Verlängern mit @** - + @@ -296,7 +283,6 @@ Spiel mit der Länge! **Unter-Sequenzen verlängern** *2") .scale("/4") @@ -314,7 +300,7 @@ Das nennt man auch manchmal `triolen swing`. Es ist ein typischer Rhythmus im Bl **Wiederholen** -]").sound("piano")`} punchcard /> +]").sound("piano")`} punchcard /> @@ -330,25 +316,24 @@ Das haben wir in diesem Kapitel gelernt: | Concept | Syntax | Example | | ------------ | ------ | ------------------------------------------------------------------- | -| Verlangsamen | \/ | | -| Alternativen | \<\> | ")`} /> | -| Verlängern | @ | | -| Wiederholen | ! | | +| Verlangsamen | \/ | | +| Alternativen | \<\> | ")`} /> | +| Verlängern | @ | | +| Wiederholen | ! | | Neue Funktionen: | Name | Description | Example | | ----- | --------------------------------------- | -------------------------------------------------------------------------------------------- | -| note | Tonhöhe als Buchstabe oder Zahl | | -| scale | Interpretiert `n` als Skalenstufe | | -| stack | Spiele mehrere Patterns parallel (s.u.) | | +| note | Tonhöhe als Buchstabe oder Zahl | | +| scale | Interpretiert `n` als Skalenstufe | | +| stack | Spiele mehrere Patterns parallel (s.u.) | | ## Beispiele **Bassline** /2") .sound("gm_synth_bass_1") @@ -358,7 +343,6 @@ Neue Funktionen: **Melodie** , [~ hh]*2") .bank("RolandTR909")`} @@ -387,7 +370,6 @@ Das geht mit `stack` 😙 /2") diff --git a/website/src/pages/de/workshop/first-sounds.mdx b/website/src/pages/de/workshop/first-sounds.mdx index a689add8..cfb27f83 100644 --- a/website/src/pages/de/workshop/first-sounds.mdx +++ b/website/src/pages/de/workshop/first-sounds.mdx @@ -15,7 +15,7 @@ Dies ist das erste Kapitel im Strudel Workshop, schön dich an Bord zu haben! Der Workshop ist voller interaktiver Textfelder. Lass uns lernen wie sie funktionieren. Hier ist eins: - + @@ -35,7 +35,7 @@ Glückwunsch, du kannst jetzt live coden! Gerade haben wir schon den ersten sound mit `sound` abgespielt: - + @@ -57,7 +57,7 @@ Ein Sound kann mehrere Samples (Audio Dateien) enthalten. Du kannst ein anderes Sample wählen, indem du `:` und eine Zahl an den Sound-Namen anhängst: - + @@ -74,7 +74,7 @@ Vorerst bleiben wir bei den voreingestellten Sounds, später erfahren wir noch w Strudel kommt von Haus aus mit einer breiten Auswahl an Drum Sounds: - + @@ -92,7 +92,7 @@ Probier verschiedene Sounds aus! Wir können den Charakter des Drum Sounds verändern, indem wir mit `bank` die Drum Machine auswählen: - + In diesem Beispiel ist `RolandTR909` der Name der Drum Machine, die eine prägende Rolle für House und Techno Musik spielte. @@ -117,7 +117,7 @@ Dann kannst du ihn mit `Strg`+`C` kopieren und mit `Strg`+`V` einfügen. Im letzten Beispiel haben wir schon gesehen dass man mehrere Sounds hintereinander abspielen kann wenn man sie durch Leerzeichen trennt: - + Beachte wie der aktuell gespielte Sound im Code markiert und auch darunter visualisiert wird. @@ -129,13 +129,13 @@ Versuch noch mehr Sounds hinzuzfügen! **Je länger die Sequence, desto schneller** - + Der Inhalt einer Sequence wird in einen sogenannten Cycle (=Zyklus) zusammengequetscht. **Tempo ändern mit `cpm`** - + @@ -151,7 +151,7 @@ Wir werden später noch mehr Möglichkeiten kennen lernen das Tempo zu veränder **Pausen mit '~'** - + @@ -164,7 +164,7 @@ Tilde tippen: **Unter-Sequenzen mit [Klammern]** - + @@ -178,11 +178,11 @@ Genau wie bei der ganzen Sequence wird eine Unter-Sequence schneller je mehr dri **Multiplikation: Dinge schneller machen** - + **Multiplikation: Vieeeeeeel schneller** - + @@ -192,12 +192,11 @@ Tonhöhe = sehr schneller Rhythmus **Multiplikation: Ganze Unter-Sequences schneller machen** - + Bolero: + @@ -216,15 +215,15 @@ Du kannst so tief verschachteln wie du willst! **Parallele Sequenzen mit Komma** - + Du kannst so viele Kommas benutzen wie du möchtest: - + Kommas können auch in Unter-Sequenzen verwendet werden: - + @@ -237,7 +236,6 @@ Es kommt öfter vor, dass man die gleiche Idee auf verschiedene Arten ausdrücke **Mehrere Zeilen schreiben mit \` (backtick)** + Das gleiche kann man auch so schreiben: - + ## Rückblick @@ -269,33 +267,33 @@ Das haben wir bisher gelernt: | Concept | Syntax | Example | | --------------------- | ----------- | -------------------------------------------------------------------------------- | -| Sequenz | Leerzeichen | | -| Sound Nummer | :x | | -| Pausen | ~ | | -| Unter-Sequenzen | \[\] | | -| Unter-Unter-Sequenzen | \[\[\]\] | | -| Schneller | \* | | -| Parallel | , | | +| Sequenz | Leerzeichen | | +| Sound Nummer | :x | | +| Pausen | ~ | | +| Unter-Sequenzen | \[\] | | +| Unter-Unter-Sequenzen | \[\[\]\] | | +| Schneller | \* | | +| Parallel | , | | Die mit Apostrophen umgebene Mini-Notation benutzt man normalerweise in einer sogenannten Funktion. Die folgenden Funktionen haben wir bereits gesehen: | Name | Description | Example | | ----- | -------------------------------------- | ---------------------------------------------------------------------------------- | -| sound | Spielt den Sound mit dem Namen | | -| bank | Wählt die Soundbank / Drum Machine | | -| cpm | Tempo in **C**ycles **p**ro **M**inute | | -| n | Sample Nummer | | +| sound | Spielt den Sound mit dem Namen | | +| bank | Wählt die Soundbank / Drum Machine | | +| cpm | Tempo in **C**ycles **p**ro **M**inute | | +| n | Sample Nummer | | ## Beispiele **Einfacher Rock Beat** - + **Klassischer House** - + @@ -306,12 +304,11 @@ Bestimmte Drum Patterns werden oft genreübergreifend wiederverwendet. We Will Rock you - + **Yellow Magic Orchestra - Firecracker** + **jux = einen stereo kanal modifizieren** - + So würde man das ohne `jux` schreiben: + Das hat den gleichen Effekt, wie: >")) .color(">").adsr("[.1 0]:.2:[1 0]") @@ -95,7 +91,6 @@ z.B. c4 = 60, also ist c4 + 2 = 62 Man kann auch mehrmals addieren: >").add("0,7")) .color(">").adsr("[.1 0]:.2:[1 0]") @@ -106,7 +101,6 @@ Man kann auch mehrmals addieren: **add + scale** [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) .scale("C5:minor").release(.5) @@ -117,7 +111,6 @@ Man kann auch mehrmals addieren: **Alles zusammen** [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) @@ -134,11 +127,11 @@ Man kann auch mehrmals addieren: **ply** - + das ist wie: - + @@ -149,7 +142,6 @@ Probier `ply` mit einem pattern zu automatisieren, z.b. `"<1 2 1 3>"` **off** ] <2 3> [~ 1]>" .off(1/8, x=>x.add(4)) @@ -168,7 +160,6 @@ In der Notation `x=>x.`, ist `x` das Pattern, das wir bearbeiten. `off` ist auch nützlich für Sounds: x.speed(1.5).gain(.25))`} @@ -176,8 +167,8 @@ In der Notation `x=>x.`, ist `x` das Pattern, das wir bearbeiten. | Name | Beschreibung | Beispiel | | ---- | --------------------------------- | ---------------------------------------------------------------------------------------------- | -| rev | rückwärts | | -| jux | einen Stereo-Kanal modifizieren | | -| add | addiert Zahlen oder Noten | ")).scale("C:minor")`} /> | -| ply | multipliziert jedes Element x mal | ")`} /> | -| off | verzögert eine modifizierte Kopie | x.speed(2))`} /> | +| rev | rückwärts | | +| jux | einen Stereo-Kanal modifizieren | | +| add | addiert Zahlen oder Noten | ")).scale("C:minor")`} /> | +| ply | multipliziert jedes Element x mal | ")`} /> | +| off | verzögert eine modifizierte Kopie | x.speed(2))`} /> | diff --git a/website/src/pages/de/workshop/recap.mdx b/website/src/pages/de/workshop/recap.mdx index c0d577d1..eb1f64f0 100644 --- a/website/src/pages/de/workshop/recap.mdx +++ b/website/src/pages/de/workshop/recap.mdx @@ -13,56 +13,56 @@ Diese Seite ist eine Auflistung aller im Workshop vorgestellten Funktionen. | Konzept | Syntax | Beispiel | | --------------------- | -------- | -------------------------------------------------------------------------------- | -| Sequenz | space | | -| Sample-Nummer | :x | | -| Pausen | ~ | | -| Unter-Sequenzen | \[\] | | -| Unter-Unter-Sequenzen | \[\[\]\] | | -| Schneller | \* | | -| Verlangsamen | \/ | | -| Parallel | , | | -| Alternieren | \<\> | ")`} /> | -| Verlängern | @ | | -| Wiederholen | ! | | +| Sequenz | space | | +| Sample-Nummer | :x | | +| Pausen | ~ | | +| Unter-Sequenzen | \[\] | | +| Unter-Unter-Sequenzen | \[\[\]\] | | +| Schneller | \* | | +| Verlangsamen | \/ | | +| Parallel | , | | +| Alternieren | \<\> | ")`} /> | +| Verlängern | @ | | +| Wiederholen | ! | | ## Sounds | Name | Beschreibung | Beispiel | | ----- | -------------------------- | ---------------------------------------------------------------------------------- | -| sound | spielt den Sound mit Namen | | -| bank | wählt die Soundbank | | -| n | wählt Sample mit Nummer | | +| sound | spielt den Sound mit Namen | | +| bank | wählt die Soundbank | | +| n | wählt Sample mit Nummer | | ## Noten | Name | Beschreibung | Beispiel | | --------- | ---------------------------------- | -------------------------------------------------------------------------------------------- | -| note | wählt Note per Zahl oder Buchstabe | | -| n + scale | wählt Note n in Skala | | -| stack | spielt mehrere Patterns parallel | | +| note | wählt Note per Zahl oder Buchstabe | | +| n + scale | wählt Note n in Skala | | +| stack | spielt mehrere Patterns parallel | | ## Audio-Effekte | Name | Beispiele | | ----- | -------------------------------------------------------------------------------------------------- | -| lpf | ")`} /> | -| vowel | ")`} /> | -| gain | | -| delay | | -| room | | -| pan | | -| speed | ")`} /> | -| range | | +| lpf | ")`} /> | +| vowel | ")`} /> | +| gain | | +| delay | | +| room | | +| pan | | +| speed | ")`} /> | +| range | | ## Pattern-Effekte | Name | Beschreibung | Beispiel | | ---- | --------------------------------- | ---------------------------------------------------------------------------------------------- | -| cpm | Tempo in Cycles pro Minute | | -| fast | schneller | | -| slow | langsamer | | -| rev | rückwärts | | -| jux | einen Stereo-Kanal modifizieren | | -| add | addiert Zahlen oder Noten | ")).scale("C:minor")`} /> | -| ply | jedes Element schneller machen | ")`} /> | -| off | verzögert eine modifizierte Kopie | x.speed(2))`} /> | +| cpm | Tempo in Cycles pro Minute | | +| fast | schneller | | +| slow | langsamer | | +| rev | rückwärts | | +| jux | einen Stereo-Kanal modifizieren | | +| add | addiert Zahlen oder Noten | ")).scale("C:minor")`} /> | +| ply | jedes Element schneller machen | ")`} /> | +| off | verzögert eine modifizierte Kopie | x.speed(2))`} /> | diff --git a/website/src/pages/workshop/first-effects.mdx b/website/src/pages/workshop/first-effects.mdx index e3ce5487..de3d6201 100644 --- a/website/src/pages/workshop/first-effects.mdx +++ b/website/src/pages/workshop/first-effects.mdx @@ -17,7 +17,6 @@ We have sounds, we have notes, now let's look at effects! **low-pass filter** /2") .sound("sawtooth").lpf(800)`} @@ -35,7 +34,6 @@ lpf = **l**ow **p**ass **f**ilter **pattern the filter** /2") .sound("sawtooth").lpf("200 1000")`} @@ -53,7 +51,6 @@ We will learn how to automate with waves later... **vowel** /2") .sound("sawtooth").vowel("/2")`} @@ -62,7 +59,6 @@ We will learn how to automate with waves later... **gain** ") .sound("sawtooth").lpf(600) @@ -146,7 +140,6 @@ Can you guess what they do? **adsr short notation** ") .sound("sawtooth").lpf(600) @@ -157,7 +150,6 @@ Can you guess what they do? **delay** ~]") @@ -189,7 +181,6 @@ What happens if you use `.delay(".8:.06:.8")` ? Can you guess what the third num **room aka reverb** ~@16] ~>/2") .scale("D4:minor").sound("gm_accordion:2") @@ -207,7 +198,6 @@ Add a delay too! **little dub tune** ~]") @@ -222,7 +212,6 @@ Add a delay too! Let's add a bass to make this complete: ~]") @@ -246,7 +235,6 @@ Try adding `.hush()` at the end of one of the patterns in the stack... **pan** ").room(.2)`} /> +").room(.2)`} /> **fast and slow** We can use `fast` and `slow` to change the tempo of a pattern outside of Mini-Notation: - + @@ -273,13 +261,13 @@ What happens if you use a pattern like `.fast("<1 [2 4]>")`? By the way, inside Mini-Notation, `fast` is `*` and `slow` is `/`. -")`} /> +")`} /> ## automation with signals Instead of changing values stepwise, we can also control them with signals: - + @@ -295,7 +283,7 @@ The gain is visualized as transparency in the pianoroll. By default, waves oscillate between 0 to 1. We can change that with `range`: - + @@ -306,7 +294,6 @@ What happens if you flip the range values? We can change the automation speed with slow / fast: /2") .sound("sawtooth") @@ -323,13 +310,13 @@ The whole automation will now take 8 cycles to repeat. | name | example | | ----- | -------------------------------------------------------------------------------------------------- | -| lpf | ")`} /> | -| vowel | ")`} /> | -| gain | | -| delay | | -| room | | -| pan | | -| speed | ")`} /> | -| range | | +| lpf | ")`} /> | +| vowel | ")`} /> | +| gain | | +| delay | | +| room | | +| pan | | +| speed | ")`} /> | +| range | | Let us now take a look at some of Tidal's typical [pattern effects](/workshop/pattern-effects). diff --git a/website/src/pages/workshop/first-notes.mdx b/website/src/pages/workshop/first-notes.mdx index ab11ed90..d525cf81 100644 --- a/website/src/pages/workshop/first-notes.mdx +++ b/website/src/pages/workshop/first-notes.mdx @@ -17,7 +17,6 @@ Let's look at how we can play notes **play notes with numbers** + {/* c2 g2, e3 b3 d4 e4 */} @@ -127,7 +122,6 @@ Try out different sounds: **switch between sounds** + @@ -172,7 +165,7 @@ Because it is so common to just play one thing per cycle, you can.. **Play one per cycle with \< \>** -").sound("gm_acoustic_bass")`} punchcard /> +").sound("gm_acoustic_bass")`} punchcard /> @@ -185,7 +178,6 @@ Try adding more notes inside the brackets and notice how it does **not** get fas {/* <[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>/2 */} /2") .sound("gm_acoustic_bass")`} @@ -195,7 +187,6 @@ Try adding more notes inside the brackets and notice how it does **not** get fas **Alternate between multiple things** ") .sound("gm_xylophone")`} @@ -205,7 +196,6 @@ Try adding more notes inside the brackets and notice how it does **not** get fas This is also useful for unpitched sounds: , [~ hh]*2") .bank("RolandTR909")`} @@ -217,7 +207,6 @@ This is also useful for unpitched sounds: Finding the right notes can be difficult.. Scales are here to help: ") .scale("C:minor").sound("piano")`} @@ -244,7 +233,6 @@ Try out different scales: Just like anything, we can automate the scale with a pattern: , 2 4 <[6,8] [7,9]>") .scale("/4") @@ -265,7 +253,7 @@ Take your time and you'll find scales you like! **Elongate with @** - + @@ -278,7 +266,6 @@ Try changing that number! **Elongate within sub-sequences** *2") .scale("/4") @@ -296,7 +283,7 @@ This is also sometimes called triplet swing. You'll often find it in blues and j **Replicate** -]").sound("piano")`} punchcard /> +]").sound("piano")`} punchcard /> @@ -312,25 +299,24 @@ Let's recap what we've learned in this chapter: | Concept | Syntax | Example | | --------- | ------ | ------------------------------------------------------------------- | -| Slow down | \/ | | -| Alternate | \<\> | ")`} /> | -| Elongate | @ | | -| Replicate | ! | | +| Slow down | \/ | | +| Alternate | \<\> | ")`} /> | +| Elongate | @ | | +| Replicate | ! | | New functions: | Name | Description | Example | | ----- | ----------------------------------- | -------------------------------------------------------------------------------------------- | -| note | set pitch as number or letter | | -| scale | interpret `n` as scale degree | | -| stack | play patterns in parallel (read on) | | +| note | set pitch as number or letter | | +| scale | interpret `n` as scale degree | | +| stack | play patterns in parallel (read on) | | ## Examples **Classy Bassline** /2") .sound("gm_synth_bass_1") @@ -340,7 +326,6 @@ New functions: **Classy Melody** , [~ hh]*2") .bank("RolandTR909")`} @@ -369,7 +353,6 @@ It's called `stack` 😙 /2") diff --git a/website/src/pages/workshop/first-sounds.mdx b/website/src/pages/workshop/first-sounds.mdx index 5897f029..5b0f45f2 100644 --- a/website/src/pages/workshop/first-sounds.mdx +++ b/website/src/pages/workshop/first-sounds.mdx @@ -15,7 +15,7 @@ This is the first chapter of the Strudel Workshop, nice to have you on board! The workshop is full of interactive code fields. Let's learn how to use those. Here is one: - + @@ -33,7 +33,7 @@ Congratulations, you are now live coding! We have just played a sound with `sound` like this: - + @@ -55,7 +55,7 @@ One Sound can contain multiple samples (audio files). You can select the sample by appending `:` followed by a number to the name: - + @@ -72,7 +72,7 @@ For now we'll stick to this little selection of sounds, but we'll find out how t By default, Strudel comes with a wide selection of drum sounds: - + @@ -90,7 +90,7 @@ Try out different drum sounds! To change the sound character of our drums, we can use `bank` to change the drum machine: - + In this example `RolandTR909` is the name of the drum machine that we're using. It is a famous drum machine for house and techno beats. @@ -115,7 +115,7 @@ There are a lot more, but let's keep it simple for now In the last example, we already saw that you can play multiple sounds in a sequence by separating them with a space: - + Notice how the currently playing sound is highlighted in the code and also visualized below. @@ -127,13 +127,13 @@ Try adding more sounds to the sequence! **The longer the sequence, the faster it runs** - + The content of a sequence will be squished into what's called a cycle. **One way to change the tempo is using `cpm`** - + @@ -147,11 +147,11 @@ We will look at other ways to change the tempo later! **Add a rests in a sequence with '~'** - + **Sub-Sequences with [brackets]** - + @@ -163,15 +163,15 @@ Similar to the whole sequence, the content of a sub-sequence will be squished to **Multiplication: Speed things up** - + **Multiplication: Speed up sequences** - + **Multiplication: Speeeeeeeeed things up** - + @@ -181,7 +181,7 @@ Pitch = really fast rhythm **Sub-Sub-Sequences with [[brackets]]** - + @@ -191,15 +191,15 @@ You can go as deep as you want! **Play sequences in parallel with comma** - + You can use as many commas as you want: - + Commas can also be used inside sub-sequences: - + @@ -212,7 +212,6 @@ It is quite common that there are many ways to express the same idea. **Multiple Lines with backticks** + This is shorter and more readable than: - + ## Recap @@ -237,32 +236,32 @@ This is what we've leared so far: | Concept | Syntax | Example | | ----------------- | -------- | -------------------------------------------------------------------------------- | -| Sequence | space | | -| Sample Number | :x | | -| Rests | ~ | | -| Sub-Sequences | \[\] | | -| Sub-Sub-Sequences | \[\[\]\] | | -| Speed up | \* | | -| Parallel | , | | +| Sequence | space | | +| Sample Number | :x | | +| Rests | ~ | | +| Sub-Sequences | \[\] | | +| Sub-Sub-Sequences | \[\[\]\] | | +| Speed up | \* | | +| Parallel | , | | The Mini-Notation is usually used inside some function. These are the functions we've seen so far: | Name | Description | Example | | ----- | ----------------------------------- | ---------------------------------------------------------------------------------- | -| sound | plays the sound of the given name | | -| bank | selects the sound bank | | -| cpm | sets the tempo in cycles per minute | | -| n | select sample number | | +| sound | plays the sound of the given name | | +| bank | selects the sound bank | | +| cpm | sets the tempo in cycles per minute | | +| n | select sample number | | ## Examples **Basic rock beat** - + **Classic house** - + @@ -273,12 +272,12 @@ Certain drum patterns are reused across genres. We Will Rock you - + **Yellow Magic Orchestra - Firecracker** + **play pattern left and modify it right with jux** - + This is the same as: + This is like doing >")) .color(">").adsr("[.1 0]:.2:[1 0]") @@ -93,7 +89,6 @@ If you add a number to a note, the note will be treated as if it was a number We can add as often as we like: >").add("0,7")) .color(">").adsr("[.1 0]:.2:[1 0]") @@ -104,7 +99,6 @@ We can add as often as we like: **add with scale** [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) .scale("C5:minor").release(.5) @@ -115,7 +109,6 @@ We can add as often as we like: **time to stack** [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) @@ -132,11 +125,11 @@ We can add as often as we like: **ply** - + this is like writing: - + @@ -147,7 +140,6 @@ Try patterning the `ply` function, for example using `"<1 2 1 3>"` **off** ] <2 3> [~ 1]>" .off(1/8, x=>x.add(4)) @@ -166,7 +158,6 @@ In the notation `x=>x.`, the `x` is the shifted pattern, which where modifying. off is also useful for sounds: x.speed(1.5).gain(.25))`} @@ -174,8 +165,8 @@ off is also useful for sounds: | name | description | example | | ---- | ------------------------------ | ---------------------------------------------------------------------------------------------- | -| rev | reverse | | -| jux | split left/right, modify right | | -| add | add numbers / notes | ")).scale("C:minor")`} /> | -| ply | speed up each event n times | ")`} /> | -| off | copy, shift time & modify | x.speed(2))`} /> | +| rev | reverse | | +| jux | split left/right, modify right | | +| add | add numbers / notes | ")).scale("C:minor")`} /> | +| ply | speed up each event n times | ")`} /> | +| off | copy, shift time & modify | x.speed(2))`} /> | diff --git a/website/src/pages/workshop/recap.mdx b/website/src/pages/workshop/recap.mdx index fad14fb4..17377e97 100644 --- a/website/src/pages/workshop/recap.mdx +++ b/website/src/pages/workshop/recap.mdx @@ -13,56 +13,56 @@ This page is just a listing of all functions covered in the workshop! | Concept | Syntax | Example | | ----------------- | -------- | -------------------------------------------------------------------------------- | -| Sequence | space | | -| Sample Number | :x | | -| Rests | ~ | | -| Sub-Sequences | \[\] | | -| Sub-Sub-Sequences | \[\[\]\] | | -| Speed up | \* | | -| Parallel | , | | -| Slow down | \/ | | -| Alternate | \<\> | ")`} /> | -| Elongate | @ | | -| Replicate | ! | | +| Sequence | space | | +| Sample Number | :x | | +| Rests | ~ | | +| Sub-Sequences | \[\] | | +| Sub-Sub-Sequences | \[\[\]\] | | +| Speed up | \* | | +| Parallel | , | | +| Slow down | \/ | | +| Alternate | \<\> | ")`} /> | +| Elongate | @ | | +| Replicate | ! | | ## Sounds | Name | Description | Example | | ----- | --------------------------------- | ---------------------------------------------------------------------------------- | -| sound | plays the sound of the given name | | -| bank | selects the sound bank | | -| n | select sample number | | +| sound | plays the sound of the given name | | +| bank | selects the sound bank | | +| n | select sample number | | ## Notes | Name | Description | Example | | --------- | ----------------------------- | -------------------------------------------------------------------------------------------- | -| note | set pitch as number or letter | | -| n + scale | set note in scale | | -| stack | play patterns in parallel | | +| note | set pitch as number or letter | | +| n + scale | set note in scale | | +| stack | play patterns in parallel | | ## Audio Effects | name | example | | ----- | -------------------------------------------------------------------------------------------------- | -| lpf | ")`} /> | -| vowel | ")`} /> | -| gain | | -| delay | | -| room | | -| pan | | -| speed | ")`} /> | -| range | | +| lpf | ")`} /> | +| vowel | ")`} /> | +| gain | | +| delay | | +| room | | +| pan | | +| speed | ")`} /> | +| range | | ## Pattern Effects | name | description | example | | ---- | ----------------------------------- | ---------------------------------------------------------------------------------------------- | -| cpm | sets the tempo in cycles per minute | | -| fast | speed up | | -| slow | slow down | | -| rev | reverse | | -| jux | split left/right, modify right | | -| add | add numbers / notes | ")).scale("C:minor")`} /> | -| ply | speed up each event n times | ")`} /> | -| off | copy, shift time & modify | x.speed(2))`} /> | +| cpm | sets the tempo in cycles per minute | | +| fast | speed up | | +| slow | slow down | | +| rev | reverse | | +| jux | split left/right, modify right | | +| add | add numbers / notes | ")).scale("C:minor")`} /> | +| ply | speed up each event n times | ")`} /> | +| off | copy, shift time & modify | x.speed(2))`} /> | From 569137eb22b31792c48fdbe92799c61477110eb7 Mon Sep 17 00:00:00 2001 From: Richard Julian Date: Sat, 6 Jan 2024 12:05:39 -0800 Subject: [PATCH 29/55] Formatting for passing CI --- .../src/pages/de/workshop/first-effects.mdx | 4 +- website/src/pages/de/workshop/first-notes.mdx | 8 ++-- .../src/pages/de/workshop/first-sounds.mdx | 8 ++-- .../src/pages/de/workshop/pattern-effects.mdx | 4 +- website/src/pages/de/workshop/recap.mdx | 20 +++++----- website/src/pages/workshop/first-effects.mdx | 4 +- website/src/pages/workshop/first-notes.mdx | 8 ++-- website/src/pages/workshop/first-sounds.mdx | 37 +++++++++---------- .../src/pages/workshop/pattern-effects.mdx | 4 +- website/src/pages/workshop/recap.mdx | 20 +++++----- 10 files changed, 58 insertions(+), 59 deletions(-) diff --git a/website/src/pages/de/workshop/first-effects.mdx b/website/src/pages/de/workshop/first-effects.mdx index aa89de9c..a790120a 100644 --- a/website/src/pages/de/workshop/first-effects.mdx +++ b/website/src/pages/de/workshop/first-effects.mdx @@ -309,8 +309,8 @@ Die ganze Automation braucht nun 8 cycle bis sie sich wiederholt. ## Rückblick -| Name | Beispiel | -| ----- | -------------------------------------------------------------------------------------------------- | +| Name | Beispiel | +| ----- | --------------------------------------------------------------------------------------- | | lpf | ")`} /> | | vowel | ")`} /> | | gain | | diff --git a/website/src/pages/de/workshop/first-notes.mdx b/website/src/pages/de/workshop/first-notes.mdx index e80495a1..0f5efc55 100644 --- a/website/src/pages/de/workshop/first-notes.mdx +++ b/website/src/pages/de/workshop/first-notes.mdx @@ -314,8 +314,8 @@ Was ist der Unterschied? Das haben wir in diesem Kapitel gelernt: -| Concept | Syntax | Example | -| ------------ | ------ | ------------------------------------------------------------------- | +| Concept | Syntax | Example | +| ------------ | ------ | -------------------------------------------------------- | | Verlangsamen | \/ | | | Alternativen | \<\> | ")`} /> | | Verlängern | @ | | @@ -323,8 +323,8 @@ Das haben wir in diesem Kapitel gelernt: Neue Funktionen: -| Name | Description | Example | -| ----- | --------------------------------------- | -------------------------------------------------------------------------------------------- | +| Name | Description | Example | +| ----- | --------------------------------------- | --------------------------------------------------------------------------------- | | note | Tonhöhe als Buchstabe oder Zahl | | | scale | Interpretiert `n` als Skalenstufe | | | stack | Spiele mehrere Patterns parallel (s.u.) | | diff --git a/website/src/pages/de/workshop/first-sounds.mdx b/website/src/pages/de/workshop/first-sounds.mdx index cfb27f83..743a5312 100644 --- a/website/src/pages/de/workshop/first-sounds.mdx +++ b/website/src/pages/de/workshop/first-sounds.mdx @@ -265,8 +265,8 @@ Wir haben jetzt die Grundlagen der sogenannten Mini-Notation gelernt, der Rhythm Das haben wir bisher gelernt: -| Concept | Syntax | Example | -| --------------------- | ----------- | -------------------------------------------------------------------------------- | +| Concept | Syntax | Example | +| --------------------- | ----------- | --------------------------------------------------------------------- | | Sequenz | Leerzeichen | | | Sound Nummer | :x | | | Pausen | ~ | | @@ -278,8 +278,8 @@ Das haben wir bisher gelernt: Die mit Apostrophen umgebene Mini-Notation benutzt man normalerweise in einer sogenannten Funktion. Die folgenden Funktionen haben wir bereits gesehen: -| Name | Description | Example | -| ----- | -------------------------------------- | ---------------------------------------------------------------------------------- | +| Name | Description | Example | +| ----- | -------------------------------------- | ----------------------------------------------------------------------- | | sound | Spielt den Sound mit dem Namen | | | bank | Wählt die Soundbank / Drum Machine | | | cpm | Tempo in **C**ycles **p**ro **M**inute | | diff --git a/website/src/pages/de/workshop/pattern-effects.mdx b/website/src/pages/de/workshop/pattern-effects.mdx index f710f41d..c76c831d 100644 --- a/website/src/pages/de/workshop/pattern-effects.mdx +++ b/website/src/pages/de/workshop/pattern-effects.mdx @@ -165,8 +165,8 @@ In der Notation `x=>x.`, ist `x` das Pattern, das wir bearbeiten. .off(1/8, x=>x.speed(1.5).gain(.25))`} /> -| Name | Beschreibung | Beispiel | -| ---- | --------------------------------- | ---------------------------------------------------------------------------------------------- | +| Name | Beschreibung | Beispiel | +| ---- | --------------------------------- | ----------------------------------------------------------------------------------- | | rev | rückwärts | | | jux | einen Stereo-Kanal modifizieren | | | add | addiert Zahlen oder Noten | ")).scale("C:minor")`} /> | diff --git a/website/src/pages/de/workshop/recap.mdx b/website/src/pages/de/workshop/recap.mdx index eb1f64f0..14ef6b25 100644 --- a/website/src/pages/de/workshop/recap.mdx +++ b/website/src/pages/de/workshop/recap.mdx @@ -11,8 +11,8 @@ Diese Seite ist eine Auflistung aller im Workshop vorgestellten Funktionen. ## Mini Notation -| Konzept | Syntax | Beispiel | -| --------------------- | -------- | -------------------------------------------------------------------------------- | +| Konzept | Syntax | Beispiel | +| --------------------- | -------- | --------------------------------------------------------------------- | | Sequenz | space | | | Sample-Nummer | :x | | | Pausen | ~ | | @@ -27,24 +27,24 @@ Diese Seite ist eine Auflistung aller im Workshop vorgestellten Funktionen. ## Sounds -| Name | Beschreibung | Beispiel | -| ----- | -------------------------- | ---------------------------------------------------------------------------------- | +| Name | Beschreibung | Beispiel | +| ----- | -------------------------- | ----------------------------------------------------------------------- | | sound | spielt den Sound mit Namen | | | bank | wählt die Soundbank | | | n | wählt Sample mit Nummer | | ## Noten -| Name | Beschreibung | Beispiel | -| --------- | ---------------------------------- | -------------------------------------------------------------------------------------------- | +| Name | Beschreibung | Beispiel | +| --------- | ---------------------------------- | --------------------------------------------------------------------------------- | | note | wählt Note per Zahl oder Buchstabe | | | n + scale | wählt Note n in Skala | | | stack | spielt mehrere Patterns parallel | | ## Audio-Effekte -| Name | Beispiele | -| ----- | -------------------------------------------------------------------------------------------------- | +| Name | Beispiele | +| ----- | --------------------------------------------------------------------------------------- | | lpf | ")`} /> | | vowel | ")`} /> | | gain | | @@ -56,8 +56,8 @@ Diese Seite ist eine Auflistung aller im Workshop vorgestellten Funktionen. ## Pattern-Effekte -| Name | Beschreibung | Beispiel | -| ---- | --------------------------------- | ---------------------------------------------------------------------------------------------- | +| Name | Beschreibung | Beispiel | +| ---- | --------------------------------- | ----------------------------------------------------------------------------------- | | cpm | Tempo in Cycles pro Minute | | | fast | schneller | | | slow | langsamer | | diff --git a/website/src/pages/workshop/first-effects.mdx b/website/src/pages/workshop/first-effects.mdx index de3d6201..48764bce 100644 --- a/website/src/pages/workshop/first-effects.mdx +++ b/website/src/pages/workshop/first-effects.mdx @@ -308,8 +308,8 @@ The whole automation will now take 8 cycles to repeat. ## Recap -| name | example | -| ----- | -------------------------------------------------------------------------------------------------- | +| name | example | +| ----- | --------------------------------------------------------------------------------------- | | lpf | ")`} /> | | vowel | ")`} /> | | gain | | diff --git a/website/src/pages/workshop/first-notes.mdx b/website/src/pages/workshop/first-notes.mdx index d525cf81..335cffe7 100644 --- a/website/src/pages/workshop/first-notes.mdx +++ b/website/src/pages/workshop/first-notes.mdx @@ -297,8 +297,8 @@ What's the difference? Let's recap what we've learned in this chapter: -| Concept | Syntax | Example | -| --------- | ------ | ------------------------------------------------------------------- | +| Concept | Syntax | Example | +| --------- | ------ | -------------------------------------------------------- | | Slow down | \/ | | | Alternate | \<\> | ")`} /> | | Elongate | @ | | @@ -306,8 +306,8 @@ Let's recap what we've learned in this chapter: New functions: -| Name | Description | Example | -| ----- | ----------------------------------- | -------------------------------------------------------------------------------------------- | +| Name | Description | Example | +| ----- | ----------------------------------- | --------------------------------------------------------------------------------- | | note | set pitch as number or letter | | | scale | interpret `n` as scale degree | | | stack | play patterns in parallel (read on) | | diff --git a/website/src/pages/workshop/first-sounds.mdx b/website/src/pages/workshop/first-sounds.mdx index 5b0f45f2..91ae1e5a 100644 --- a/website/src/pages/workshop/first-sounds.mdx +++ b/website/src/pages/workshop/first-sounds.mdx @@ -55,7 +55,7 @@ One Sound can contain multiple samples (audio files). You can select the sample by appending `:` followed by a number to the name: - + @@ -72,7 +72,7 @@ For now we'll stick to this little selection of sounds, but we'll find out how t By default, Strudel comes with a wide selection of drum sounds: - + @@ -90,7 +90,7 @@ Try out different drum sounds! To change the sound character of our drums, we can use `bank` to change the drum machine: - + In this example `RolandTR909` is the name of the drum machine that we're using. It is a famous drum machine for house and techno beats. @@ -234,24 +234,24 @@ This is shorter and more readable than: Now we've learned the basics of the so called Mini-Notation, the rhythm language of Tidal. This is what we've leared so far: -| Concept | Syntax | Example | -| ----------------- | -------- | -------------------------------------------------------------------------------- | -| Sequence | space | | -| Sample Number | :x | | -| Rests | ~ | | -| Sub-Sequences | \[\] | | -| Sub-Sub-Sequences | \[\[\]\] | | -| Speed up | \* | | -| Parallel | , | | +| Concept | Syntax | Example | +| ----------------- | -------- | --------------------------------------------------------------------- | +| Sequence | space | | +| Sample Number | :x | | +| Rests | ~ | | +| Sub-Sequences | \[\] | | +| Sub-Sub-Sequences | \[\[\]\] | | +| Speed up | \* | | +| Parallel | , | | The Mini-Notation is usually used inside some function. These are the functions we've seen so far: -| Name | Description | Example | -| ----- | ----------------------------------- | ---------------------------------------------------------------------------------- | -| sound | plays the sound of the given name | | -| bank | selects the sound bank | | -| cpm | sets the tempo in cycles per minute | | -| n | select sample number | | +| Name | Description | Example | +| ----- | ----------------------------------- | ----------------------------------------------------------------------- | +| sound | plays the sound of the given name | | +| bank | selects the sound bank | | +| cpm | sets the tempo in cycles per minute | | +| n | select sample number | | ## Examples @@ -277,7 +277,6 @@ We Will Rock you **Yellow Magic Orchestra - Firecracker** x.speed(1.5).gain(.25))`} /> -| name | description | example | -| ---- | ------------------------------ | ---------------------------------------------------------------------------------------------- | +| name | description | example | +| ---- | ------------------------------ | ----------------------------------------------------------------------------------- | | rev | reverse | | | jux | split left/right, modify right | | | add | add numbers / notes | ")).scale("C:minor")`} /> | diff --git a/website/src/pages/workshop/recap.mdx b/website/src/pages/workshop/recap.mdx index 17377e97..9260a8f6 100644 --- a/website/src/pages/workshop/recap.mdx +++ b/website/src/pages/workshop/recap.mdx @@ -11,8 +11,8 @@ This page is just a listing of all functions covered in the workshop! ## Mini Notation -| Concept | Syntax | Example | -| ----------------- | -------- | -------------------------------------------------------------------------------- | +| Concept | Syntax | Example | +| ----------------- | -------- | --------------------------------------------------------------------- | | Sequence | space | | | Sample Number | :x | | | Rests | ~ | | @@ -27,24 +27,24 @@ This page is just a listing of all functions covered in the workshop! ## Sounds -| Name | Description | Example | -| ----- | --------------------------------- | ---------------------------------------------------------------------------------- | +| Name | Description | Example | +| ----- | --------------------------------- | ----------------------------------------------------------------------- | | sound | plays the sound of the given name | | | bank | selects the sound bank | | | n | select sample number | | ## Notes -| Name | Description | Example | -| --------- | ----------------------------- | -------------------------------------------------------------------------------------------- | +| Name | Description | Example | +| --------- | ----------------------------- | --------------------------------------------------------------------------------- | | note | set pitch as number or letter | | | n + scale | set note in scale | | | stack | play patterns in parallel | | ## Audio Effects -| name | example | -| ----- | -------------------------------------------------------------------------------------------------- | +| name | example | +| ----- | --------------------------------------------------------------------------------------- | | lpf | ")`} /> | | vowel | ")`} /> | | gain | | @@ -56,8 +56,8 @@ This page is just a listing of all functions covered in the workshop! ## Pattern Effects -| name | description | example | -| ---- | ----------------------------------- | ---------------------------------------------------------------------------------------------- | +| name | description | example | +| ---- | ----------------------------------- | ----------------------------------------------------------------------------------- | | cpm | sets the tempo in cycles per minute | | | fast | speed up | | | slow | slow down | | From 62cd2263c2048ec53f8bd92350a532b1a491108f Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 10 Jan 2024 00:03:18 +0100 Subject: [PATCH 30/55] add silent flag to nanFallback --- packages/superdough/util.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/superdough/util.mjs b/packages/superdough/util.mjs index cebabfda..4e3c7e41 100644 --- a/packages/superdough/util.mjs +++ b/packages/superdough/util.mjs @@ -54,9 +54,9 @@ export const valueToMidi = (value, fallbackValue) => { return fallbackValue; }; -export function nanFallback(value, fallback = 0) { +export function nanFallback(value, fallback = 0, silent) { if (isNaN(Number(value))) { - logger(`"${value}" is not a number, falling back to ${fallback}`, 'warning'); + !silent && logger(`"${value}" is not a number, falling back to ${fallback}`, 'warning'); return fallback; } return value; From f785823e0051c3951ea868816a5cbd12fc79f725 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 10 Jan 2024 00:08:13 +0100 Subject: [PATCH 31/55] add fenv to filter cutoff controls --- packages/core/controls.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 60372522..97129779 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -270,7 +270,7 @@ const generic_params = [ * s("bd sd,hh*3").bpf("<1000 2000 4000 8000>") * */ - [['bandf', 'bandq'], 'bpf', 'bp'], + [['bandf', 'bandq', 'bpenv'], 'bpf', 'bp'], // TODO: in tidal, it seems to be normalized /** * Sets the **b**and-**p**ass **q**-factor (resonance). @@ -481,7 +481,7 @@ const generic_params = [ * s("bd*8").lpf("1000:0 1000:10 1000:20 1000:30") * */ - [['cutoff', 'resonance'], 'ctf', 'lpf', 'lp'], + [['cutoff', 'resonance', 'lpenv'], 'ctf', 'lpf', 'lp'], /** * Sets the lowpass filter envelope modulation depth. @@ -758,7 +758,7 @@ const generic_params = [ * .vibmod("<.25 .5 1 2 12>:8") */ [['vibmod', 'vib'], 'vmod'], - [['hcutoff', 'hresonance'], 'hpf', 'hp'], + [['hcutoff', 'hresonance', 'hpenv'], 'hpf', 'hp'], /** * Controls the **h**igh-**p**ass **q**-value. * From f99557cc0567dba6f1c3ef74e559631f73c59b56 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 10 Jan 2024 00:08:49 +0100 Subject: [PATCH 32/55] fix: fanchor + default fanchor to 0 (breaking change) --- packages/superdough/helpers.mjs | 12 ++++++++---- packages/superdough/superdough.mjs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index ac22fc7c..99531eff 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -97,7 +97,7 @@ export const getADSRValues = (params, curve = 'linear', defaultValues) => { return [Math.max(a ?? 0, envmin), Math.max(d ?? 0, envmin), Math.min(sustain, envmax), Math.max(r ?? 0, releaseMin)]; }; -export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor = 0.5) { +export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor) { const curve = 'exponential'; const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], curve, [0.005, 0.14, 0, 0.1]); const filter = context.createBiquadFilter(); @@ -105,12 +105,16 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe filter.type = type; filter.Q.value = Q; filter.frequency.value = frequency; - + // envelope is active when any of these values is set + const hasEnvelope = att ?? dec ?? sus ?? rel ?? fenv; // Apply ADSR to filter frequency - if (!isNaN(fenv) && fenv !== 0) { + if (hasEnvelope !== undefined) { + fenv = nanFallback(fenv, 1, true); + fanchor = nanFallback(fanchor, 0, true); const offset = fenv * fanchor; + const min = clamp(2 ** -offset * frequency, 0, 20000); const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); - getParamADSR(filter.frequency, attack, decay, sustain, release, frequency, max, start, end, curve); + getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end, curve); return filter; } return filter; diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index f5674f2c..d03007f1 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -276,7 +276,7 @@ export const superdough = async (value, deadline, hapDuration) => { density = 0.03, // filters ftype = '12db', - fanchor = 0.5, + fanchor = 0, // low pass cutoff, lpenv, From c68dba8c21f429cf0a0a14cd911a660648d740ab Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 10 Jan 2024 14:28:38 +0100 Subject: [PATCH 33/55] fix: use end --- packages/superdough/sampler.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/superdough/sampler.mjs b/packages/superdough/sampler.mjs index 36f71277..932be995 100644 --- a/packages/superdough/sampler.mjs +++ b/packages/superdough/sampler.mjs @@ -302,11 +302,11 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) { bufferSource.start(time, offset); const envGain = ac.createGain(); const node = bufferSource.connect(envGain); - let holdEnd = t + duration; if (clip == null && loop == null && value.release == null) { const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value; - holdEnd = t + bufferDuration; + duration = (end - begin) * bufferDuration; } + let holdEnd = t + duration; getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear'); From f26fd18c7a8b2537d25c40f32dcf4b317d7cec9d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 10 Jan 2024 15:02:10 +0100 Subject: [PATCH 34/55] use 0.001 as linear mintime as well (to prevent cracks) --- packages/superdough/helpers.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 99531eff..43e435b8 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -86,7 +86,7 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) { // ex: sound(val).decay(val) will behave as a decay only envelope. sound(val).attack(val).decay(val) will behave like an "ad" env, etc. export const getADSRValues = (params, curve = 'linear', defaultValues) => { - const envmin = curve === 'exponential' ? 0.001 : 0; + const envmin = curve === 'exponential' ? 0.001 : 0.001; const releaseMin = 0.01; const envmax = 1; const [a, d, s, r] = params; From 6f3b2fa66b238fda198db544626a6687e58fe9d1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 00:26:16 +0100 Subject: [PATCH 35/55] negative fenv values now stay in the same range as positives --- packages/superdough/helpers.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 43e435b8..846130e8 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -111,9 +111,11 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe if (hasEnvelope !== undefined) { fenv = nanFallback(fenv, 1, true); fanchor = nanFallback(fanchor, 0, true); - const offset = fenv * fanchor; - const min = clamp(2 ** -offset * frequency, 0, 20000); - const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000); + const fenvAbs = Math.abs(fenv); + const offset = fenvAbs * fanchor; + let min = clamp(2 ** -offset * frequency, 0, 20000); + let max = clamp(2 ** (fenvAbs - offset) * frequency, 0, 20000); + if (fenv < 0) [min, max] = [max, min]; getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end, curve); return filter; } From 4fb5c1828d5310cd4be9c47ca4299fb9f3b0c557 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 01:16:26 +0100 Subject: [PATCH 36/55] i have no clue why this works --- packages/superdough/helpers.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 846130e8..bee26f38 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -37,13 +37,14 @@ export const getParamADSR = ( min = Math.max(0.0001, min); } const range = max - min; - const peak = min + range; + const peak = max; const sustainVal = min + sustain * range; const duration = end - begin; const envValAtTime = (time) => { if (attack > time) { - return time * getSlope(min, peak, 0, attack) + 0; + let slope = getSlope(min, peak, 0, attack); + return time * slope + (min > peak ? min : 0); } else { return (time - attack) * getSlope(peak, sustainVal, 0, decay) + peak; } From eefa90a2bc7416ba38bfbd9b803f36dfd0ccaaeb Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 22:24:59 +0100 Subject: [PATCH 37/55] fix: synth default envelope --- packages/superdough/synth.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index c4586e92..6a3e381a 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -29,12 +29,11 @@ export function registerSynthSounds() { registerSound( s, (t, value, onended) => { - const [attack, decay, sustain, release] = getADSRValues([ - value.attack, - value.decay, - value.sustain, - value.release, - ]); + const [attack, decay, sustain, release] = getADSRValues( + [value.attack, value.decay, value.sustain, value.release], + 'linear', + [0.001, 0.05, 0.6, 0.01], + ); let sound; if (waveforms.includes(s)) { From 3c1844046a4ca677891cec3a5df9db65618efb7d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 23:01:16 +0100 Subject: [PATCH 38/55] basic browse page --- website/database.types.ts | 120 ++++++++++++++++++++++ website/src/components/SharedPatterns.tsx | 54 ++++++++++ website/src/pages/browse.astro | 14 +++ 3 files changed, 188 insertions(+) create mode 100644 website/database.types.ts create mode 100644 website/src/components/SharedPatterns.tsx create mode 100644 website/src/pages/browse.astro diff --git a/website/database.types.ts b/website/database.types.ts new file mode 100644 index 00000000..152742b4 --- /dev/null +++ b/website/database.types.ts @@ -0,0 +1,120 @@ +// generated with https://supabase.com/docs/reference/javascript/typescript-support#generating-typescript-types +export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]; + +export interface Database { + public: { + Tables: { + code: { + Row: { + code: string | null; + created_at: string | null; + featured: boolean | null; + hash: string | null; + id: number; + public: boolean | null; + }; + Insert: { + code?: string | null; + created_at?: string | null; + featured?: boolean | null; + hash?: string | null; + id?: number; + public?: boolean | null; + }; + Update: { + code?: string | null; + created_at?: string | null; + featured?: boolean | null; + hash?: string | null; + id?: number; + public?: boolean | null; + }; + Relationships: []; + }; + }; + Views: { + [_ in never]: never; + }; + Functions: { + [_ in never]: never; + }; + Enums: { + [_ in never]: never; + }; + CompositeTypes: { + [_ in never]: never; + }; + }; +} + +export type Tables< + PublicTableNameOrOptions extends + | keyof (Database['public']['Tables'] & Database['public']['Views']) + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] & + Database[PublicTableNameOrOptions['schema']]['Views']) + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? (Database[PublicTableNameOrOptions['schema']]['Tables'] & + Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends { + Row: infer R; + } + ? R + : never + : PublicTableNameOrOptions extends keyof (Database['public']['Tables'] & Database['public']['Views']) + ? (Database['public']['Tables'] & Database['public']['Views'])[PublicTableNameOrOptions] extends { + Row: infer R; + } + ? R + : never + : never; + +export type TablesInsert< + PublicTableNameOrOptions extends keyof Database['public']['Tables'] | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Insert: infer I; + } + ? I + : never + : PublicTableNameOrOptions extends keyof Database['public']['Tables'] + ? Database['public']['Tables'][PublicTableNameOrOptions] extends { + Insert: infer I; + } + ? I + : never + : never; + +export type TablesUpdate< + PublicTableNameOrOptions extends keyof Database['public']['Tables'] | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Update: infer U; + } + ? U + : never + : PublicTableNameOrOptions extends keyof Database['public']['Tables'] + ? Database['public']['Tables'][PublicTableNameOrOptions] extends { + Update: infer U; + } + ? U + : never + : never; + +export type Enums< + PublicEnumNameOrOptions extends keyof Database['public']['Enums'] | { schema: keyof Database }, + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums'] + : never = never, +> = PublicEnumNameOrOptions extends { schema: keyof Database } + ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName] + : PublicEnumNameOrOptions extends keyof Database['public']['Enums'] + ? Database['public']['Enums'][PublicEnumNameOrOptions] + : never; diff --git a/website/src/components/SharedPatterns.tsx b/website/src/components/SharedPatterns.tsx new file mode 100644 index 00000000..4deab67e --- /dev/null +++ b/website/src/components/SharedPatterns.tsx @@ -0,0 +1,54 @@ +import { createClient } from '@supabase/supabase-js'; +import { useCallback, useEffect, useMemo, useState } from 'react'; +import type { Database, Tables } from '../../database.types'; +import { getMetadata } from '../metadata_parser'; + +function PatternLink({ pattern }: { pattern: Tables<'code'> }) { + const meta = useMemo(() => getMetadata(pattern.code), [pattern]); + // console.log('meta', meta); + return ( + + {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} + + ); +} + +export function SharedPatterns() { + const [publicPatterns, setPublicPatterns] = useState[] | null>([]); + const [featuredPatterns, setFeaturedPatterns] = useState[] | null>([]); + const init = useCallback(async () => { + const supabase = createClient( + 'https://pidxdsxphlhzjnzmifth.supabase.co', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBpZHhkc3hwaGxoempuem1pZnRoIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTYyMzA1NTYsImV4cCI6MTk3MTgwNjU1Nn0.bqlw7802fsWRnqU5BLYtmXk_k-D1VFmbkHMywWc15NM', + ); + const { data: _publicPatterns } = await supabase.from('code').select().eq('public', true).limit(20); + const { data: _featuredPatterns } = await supabase.from('code').select().eq('featured', true).limit(20); + setPublicPatterns(_publicPatterns); + setFeaturedPatterns(_featuredPatterns); + /* console.log('public', publicPatterns); + console.log('featured', featuredPatterns); */ + }, []); + useEffect(() => { + init(); + }, [useCallback]); + return ( +
+

Featured

+
+ {featuredPatterns?.map((pattern, i) => ( +
+ +
+ ))} +
+

Last Creations

+
+ {publicPatterns?.map((pattern, i) => ( +
+ +
+ ))} +
+
+ ); +} diff --git a/website/src/pages/browse.astro b/website/src/pages/browse.astro new file mode 100644 index 00000000..3e63bf87 --- /dev/null +++ b/website/src/pages/browse.astro @@ -0,0 +1,14 @@ +--- +import HeadCommon from '../components/HeadCommon.astro'; +import { SharedPatterns } from '../components/SharedPatterns'; +--- + + + + + +
+

Browse

+ +
+ From 1ede99f71e93ab105925408b090330b90ffd97bb Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 23:12:22 +0100 Subject: [PATCH 39/55] ask for public sharing (very cheap) + order browse list --- website/src/components/SharedPatterns.tsx | 16 +++++++++++++--- website/src/repl/util.mjs | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/website/src/components/SharedPatterns.tsx b/website/src/components/SharedPatterns.tsx index 4deab67e..bbd5cc8d 100644 --- a/website/src/components/SharedPatterns.tsx +++ b/website/src/components/SharedPatterns.tsx @@ -8,7 +8,7 @@ function PatternLink({ pattern }: { pattern: Tables<'code'> }) { // console.log('meta', meta); return ( - {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} + {pattern.id}. {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} ); } @@ -21,8 +21,18 @@ export function SharedPatterns() { 'https://pidxdsxphlhzjnzmifth.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBpZHhkc3hwaGxoempuem1pZnRoIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTYyMzA1NTYsImV4cCI6MTk3MTgwNjU1Nn0.bqlw7802fsWRnqU5BLYtmXk_k-D1VFmbkHMywWc15NM', ); - const { data: _publicPatterns } = await supabase.from('code').select().eq('public', true).limit(20); - const { data: _featuredPatterns } = await supabase.from('code').select().eq('featured', true).limit(20); + const { data: _publicPatterns } = await supabase + .from('code') + .select() + .eq('public', true) + .limit(20) + .order('id', { ascending: false }); + const { data: _featuredPatterns } = await supabase + .from('code') + .select() + .eq('featured', true) + .limit(20) + .order('id', { ascending: false }); setPublicPatterns(_publicPatterns); setFeaturedPatterns(_featuredPatterns); /* console.log('public', publicPatterns); diff --git a/website/src/repl/util.mjs b/website/src/repl/util.mjs index 81c41e9d..325417d7 100644 --- a/website/src/repl/util.mjs +++ b/website/src/repl/util.mjs @@ -90,10 +90,13 @@ export async function shareCode(codeToShare) { logger(`Link already generated!`, 'error'); return; } + const isPublic = confirm( + 'Do you want your pattern to be public? If no, press cancel and you will get just a private link.', + ); // generate uuid in the browser const hash = nanoid(12); const shareUrl = window.location.origin + window.location.pathname + '?' + hash; - const { data, error } = await supabase.from('code').insert([{ code: codeToShare, hash }]); + const { error } = await supabase.from('code').insert([{ code: codeToShare, hash, ['public']: isPublic }]); if (!error) { lastShared = codeToShare; // copy shareUrl to clipboard From 204c9640503b9691fe0f7c2e736af7060ab96e0c Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 13 Jan 2024 23:53:46 +0100 Subject: [PATCH 40/55] integrate public patterns into patterns tab --- website/src/components/SharedPatterns.tsx | 46 +++++++++----------- website/src/repl/panel/PatternsTab.jsx | 52 ++++++++++++++++++++++- website/src/repl/util.mjs | 10 ++++- website/src/settings.mjs | 31 +++++++++++++- 4 files changed, 108 insertions(+), 31 deletions(-) diff --git a/website/src/components/SharedPatterns.tsx b/website/src/components/SharedPatterns.tsx index bbd5cc8d..1cdca792 100644 --- a/website/src/components/SharedPatterns.tsx +++ b/website/src/components/SharedPatterns.tsx @@ -1,53 +1,43 @@ -import { createClient } from '@supabase/supabase-js'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import type { Database, Tables } from '../../database.types'; +import type { Tables } from '../../database.types'; import { getMetadata } from '../metadata_parser'; +import { loadFeaturedPatterns, loadPublicPatterns } from '../repl/util.mjs'; -function PatternLink({ pattern }: { pattern: Tables<'code'> }) { +export function PatternLabel({ pattern }: { pattern: Tables<'code'> }) { const meta = useMemo(() => getMetadata(pattern.code), [pattern]); - // console.log('meta', meta); return ( - + <> {pattern.id}. {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} - + ); } -export function SharedPatterns() { +export const usePublicPatterns = () => { const [publicPatterns, setPublicPatterns] = useState[] | null>([]); const [featuredPatterns, setFeaturedPatterns] = useState[] | null>([]); const init = useCallback(async () => { - const supabase = createClient( - 'https://pidxdsxphlhzjnzmifth.supabase.co', - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBpZHhkc3hwaGxoempuem1pZnRoIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTYyMzA1NTYsImV4cCI6MTk3MTgwNjU1Nn0.bqlw7802fsWRnqU5BLYtmXk_k-D1VFmbkHMywWc15NM', - ); - const { data: _publicPatterns } = await supabase - .from('code') - .select() - .eq('public', true) - .limit(20) - .order('id', { ascending: false }); - const { data: _featuredPatterns } = await supabase - .from('code') - .select() - .eq('featured', true) - .limit(20) - .order('id', { ascending: false }); + const { data: _publicPatterns } = await loadPublicPatterns(); + const { data: _featuredPatterns } = await loadFeaturedPatterns(); setPublicPatterns(_publicPatterns); setFeaturedPatterns(_featuredPatterns); - /* console.log('public', publicPatterns); - console.log('featured', featuredPatterns); */ }, []); useEffect(() => { init(); }, [useCallback]); + return { publicPatterns, featuredPatterns }; +}; + +export function SharedPatterns() { + const { publicPatterns, featuredPatterns } = usePublicPatterns(); return (

Featured

{featuredPatterns?.map((pattern, i) => (
- + + +
))}
@@ -55,7 +45,9 @@ export function SharedPatterns() {
{publicPatterns?.map((pattern, i) => (
- + + +
))}
diff --git a/website/src/repl/panel/PatternsTab.jsx b/website/src/repl/panel/PatternsTab.jsx index 4466b599..a3d67460 100644 --- a/website/src/repl/panel/PatternsTab.jsx +++ b/website/src/repl/panel/PatternsTab.jsx @@ -1,6 +1,8 @@ import { DocumentDuplicateIcon, PencilSquareIcon, TrashIcon } from '@heroicons/react/20/solid'; import { useMemo } from 'react'; import { + $featuredPatterns, + $publicPatterns, clearUserPatterns, deleteActivePattern, duplicateActivePattern, @@ -14,6 +16,8 @@ import { useSettings, } from '../../settings.mjs'; import * as tunes from '../tunes.mjs'; +import { PatternLabel } from '../../components/SharedPatterns'; +import { useStore } from '@nanostores/react'; function classNames(...classes) { return classes.filter(Boolean).join(' '); @@ -22,6 +26,8 @@ function classNames(...classes) { export function PatternsTab({ context }) { const { userPatterns } = useSettings(); const activePattern = useActivePattern(); + const featuredPatterns = useStore($featuredPatterns); + const publicPatterns = useStore($publicPatterns); const isExample = useMemo(() => activePattern && !!tunes[activePattern], [activePattern]); return (
@@ -94,8 +100,52 @@ export function PatternsTab({ context }) {
+ {featuredPatterns && ( +
+

Featured Patterns

+ +
+ )} + {publicPatterns && ( +
+

Last Creations

+ +
+ )}
-

Examples

+

Stock Examples

{Object.entries(tunes).map(([key, tune]) => ( { } initializeAudioOutput(); }; + +export function loadPublicPatterns() { + return supabase.from('code').select().eq('public', true).limit(20).order('id', { ascending: false }); +} + +export function loadFeaturedPatterns() { + return supabase.from('code').select().eq('featured', true).limit(20).order('id', { ascending: false }); +} diff --git a/website/src/settings.mjs b/website/src/settings.mjs index 0e433806..2f973a2f 100644 --- a/website/src/settings.mjs +++ b/website/src/settings.mjs @@ -1,8 +1,22 @@ +import { atom } from 'nanostores'; import { persistentMap, persistentAtom } from '@nanostores/persistent'; import { useStore } from '@nanostores/react'; import { register } from '@strudel.cycles/core'; import * as tunes from './repl/tunes.mjs'; import { logger } from '@strudel.cycles/core'; +import { loadPublicPatterns, loadFeaturedPatterns } from './repl/util.mjs'; + +export let $publicPatterns = atom([]); +export let $featuredPatterns = atom([]); + +async function loadDBPatterns() { + const { data: publicPatterns } = await loadPublicPatterns(); + $publicPatterns.set(publicPatterns); + const { data: featuredPatterns } = await loadFeaturedPatterns(); + $featuredPatterns.set(featuredPatterns); +} + +loadDBPatterns(); export const defaultAudioDeviceName = 'System Standard'; @@ -172,12 +186,25 @@ export function updateUserCode(code) { setActivePattern(example); return; } - + const publicPattern = $publicPatterns.get().find((pat) => pat.code === code); + if (publicPattern) { + setActivePattern(publicPattern.hash); + return; + } + const featuredPattern = $featuredPatterns.get().find((pat) => pat.code === code); + if (featuredPattern) { + setActivePattern(featuredPattern.hash); + return; + } if (!activePattern) { // create new user pattern activePattern = newUserPattern(); setActivePattern(activePattern); - } else if (!!tunes[activePattern] && code !== tunes[activePattern]) { + } else if ( + (!!tunes[activePattern] && code !== tunes[activePattern]) || // fork example tune? + $publicPatterns.get().find((p) => p.hash === activePattern) || // fork public pattern? + $featuredPatterns.get().find((p) => p.hash === activePattern) // fork featured pattern? + ) { // fork example activePattern = getNextCloneName(activePattern); setActivePattern(activePattern); From 5314c83534db1d28d158c274417a08eb15bec4b7 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 00:02:27 +0100 Subject: [PATCH 41/55] delete browse page for now --- website/src/components/SharedPatterns.tsx | 56 ----------------------- website/src/pages/browse.astro | 14 ------ website/src/repl/panel/PatternsTab.jsx | 11 ++++- 3 files changed, 10 insertions(+), 71 deletions(-) delete mode 100644 website/src/components/SharedPatterns.tsx delete mode 100644 website/src/pages/browse.astro diff --git a/website/src/components/SharedPatterns.tsx b/website/src/components/SharedPatterns.tsx deleted file mode 100644 index 1cdca792..00000000 --- a/website/src/components/SharedPatterns.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; -import type { Tables } from '../../database.types'; -import { getMetadata } from '../metadata_parser'; -import { loadFeaturedPatterns, loadPublicPatterns } from '../repl/util.mjs'; - -export function PatternLabel({ pattern }: { pattern: Tables<'code'> }) { - const meta = useMemo(() => getMetadata(pattern.code), [pattern]); - return ( - <> - {pattern.id}. {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} - - ); -} - -export const usePublicPatterns = () => { - const [publicPatterns, setPublicPatterns] = useState[] | null>([]); - const [featuredPatterns, setFeaturedPatterns] = useState[] | null>([]); - const init = useCallback(async () => { - const { data: _publicPatterns } = await loadPublicPatterns(); - const { data: _featuredPatterns } = await loadFeaturedPatterns(); - setPublicPatterns(_publicPatterns); - setFeaturedPatterns(_featuredPatterns); - }, []); - useEffect(() => { - init(); - }, [useCallback]); - return { publicPatterns, featuredPatterns }; -}; - -export function SharedPatterns() { - const { publicPatterns, featuredPatterns } = usePublicPatterns(); - return ( -
-

Featured

-
- {featuredPatterns?.map((pattern, i) => ( - - ))} -
-

Last Creations

-
- {publicPatterns?.map((pattern, i) => ( -
- - - -
- ))} -
-
- ); -} diff --git a/website/src/pages/browse.astro b/website/src/pages/browse.astro deleted file mode 100644 index 3e63bf87..00000000 --- a/website/src/pages/browse.astro +++ /dev/null @@ -1,14 +0,0 @@ ---- -import HeadCommon from '../components/HeadCommon.astro'; -import { SharedPatterns } from '../components/SharedPatterns'; ---- - - - - - -
-

Browse

- -
- diff --git a/website/src/repl/panel/PatternsTab.jsx b/website/src/repl/panel/PatternsTab.jsx index a3d67460..1b5ecef6 100644 --- a/website/src/repl/panel/PatternsTab.jsx +++ b/website/src/repl/panel/PatternsTab.jsx @@ -16,8 +16,8 @@ import { useSettings, } from '../../settings.mjs'; import * as tunes from '../tunes.mjs'; -import { PatternLabel } from '../../components/SharedPatterns'; import { useStore } from '@nanostores/react'; +import { getMetadata } from '../../metadata_parser'; function classNames(...classes) { return classes.filter(Boolean).join(' '); @@ -167,3 +167,12 @@ export function PatternsTab({ context }) {
); } + +export function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) { + const meta = useMemo(() => getMetadata(pattern.code), [pattern]); + return ( + <> + {pattern.id}. {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} + + ); +} From f38758934234ba38028e05820d47c5cf3c93128d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 00:53:43 +0100 Subject: [PATCH 42/55] hotfix: fix build error --- website/src/settings.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/src/settings.mjs b/website/src/settings.mjs index 2f973a2f..286eb52d 100644 --- a/website/src/settings.mjs +++ b/website/src/settings.mjs @@ -16,7 +16,9 @@ async function loadDBPatterns() { $featuredPatterns.set(featuredPatterns); } -loadDBPatterns(); +if (typeof window !== 'undefined') { + loadDBPatterns(); +} export const defaultAudioDeviceName = 'System Standard'; From 6d32d4024d9ffce0f8c484966bbc1a366786a646 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 01:08:01 +0100 Subject: [PATCH 43/55] hotfix: fix built version loading at runtime.. --- website/src/repl/util.mjs | 32 ++++++++++++++++++++++++-------- website/src/settings.mjs | 12 ------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/website/src/repl/util.mjs b/website/src/repl/util.mjs index adb99b3d..3405e93d 100644 --- a/website/src/repl/util.mjs +++ b/website/src/repl/util.mjs @@ -9,6 +9,7 @@ import { createClient } from '@supabase/supabase-js'; import { nanoid } from 'nanoid'; import { writeText } from '@tauri-apps/api/clipboard'; import { createContext } from 'react'; +import { $publicPatterns, $featuredPatterns } from '../settings.mjs'; // Create a single supabase client for interacting with your database export const supabase = createClient( @@ -16,6 +17,29 @@ export const supabase = createClient( 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBpZHhkc3hwaGxoempuem1pZnRoIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTYyMzA1NTYsImV4cCI6MTk3MTgwNjU1Nn0.bqlw7802fsWRnqU5BLYtmXk_k-D1VFmbkHMywWc15NM', ); +export function loadPublicPatterns() { + return supabase.from('code').select().eq('public', true).limit(20).order('id', { ascending: false }); +} + +export function loadFeaturedPatterns() { + return supabase.from('code').select().eq('featured', true).limit(20).order('id', { ascending: false }); +} + +async function loadDBPatterns() { + try { + const { data: publicPatterns } = await loadPublicPatterns(); + const { data: featuredPatterns } = await loadFeaturedPatterns(); + $publicPatterns.set(publicPatterns); + $featuredPatterns.set(featuredPatterns); + } catch (err) { + console.error('error loading patterns'); + } +} + +if (typeof window !== 'undefined') { + loadDBPatterns(); +} + export async function initCode() { // load code from url hash (either short hash from database or decode long hash) try { @@ -150,11 +174,3 @@ export const setAudioDevice = async (id) => { } initializeAudioOutput(); }; - -export function loadPublicPatterns() { - return supabase.from('code').select().eq('public', true).limit(20).order('id', { ascending: false }); -} - -export function loadFeaturedPatterns() { - return supabase.from('code').select().eq('featured', true).limit(20).order('id', { ascending: false }); -} diff --git a/website/src/settings.mjs b/website/src/settings.mjs index 286eb52d..00237022 100644 --- a/website/src/settings.mjs +++ b/website/src/settings.mjs @@ -4,22 +4,10 @@ import { useStore } from '@nanostores/react'; import { register } from '@strudel.cycles/core'; import * as tunes from './repl/tunes.mjs'; import { logger } from '@strudel.cycles/core'; -import { loadPublicPatterns, loadFeaturedPatterns } from './repl/util.mjs'; export let $publicPatterns = atom([]); export let $featuredPatterns = atom([]); -async function loadDBPatterns() { - const { data: publicPatterns } = await loadPublicPatterns(); - $publicPatterns.set(publicPatterns); - const { data: featuredPatterns } = await loadFeaturedPatterns(); - $featuredPatterns.set(featuredPatterns); -} - -if (typeof window !== 'undefined') { - loadDBPatterns(); -} - export const defaultAudioDeviceName = 'System Standard'; export const defaultSettings = { From 53771d7f95d3dee532a5f6799b26cf98ae4676b7 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 01:50:48 +0100 Subject: [PATCH 44/55] hotfix: avoid crash for anonymous patterns --- website/src/repl/panel/PatternsTab.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/repl/panel/PatternsTab.jsx b/website/src/repl/panel/PatternsTab.jsx index 1b5ecef6..cec165c1 100644 --- a/website/src/repl/panel/PatternsTab.jsx +++ b/website/src/repl/panel/PatternsTab.jsx @@ -172,7 +172,7 @@ export function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) { const meta = useMemo(() => getMetadata(pattern.code), [pattern]); return ( <> - {pattern.id}. {meta.title || pattern.hash} by {meta.by.join(',') || 'Anonymous'} + {pattern.id}. {meta.title || pattern.hash} by {Array.isArray(meta.by) ? meta.by.join(',') : 'Anonymous'} ); } From 0d6bdfb514368d952344d313b72d9c63536a9973 Mon Sep 17 00:00:00 2001 From: Alex McLean Date: Sun, 14 Jan 2024 10:14:43 +0000 Subject: [PATCH 45/55] Link to creative commons chooser --- website/src/pages/learn/metadata.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/learn/metadata.mdx b/website/src/pages/learn/metadata.mdx index 9ade4447..a5d17362 100644 --- a/website/src/pages/learn/metadata.mdx +++ b/website/src/pages/learn/metadata.mdx @@ -50,7 +50,7 @@ Available tags are: - `@title`: music title - `@by`: music author(s), separated by comma, eventually followed with a link in `<>` (ex: `@by John Doe `) -- `@license`: music license(s) +- `@license`: music license(s), e.g. CC BY-NC-SA. Unsure? [Choose yours here](https://creativecommons.org/choose/) - `@details`: some additional information about the music - `@url`: web page(s) related to the music (git repo, soundcloud link, etc.) - `@genre`: music genre(s) (pop, jazz, etc) From 945e7082cdaad80057e3b6f2d83f77eb5da265c5 Mon Sep 17 00:00:00 2001 From: Alex McLean Date: Sun, 14 Jan 2024 10:15:40 +0000 Subject: [PATCH 46/55] Update metadata.mdx --- website/src/pages/learn/metadata.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/learn/metadata.mdx b/website/src/pages/learn/metadata.mdx index a5d17362..e8bb86df 100644 --- a/website/src/pages/learn/metadata.mdx +++ b/website/src/pages/learn/metadata.mdx @@ -50,7 +50,7 @@ Available tags are: - `@title`: music title - `@by`: music author(s), separated by comma, eventually followed with a link in `<>` (ex: `@by John Doe `) -- `@license`: music license(s), e.g. CC BY-NC-SA. Unsure? [Choose yours here](https://creativecommons.org/choose/) +- `@license`: music license(s), e.g. CC BY-NC-SA. Unsure? [Choose a creative commons license here](https://creativecommons.org/choose/) - `@details`: some additional information about the music - `@url`: web page(s) related to the music (git repo, soundcloud link, etc.) - `@genre`: music genre(s) (pop, jazz, etc) From e6d028fd6b0771de26d1fd88c97c52ed3af847e7 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 16:27:11 +0100 Subject: [PATCH 47/55] soundfont mixing --- packages/soundfonts/fontloader.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/soundfonts/fontloader.mjs b/packages/soundfonts/fontloader.mjs index 8d8fb02b..dc3f4b61 100644 --- a/packages/soundfonts/fontloader.mjs +++ b/packages/soundfonts/fontloader.mjs @@ -146,7 +146,7 @@ export function registerSoundfonts() { const envGain = ctx.createGain(); const node = bufferSource.connect(envGain); const holdEnd = time + duration; - getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, time, holdEnd, 'linear'); + getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, time, holdEnd, 'linear'); let envEnd = holdEnd + release + 0.01; bufferSource.stop(envEnd); From 090194856413b3dcf4d7a6a9dd67aedc7b742ab1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 21:32:38 +0100 Subject: [PATCH 48/55] fanchor default to 0.5 for now --- packages/superdough/superdough.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index d03007f1..f5674f2c 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -276,7 +276,7 @@ export const superdough = async (value, deadline, hapDuration) => { density = 0.03, // filters ftype = '12db', - fanchor = 0, + fanchor = 0.5, // low pass cutoff, lpenv, From 0566b7bcb373fe20fe6316afabc96b68897780b9 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 23:16:09 +0100 Subject: [PATCH 49/55] basic blog with release notes --- pnpm-lock.yaml | 7 + website/.astro/types.d.ts | 206 ++++++++++++++++++ website/package.json | 1 + website/src/components/BlogPost.astro | 21 ++ website/src/components/Header/Header.astro | 2 +- .../components/PageContent/PageContent.astro | 11 +- .../components/RightSidebar/MoreMenu.astro | 2 +- .../RightSidebar/RightSidebar.astro | 2 +- website/src/config.ts | 1 + .../content/blog/release-0.0.2-schwindlig.mdx | 42 ++++ .../blog/release-0.0.2.1-stuermisch.mdx | 55 +++++ .../content/blog/release-0.0.3-maelstrom.mdx | 68 ++++++ .../src/content/blog/release-0.0.4-gischt.mdx | 47 ++++ .../content/blog/release-0.3.0-donauwelle.mdx | 67 ++++++ .../content/blog/release-0.4.0-brandung.mdx | 17 ++ .../src/content/blog/release-0.5.0-wirbel.mdx | 61 ++++++ .../blog/release-0.6.0-zimtschnecke.mdx | 86 ++++++++ .../content/blog/release-0.7.0-zuckerguss.mdx | 90 ++++++++ .../blog/release-0.8.0-himbeermuffin.mdx | 130 +++++++++++ .../blog/release-0.9.0-bananenbrot.mdx | 114 ++++++++++ website/src/content/config.ts | 24 ++ website/src/env.d.ts | 2 + website/src/pages/blog.astro | 45 ++++ 23 files changed, 1089 insertions(+), 12 deletions(-) create mode 100644 website/.astro/types.d.ts create mode 100644 website/src/components/BlogPost.astro create mode 100644 website/src/content/blog/release-0.0.2-schwindlig.mdx create mode 100644 website/src/content/blog/release-0.0.2.1-stuermisch.mdx create mode 100644 website/src/content/blog/release-0.0.3-maelstrom.mdx create mode 100644 website/src/content/blog/release-0.0.4-gischt.mdx create mode 100644 website/src/content/blog/release-0.3.0-donauwelle.mdx create mode 100644 website/src/content/blog/release-0.4.0-brandung.mdx create mode 100644 website/src/content/blog/release-0.5.0-wirbel.mdx create mode 100644 website/src/content/blog/release-0.6.0-zimtschnecke.mdx create mode 100644 website/src/content/blog/release-0.7.0-zuckerguss.mdx create mode 100644 website/src/content/blog/release-0.8.0-himbeermuffin.mdx create mode 100644 website/src/content/blog/release-0.9.0-bananenbrot.mdx create mode 100644 website/src/content/config.ts create mode 100644 website/src/pages/blog.astro diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8b6e007..1fb74b48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -586,6 +586,9 @@ importers: claviature: specifier: ^0.1.0 version: 0.1.0 + date-fns: + specifier: ^3.2.0 + version: 3.2.0 nanoid: specifier: ^5.0.4 version: 5.0.4 @@ -6220,6 +6223,10 @@ packages: engines: {node: '>= 12'} dev: true + /date-fns@3.2.0: + resolution: {integrity: sha512-E4KWKavANzeuusPi0jUjpuI22SURAznGkx7eZV+4i6x2A+IZxAMcajgkvuDAU1bg40+xuhW1zRdVIIM/4khuIg==} + dev: false + /dateformat@3.0.3: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true diff --git a/website/.astro/types.d.ts b/website/.astro/types.d.ts new file mode 100644 index 00000000..ea8fd38b --- /dev/null +++ b/website/.astro/types.d.ts @@ -0,0 +1,206 @@ +declare module 'astro:content' { + interface Render { + '.mdx': Promise<{ + Content: import('astro').MarkdownInstance<{}>['Content']; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + }>; + } +} + +declare module 'astro:content' { + interface Render { + '.md': Promise<{ + Content: import('astro').MarkdownInstance<{}>['Content']; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + }>; + } +} + +declare module 'astro:content' { + export { z } from 'astro/zod'; + + type Flatten = T extends { [K: string]: infer U } ? U : never; + + export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; + + export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; + + // This needs to be in sync with ImageMetadata + export type ImageFunction = () => import('astro/zod').ZodObject<{ + src: import('astro/zod').ZodString; + width: import('astro/zod').ZodNumber; + height: import('astro/zod').ZodNumber; + format: import('astro/zod').ZodUnion< + [ + import('astro/zod').ZodLiteral<'png'>, + import('astro/zod').ZodLiteral<'jpg'>, + import('astro/zod').ZodLiteral<'jpeg'>, + import('astro/zod').ZodLiteral<'tiff'>, + import('astro/zod').ZodLiteral<'webp'>, + import('astro/zod').ZodLiteral<'gif'>, + import('astro/zod').ZodLiteral<'svg'>, + import('astro/zod').ZodLiteral<'avif'>, + ] + >; + }>; + + type BaseSchemaWithoutEffects = + | import('astro/zod').AnyZodObject + | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> + | import('astro/zod').ZodDiscriminatedUnion + | import('astro/zod').ZodIntersection; + + type BaseSchema = + | BaseSchemaWithoutEffects + | import('astro/zod').ZodEffects; + + export type SchemaContext = { image: ImageFunction }; + + type DataCollectionConfig = { + type: 'data'; + schema?: S | ((context: SchemaContext) => S); + }; + + type ContentCollectionConfig = { + type?: 'content'; + schema?: S | ((context: SchemaContext) => S); + }; + + type CollectionConfig = ContentCollectionConfig | DataCollectionConfig; + + export function defineCollection( + input: CollectionConfig + ): CollectionConfig; + + type AllValuesOf = T extends any ? T[keyof T] : never; + type ValidContentEntrySlug = AllValuesOf< + ContentEntryMap[C] + >['slug']; + + export function getEntryBySlug< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + // Note that this has to accept a regular string too, for SSR + entrySlug: E + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + + export function getDataEntryById( + collection: C, + entryId: E + ): Promise>; + + export function getCollection>( + collection: C, + filter?: (entry: CollectionEntry) => entry is E + ): Promise; + export function getCollection( + collection: C, + filter?: (entry: CollectionEntry) => unknown + ): Promise[]>; + + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >(entry: { + collection: C; + slug: E; + }): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >(entry: { + collection: C; + id: E; + }): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + slug: E + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >( + collection: C, + id: E + ): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + + /** Resolve an array of entry references from the same collection */ + export function getEntries( + entries: { + collection: C; + slug: ValidContentEntrySlug; + }[] + ): Promise[]>; + export function getEntries( + entries: { + collection: C; + id: keyof DataEntryMap[C]; + }[] + ): Promise[]>; + + export function reference( + collection: C + ): import('astro/zod').ZodEffects< + import('astro/zod').ZodString, + C extends keyof ContentEntryMap + ? { + collection: C; + slug: ValidContentEntrySlug; + } + : { + collection: C; + id: keyof DataEntryMap[C]; + } + >; + // Allow generic `string` to avoid excessive type errors in the config + // if `dev` is not running to update as you edit. + // Invalid collection names will be caught at build time. + export function reference( + collection: C + ): import('astro/zod').ZodEffects; + + type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; + type InferEntrySchema = import('astro/zod').infer< + ReturnTypeOrOriginal['schema']> + >; + + type ContentEntryMap = { + "blog": { +"hello.mdx": { + id: "hello.mdx"; + slug: "hello"; + body: string; + collection: "blog"; + data: any +} & { render(): Render[".mdx"] }; +}; + + }; + + type DataEntryMap = { + + }; + + type AnyEntryMap = ContentEntryMap & DataEntryMap; + + type ContentConfig = never; +} diff --git a/website/package.json b/website/package.json index a324821b..0f1e1e8a 100644 --- a/website/package.json +++ b/website/package.json @@ -48,6 +48,7 @@ "astro": "^4.0.8", "canvas": "^2.11.2", "claviature": "^0.1.0", + "date-fns": "^3.2.0", "nanoid": "^5.0.4", "nanostores": "^0.9.5", "react": "^18.2.0", diff --git a/website/src/components/BlogPost.astro b/website/src/components/BlogPost.astro new file mode 100644 index 00000000..1fdb5a1a --- /dev/null +++ b/website/src/components/BlogPost.astro @@ -0,0 +1,21 @@ +--- +import type { CollectionEntry } from 'astro:content'; + +type Props = CollectionEntry<'blog'>['data']; + +const { post } = Astro.props; +const { Content } = await post.render(); +--- + +
+
+
+

{post.title}

+
+
+
+ +
+
diff --git a/website/src/components/Header/Header.astro b/website/src/components/Header/Header.astro index 6447d9d6..cbc91ca0 100644 --- a/website/src/components/Header/Header.astro +++ b/website/src/components/Header/Header.astro @@ -9,7 +9,7 @@ import MobileNav from '../../docs/MobileNav'; import { SIDEBAR } from '../../config'; type Props = { - currentPage: string; + currentPage?: string; }; const { currentPage } = Astro.props as Props; diff --git a/website/src/components/PageContent/PageContent.astro b/website/src/components/PageContent/PageContent.astro index 9c433945..c53053af 100644 --- a/website/src/components/PageContent/PageContent.astro +++ b/website/src/components/PageContent/PageContent.astro @@ -1,18 +1,11 @@ --- -import type { Frontmatter } from '../../config'; import MoreMenu from '../RightSidebar/MoreMenu.astro'; -import TableOfContents from '../RightSidebar/TableOfContents'; -import type { MarkdownHeading } from 'astro'; type Props = { - frontmatter: Frontmatter; - headings: MarkdownHeading[]; - githubEditUrl: string; + githubEditUrl?: string; }; -const { frontmatter, headings, githubEditUrl } = Astro.props as Props; -const title = frontmatter.title; -const currentPage = Astro.url.pathname; +const { githubEditUrl } = Astro.props as Props; ---
diff --git a/website/src/components/RightSidebar/MoreMenu.astro b/website/src/components/RightSidebar/MoreMenu.astro index 1cf1c4e5..5205c9c5 100644 --- a/website/src/components/RightSidebar/MoreMenu.astro +++ b/website/src/components/RightSidebar/MoreMenu.astro @@ -2,7 +2,7 @@ import * as CONFIG from '../../config'; type Props = { - editHref: string; + editHref?: string; }; const { editHref } = Astro.props as Props; diff --git a/website/src/components/RightSidebar/RightSidebar.astro b/website/src/components/RightSidebar/RightSidebar.astro index ba193d24..cd501b1a 100644 --- a/website/src/components/RightSidebar/RightSidebar.astro +++ b/website/src/components/RightSidebar/RightSidebar.astro @@ -6,7 +6,7 @@ import AvatarList from '../Footer/AvatarList.astro'; type Props = { headings: MarkdownHeading[]; - githubEditUrl: string; + githubEditUrl?: string; }; const { headings, githubEditUrl } = Astro.props as Props; diff --git a/website/src/config.ts b/website/src/config.ts index fc904bfa..effc593c 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -57,6 +57,7 @@ export const SIDEBAR: Sidebar = { Presentation: [ { text: 'What is Strudel?', link: 'workshop/getting-started' }, { text: 'Showcase', link: 'intro/showcase' }, + { text: 'Blog', link: 'blog' }, ], Workshop: [ // { text: 'Getting Started', link: 'workshop/getting-started' }, diff --git a/website/src/content/blog/release-0.0.2-schwindlig.mdx b/website/src/content/blog/release-0.0.2-schwindlig.mdx new file mode 100644 index 00000000..3cb9b50b --- /dev/null +++ b/website/src/content/blog/release-0.0.2-schwindlig.mdx @@ -0,0 +1,42 @@ +--- +title: 'Release Notes v0.0.2 Schwindlig' +description: '' +date: '2022-03-28' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.0.2 Schwindlig + +## What's Changed + +- Most work done as [commits to main](https://github.com/tidalcycles/strudel/commits/2a0d8c3f77ff7b34e82602e2d02400707f367316) +- repl + reify functions by @felixroos in https://github.com/tidalcycles/strudel/pull/2 +- Fix path by @yaxu in https://github.com/tidalcycles/strudel/pull/3 +- update readme for local dev by @kindohm in https://github.com/tidalcycles/strudel/pull/4 +- Patternify all the things by @yaxu in https://github.com/tidalcycles/strudel/pull/5 +- krill parser + improved repl by @felixroos in https://github.com/tidalcycles/strudel/pull/6 +- fixed editor crash by @felixroos in https://github.com/tidalcycles/strudel/pull/7 +- timeCat by @yaxu in https://github.com/tidalcycles/strudel/pull/8 +- Bugfix every, and create more top level functions by @yaxu in https://github.com/tidalcycles/strudel/pull/9 +- Failing test for `when` WIP by @yaxu in https://github.com/tidalcycles/strudel/pull/10 +- Added mask() and struct() by @yaxu in https://github.com/tidalcycles/strudel/pull/11 +- Add continuous signals (sine, cosine, saw, etc) by @yaxu in https://github.com/tidalcycles/strudel/pull/13 +- add apply and layer, and missing div/mul methods by @yaxu in https://github.com/tidalcycles/strudel/pull/15 +- higher latencyHint by @felixroos in https://github.com/tidalcycles/strudel/pull/16 +- test: 📦 Add missing dependency and a CI check, to prevent oversights ;p by @puria in https://github.com/tidalcycles/strudel/pull/17 +- fix: 💄 Enhance visualisation of the Tutorial on mobile by @puria in https://github.com/tidalcycles/strudel/pull/19 +- Stateful queries and events (WIP) by @yaxu in https://github.com/tidalcycles/strudel/pull/14 +- Fix resolveState by @yaxu in https://github.com/tidalcycles/strudel/pull/22 +- added \_asNumber + interprete numbers as midi by @felixroos in https://github.com/tidalcycles/strudel/pull/21 +- Update package.json by @ChiakiUehira in https://github.com/tidalcycles/strudel/pull/23 +- packaging by @felixroos in https://github.com/tidalcycles/strudel/pull/24 + +## New Contributors + +- @felixroos made their first contribution in https://github.com/tidalcycles/strudel/pull/2 +- @kindohm made their first contribution in https://github.com/tidalcycles/strudel/pull/4 +- @puria made their first contribution in https://github.com/tidalcycles/strudel/pull/17 +- @ChiakiUehira made their first contribution in https://github.com/tidalcycles/strudel/pull/23 + +**Full Changelog**: https://github.com/tidalcycles/strudel/commits/2a0d8c3f77ff7b34e82602e2d02400707f367316 diff --git a/website/src/content/blog/release-0.0.2.1-stuermisch.mdx b/website/src/content/blog/release-0.0.2.1-stuermisch.mdx new file mode 100644 index 00000000..28da1a8f --- /dev/null +++ b/website/src/content/blog/release-0.0.2.1-stuermisch.mdx @@ -0,0 +1,55 @@ +--- +title: 'Release Notes v0.0.3 Stürmisch' +date: '2022-05-20' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.0.2.1 Stürmisch + +## What's Changed + +- Add chunk, chunkBack and iterBack by @yaxu in https://github.com/tidalcycles/strudel/pull/25 +- Update tutorial.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/37 +- Update tutorial.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/38 +- Compose by @felixroos in https://github.com/tidalcycles/strudel/pull/40 +- Fix polymeter by @yaxu in https://github.com/tidalcycles/strudel/pull/44 +- First run at squeezeBind, ref #32 by @yaxu in https://github.com/tidalcycles/strudel/pull/48 +- Implement `chop()` by @yaxu in https://github.com/tidalcycles/strudel/pull/50 +- OSC and SuperDirt support by @yaxu in https://github.com/tidalcycles/strudel/pull/27 +- More functions by @yaxu in https://github.com/tidalcycles/strudel/pull/56 +- More functions by @yaxu in https://github.com/tidalcycles/strudel/pull/61 +- Separate out strudel.mjs, make index.mjs aggregate module by @yaxu in https://github.com/tidalcycles/strudel/pull/62 +- Speech output by @felixroos in https://github.com/tidalcycles/strudel/pull/67 +- use new fixed version of osc-js package by @felixroos in https://github.com/tidalcycles/strudel/pull/68 +- First effort at rand() by @yaxu in https://github.com/tidalcycles/strudel/pull/69 +- More randomness, fix `rand`, and add `brand`, `irand` and `choose` by @yaxu in https://github.com/tidalcycles/strudel/pull/70 +- webaudio package by @felixroos in https://github.com/tidalcycles/strudel/pull/26 +- Port `perlin` noise, `rangex`, and `palindrome` by @yaxu in https://github.com/tidalcycles/strudel/pull/73 +- More random functions by @yaxu in https://github.com/tidalcycles/strudel/pull/74 +- Try to fix appLeft / appRight by @yaxu in https://github.com/tidalcycles/strudel/pull/75 +- Basic webserial support by @yaxu in https://github.com/tidalcycles/strudel/pull/80 +- Webaudio in REPL by @felixroos in https://github.com/tidalcycles/strudel/pull/77 +- add `striate()` by @yaxu in https://github.com/tidalcycles/strudel/pull/76 +- Tidy up a couple of old files by @mindofmatthew in https://github.com/tidalcycles/strudel/pull/84 +- Add pattern composers, implements #82 by @yaxu in https://github.com/tidalcycles/strudel/pull/83 +- Fiddles with cat/stack by @yaxu in https://github.com/tidalcycles/strudel/pull/90 +- Paper by @felixroos in https://github.com/tidalcycles/strudel/pull/98 +- Change to Affero GPL by @yaxu in https://github.com/tidalcycles/strudel/pull/101 +- Work on Codemirror 6 highlighting by @mindofmatthew in https://github.com/tidalcycles/strudel/pull/102 +- Codemirror 6 by @felixroos in https://github.com/tidalcycles/strudel/pull/97 +- Tune tests by @felixroos in https://github.com/tidalcycles/strudel/pull/104 +- /embed package: web component for repl by @felixroos in https://github.com/tidalcycles/strudel/pull/106 +- Reset, Restart and other composers by @felixroos in https://github.com/tidalcycles/strudel/pull/88 +- Embed style by @felixroos in https://github.com/tidalcycles/strudel/pull/109 +- In source doc by @yaxu in https://github.com/tidalcycles/strudel/pull/105 +- `.brak()`, `.inside()` and `.outside()` by @yaxu in https://github.com/tidalcycles/strudel/pull/112 +- loopAt by @yaxu in https://github.com/tidalcycles/strudel/pull/114 +- Osc timing improvements by @yaxu in https://github.com/tidalcycles/strudel/pull/113 + +## New Contributors + +- @bwagner made their first contribution in https://github.com/tidalcycles/strudel/pull/37 +- @mindofmatthew made their first contribution in https://github.com/tidalcycles/strudel/pull/84 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.0.2...@strudel.cycles/core@0.1.0 diff --git a/website/src/content/blog/release-0.0.3-maelstrom.mdx b/website/src/content/blog/release-0.0.3-maelstrom.mdx new file mode 100644 index 00000000..ee8d5143 --- /dev/null +++ b/website/src/content/blog/release-0.0.3-maelstrom.mdx @@ -0,0 +1,68 @@ +--- +title: 'Release Notes v0.0.3 Maelstrom' +description: '' +date: '2022-06-18' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.0.3 Maelstrom + +## What's Changed + +- Add chunk, chunkBack and iterBack by @yaxu in https://github.com/tidalcycles/strudel/pull/25 +- Update tutorial.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/37 +- Update tutorial.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/38 +- Compose by @felixroos in https://github.com/tidalcycles/strudel/pull/40 +- Fix polymeter by @yaxu in https://github.com/tidalcycles/strudel/pull/44 +- First run at squeezeBind, ref #32 by @yaxu in https://github.com/tidalcycles/strudel/pull/48 +- Implement `chop()` by @yaxu in https://github.com/tidalcycles/strudel/pull/50 +- OSC and SuperDirt support by @yaxu in https://github.com/tidalcycles/strudel/pull/27 +- More functions by @yaxu in https://github.com/tidalcycles/strudel/pull/56 +- More functions by @yaxu in https://github.com/tidalcycles/strudel/pull/61 +- Separate out strudel.mjs, make index.mjs aggregate module by @yaxu in https://github.com/tidalcycles/strudel/pull/62 +- Speech output by @felixroos in https://github.com/tidalcycles/strudel/pull/67 +- use new fixed version of osc-js package by @felixroos in https://github.com/tidalcycles/strudel/pull/68 +- First effort at rand() by @yaxu in https://github.com/tidalcycles/strudel/pull/69 +- More randomness, fix `rand`, and add `brand`, `irand` and `choose` by @yaxu in https://github.com/tidalcycles/strudel/pull/70 +- webaudio package by @felixroos in https://github.com/tidalcycles/strudel/pull/26 +- Port `perlin` noise, `rangex`, and `palindrome` by @yaxu in https://github.com/tidalcycles/strudel/pull/73 +- More random functions by @yaxu in https://github.com/tidalcycles/strudel/pull/74 +- Try to fix appLeft / appRight by @yaxu in https://github.com/tidalcycles/strudel/pull/75 +- Basic webserial support by @yaxu in https://github.com/tidalcycles/strudel/pull/80 +- Webaudio in REPL by @felixroos in https://github.com/tidalcycles/strudel/pull/77 +- add `striate()` by @yaxu in https://github.com/tidalcycles/strudel/pull/76 +- Tidy up a couple of old files by @mindofmatthew in https://github.com/tidalcycles/strudel/pull/84 +- Add pattern composers, implements #82 by @yaxu in https://github.com/tidalcycles/strudel/pull/83 +- Fiddles with cat/stack by @yaxu in https://github.com/tidalcycles/strudel/pull/90 +- Paper by @felixroos in https://github.com/tidalcycles/strudel/pull/98 +- Change to Affero GPL by @yaxu in https://github.com/tidalcycles/strudel/pull/101 +- Work on Codemirror 6 highlighting by @mindofmatthew in https://github.com/tidalcycles/strudel/pull/102 +- Codemirror 6 by @felixroos in https://github.com/tidalcycles/strudel/pull/97 +- Tune tests by @felixroos in https://github.com/tidalcycles/strudel/pull/104 +- /embed package: web component for repl by @felixroos in https://github.com/tidalcycles/strudel/pull/106 +- Reset, Restart and other composers by @felixroos in https://github.com/tidalcycles/strudel/pull/88 +- Embed style by @felixroos in https://github.com/tidalcycles/strudel/pull/109 +- In source doc by @yaxu in https://github.com/tidalcycles/strudel/pull/105 +- `.brak()`, `.inside()` and `.outside()` by @yaxu in https://github.com/tidalcycles/strudel/pull/112 +- loopAt by @yaxu in https://github.com/tidalcycles/strudel/pull/114 +- Osc timing improvements by @yaxu in https://github.com/tidalcycles/strudel/pull/113 +- react package + vite build by @felixroos in https://github.com/tidalcycles/strudel/pull/116 +- In source doc by @felixroos in https://github.com/tidalcycles/strudel/pull/117 +- fix: #108 by @felixroos in https://github.com/tidalcycles/strudel/pull/123 +- fix: #122 ctrl enter would add newline by @felixroos in https://github.com/tidalcycles/strudel/pull/124 +- Webdirt by @felixroos in https://github.com/tidalcycles/strudel/pull/121 +- Fix link to contributing to tutorial docs by @stephendwolff in https://github.com/tidalcycles/strudel/pull/129 +- Pianoroll enhancements by @felixroos in https://github.com/tidalcycles/strudel/pull/131 +- add createParam + createParams by @felixroos in https://github.com/tidalcycles/strudel/pull/110 +- remove cycle + delta from onTrigger by @felixroos in https://github.com/tidalcycles/strudel/pull/135 +- Scheduler improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/134 +- add onTrigger helper by @felixroos in https://github.com/tidalcycles/strudel/pull/136 + +## New Contributors + +- @bwagner made their first contribution in https://github.com/tidalcycles/strudel/pull/37 +- @mindofmatthew made their first contribution in https://github.com/tidalcycles/strudel/pull/84 +- @stephendwolff made their first contribution in https://github.com/tidalcycles/strudel/pull/129 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.0.2...v0.0.3 diff --git a/website/src/content/blog/release-0.0.4-gischt.mdx b/website/src/content/blog/release-0.0.4-gischt.mdx new file mode 100644 index 00000000..93db4876 --- /dev/null +++ b/website/src/content/blog/release-0.0.4-gischt.mdx @@ -0,0 +1,47 @@ +--- +title: 'Release Notes v0.0.4 Gischt' +description: '' +date: '2022-08-14' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.0.4 Gischt + +## What's Changed + +- Webaudio rewrite by @felixroos in https://github.com/tidalcycles/strudel/pull/138 +- Fix createParam() by @yaxu in https://github.com/tidalcycles/strudel/pull/140 +- Soundfont Support by @felixroos in https://github.com/tidalcycles/strudel/pull/139 +- Serial twiddles by @yaxu in https://github.com/tidalcycles/strudel/pull/141 +- Pianoroll Object Support by @felixroos in https://github.com/tidalcycles/strudel/pull/142 +- flash effect on ctrl enter by @felixroos in https://github.com/tidalcycles/strudel/pull/144 +- can now generate short link for sharing by @felixroos in https://github.com/tidalcycles/strudel/pull/146 +- Sampler optimizations and more by @felixroos in https://github.com/tidalcycles/strudel/pull/148 +- Final update to demo.pdf by @yaxu in https://github.com/tidalcycles/strudel/pull/151 +- add webdirt drum samples to prebake for general availability by @larkob in https://github.com/tidalcycles/strudel/pull/150 +- update to tutorial documentation by @larkob in https://github.com/tidalcycles/strudel/pull/162 +- add chooseInWith/chooseCycles by @yaxu in https://github.com/tidalcycles/strudel/pull/166 +- fix: jsdoc comments by @felixroos in https://github.com/tidalcycles/strudel/pull/169 +- Pianoroll fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/163 +- Talk fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/164 +- Amend shapeshifter to allow use of dynamic import by @debrisapron in https://github.com/tidalcycles/strudel/pull/171 +- add more shapeshifter flags by @felixroos in https://github.com/tidalcycles/strudel/pull/99 +- Replace react-codemirror6 with @uiw/react-codemirror by @felixroos in https://github.com/tidalcycles/strudel/pull/173 +- fix some annoying bugs by @felixroos in https://github.com/tidalcycles/strudel/pull/177 +- incorporate elements of randomness to the mini notation by @bpow in https://github.com/tidalcycles/strudel/pull/165 +- replace mocha with vitest by @felixroos in https://github.com/tidalcycles/strudel/pull/175 +- scheduler improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/181 +- Fix codemirror bug by @felixroos in https://github.com/tidalcycles/strudel/pull/186 +- wait for prebake to finish before evaluating by @felixroos in https://github.com/tidalcycles/strudel/pull/189 +- fix regression: old way of setting frequencies was broken by @felixroos in https://github.com/tidalcycles/strudel/pull/190 +- Soundfont file support by @felixroos in https://github.com/tidalcycles/strudel/pull/183 +- change "stride"/"offset" of successive degradeBy/chooseIn by @bpow in https://github.com/tidalcycles/strudel/pull/185 + +## New Contributors + +- @larkob made their first contribution in https://github.com/tidalcycles/strudel/pull/150 +- @debrisapron made their first contribution in https://github.com/tidalcycles/strudel/pull/171 +- @bpow made their first contribution in https://github.com/tidalcycles/strudel/pull/165 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.0.3...v0.0.4 diff --git a/website/src/content/blog/release-0.3.0-donauwelle.mdx b/website/src/content/blog/release-0.3.0-donauwelle.mdx new file mode 100644 index 00000000..ce086dbc --- /dev/null +++ b/website/src/content/blog/release-0.3.0-donauwelle.mdx @@ -0,0 +1,67 @@ +--- +title: 'Release Notes v0.3.0 Donauwelle' +description: '' +date: '2022-11-06' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.3.0 Donauwelle + +## Package Versions + +- @strudel.cycles/core@0.3.1 +- @strudel.cycles/eval@0.3.1 +- @strudel.cycles/midi@0.3.1 +- @strudel.cycles/mini@0.3.1 +- @strudel.cycles/react@0.3.1 +- @strudel.cycles/soundfonts@0.3.1 +- @strudel.cycles/tonal@0.3.1 +- @strudel.cycles/tone@0.3.1 +- @strudel.cycles/webaudio@0.3.1 +- @strudel.cycles/webdirt@0.3.1 +- @strudel.cycles/xen@0.3.1 + +## What's Changed + +- Fix numbers in sampler by @felixroos in https://github.com/tidalcycles/strudel/pull/196 +- document random functions by @felixroos in https://github.com/tidalcycles/strudel/pull/199 +- add rollup-plugin-visualizer to build by @felixroos in https://github.com/tidalcycles/strudel/pull/200 +- add vowel to .out by @felixroos in https://github.com/tidalcycles/strudel/pull/201 +- Coarse crush shape by @felixroos in https://github.com/tidalcycles/strudel/pull/205 +- Webaudio guide by @felixroos in https://github.com/tidalcycles/strudel/pull/207 +- Even more docs by @felixroos in https://github.com/tidalcycles/strudel/pull/212 +- Just another docs PR by @felixroos in https://github.com/tidalcycles/strudel/pull/215 +- sampler features + fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/217 +- samples now have envelopes by @felixroos in https://github.com/tidalcycles/strudel/pull/218 +- encapsulate webaudio output by @felixroos in https://github.com/tidalcycles/strudel/pull/219 +- Fix squeeze join by @yaxu in https://github.com/tidalcycles/strudel/pull/220 +- Feedback Delay by @felixroos in https://github.com/tidalcycles/strudel/pull/213 +- support negative speeds by @felixroos in https://github.com/tidalcycles/strudel/pull/222 +- focus tweak for squeezeJoin - another go at fixing #216 by @yaxu in https://github.com/tidalcycles/strudel/pull/221 +- Reverb by @felixroos in https://github.com/tidalcycles/strudel/pull/224 +- fix fastgap for events that go across cycle boundaries by @yaxu in https://github.com/tidalcycles/strudel/pull/225 +- Core util tests by @mystery-house in https://github.com/tidalcycles/strudel/pull/226 +- Refactor tunes away from tone by @felixroos in https://github.com/tidalcycles/strudel/pull/230 +- Just another docs branch by @felixroos in https://github.com/tidalcycles/strudel/pull/228 +- Patternify range by @yaxu in https://github.com/tidalcycles/strudel/pull/231 +- Out by default by @felixroos in https://github.com/tidalcycles/strudel/pull/232 +- Fix zero length queries WIP by @yaxu in https://github.com/tidalcycles/strudel/pull/234 +- add vcsl sample library by @felixroos in https://github.com/tidalcycles/strudel/pull/235 +- fx on stereo speakers by @felixroos in https://github.com/tidalcycles/strudel/pull/236 +- Tidal drum machines by @felixroos in https://github.com/tidalcycles/strudel/pull/237 +- Object arithmetic by @felixroos in https://github.com/tidalcycles/strudel/pull/238 +- Load samples from url by @felixroos in https://github.com/tidalcycles/strudel/pull/239 +- feat: support github: links by @felixroos in https://github.com/tidalcycles/strudel/pull/240 +- in source example tests by @felixroos in https://github.com/tidalcycles/strudel/pull/242 +- Readme + TLC by @felixroos in https://github.com/tidalcycles/strudel/pull/244 +- patchday by @felixroos in https://github.com/tidalcycles/strudel/pull/246 +- Some tunes by @felixroos in https://github.com/tidalcycles/strudel/pull/247 +- snapshot tests on shared snippets by @felixroos in https://github.com/tidalcycles/strudel/pull/243 +- General purpose scheduler by @felixroos in https://github.com/tidalcycles/strudel/pull/248 + +## New Contributors + +- @mystery-house made their first contribution in https://github.com/tidalcycles/strudel/pull/226 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.0.4...v0.3.0 diff --git a/website/src/content/blog/release-0.4.0-brandung.mdx b/website/src/content/blog/release-0.4.0-brandung.mdx new file mode 100644 index 00000000..67e61ece --- /dev/null +++ b/website/src/content/blog/release-0.4.0-brandung.mdx @@ -0,0 +1,17 @@ +--- +title: 'Release Notes v0.4.0 Brandung' +description: '' +date: '2022-11-13' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.4.0 Brandung + +## What's Changed + +- new transpiler based on acorn by @felixroos in https://github.com/tidalcycles/strudel/pull/249 +- Webaudio build by @felixroos in https://github.com/tidalcycles/strudel/pull/250 +- Repl refactoring by @felixroos in https://github.com/tidalcycles/strudel/pull/255 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.3.0...v0.4.0 diff --git a/website/src/content/blog/release-0.5.0-wirbel.mdx b/website/src/content/blog/release-0.5.0-wirbel.mdx new file mode 100644 index 00000000..8912627c --- /dev/null +++ b/website/src/content/blog/release-0.5.0-wirbel.mdx @@ -0,0 +1,61 @@ +--- +title: 'Release Notes v0.5.0 Wirbel' +description: '' +date: '2022-12-13' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.5.0 Wirbel + +## Package Versions + +- @strudel.cycles/core@0.5.0 +- @strudel.cycles/osc@0.4.0 +- @strudel.cycles/serial@0.3.0 +- @strudel.cycles/csound@0.5.1 +- @strudel.cycles/eval@0.5.0 +- @strudel.cycles/midi@0.5.0 +- @strudel.cycles/mini@0.5.0 +- @strudel.cycles/react@0.5.0 +- @strudel.cycles/soundfonts@0.5.0 +- @strudel.cycles/tonal@0.5.0 +- @strudel.cycles/tone@0.5.0 +- @strudel.cycles/transpiler@0.5.0 +- @strudel.cycles/webaudio@0.5.0 +- @strudel.cycles/webdirt@0.5.0 +- @strudel.cycles/xen@0.5.0 + +## What's Changed + +- Binaries by @felixroos in https://github.com/tidalcycles/strudel/pull/254 +- fix tutorial bugs by @felixroos in https://github.com/tidalcycles/strudel/pull/263 +- fix performance bottleneck by @felixroos in https://github.com/tidalcycles/strudel/pull/266 +- Tidying up core by @yaxu in https://github.com/tidalcycles/strudel/pull/256 +- tonal update with fixed memory leak by @felixroos in https://github.com/tidalcycles/strudel/pull/272 +- add eslint by @felixroos in https://github.com/tidalcycles/strudel/pull/271 +- release version bumps by @felixroos in https://github.com/tidalcycles/strudel/pull/273 +- Support sending CRC16 bytes with serial messages by @yaxu in https://github.com/tidalcycles/strudel/pull/276 +- add licenses / credits to all tunes + remove some by @felixroos in https://github.com/tidalcycles/strudel/pull/277 +- add basic csound output by @felixroos in https://github.com/tidalcycles/strudel/pull/275 +- do not recompile orc by @felixroos in https://github.com/tidalcycles/strudel/pull/278 +- implement collect + arp function by @felixroos in https://github.com/tidalcycles/strudel/pull/281 +- Switch 'operators' from .whatHow to .what.how by @yaxu in https://github.com/tidalcycles/strudel/pull/285 +- Fancy hap show, include part in snapshots by @yaxu in https://github.com/tidalcycles/strudel/pull/291 +- Reorganise pattern.mjs with a 'toplevel first' regime by @yaxu in https://github.com/tidalcycles/strudel/pull/286 +- add prettier task by @felixroos in https://github.com/tidalcycles/strudel/pull/296 +- Move stuff to new register function by @felixroos in https://github.com/tidalcycles/strudel/pull/295 +- can now add bare numbers to numeral object props by @felixroos in https://github.com/tidalcycles/strudel/pull/287 +- update vitest by @felixroos in https://github.com/tidalcycles/strudel/pull/297 +- remove whitespace from highlighted region by @felixroos in https://github.com/tidalcycles/strudel/pull/298 +- .defragmentHaps() for merging touching haps that share a whole and value by @yaxu in https://github.com/tidalcycles/strudel/pull/299 +- fix whitespace trimming by @felixroos in https://github.com/tidalcycles/strudel/pull/300 +- add freq support to sampler by @felixroos in https://github.com/tidalcycles/strudel/pull/301 +- add lint + prettier check before test by @felixroos in https://github.com/tidalcycles/strudel/pull/305 +- Updated csoundm to use the register facility . by @gogins in https://github.com/tidalcycles/strudel/pull/303 + +## New Contributors + +- @gogins made their first contribution in https://github.com/tidalcycles/strudel/pull/303 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.4.0...v0.5.0 diff --git a/website/src/content/blog/release-0.6.0-zimtschnecke.mdx b/website/src/content/blog/release-0.6.0-zimtschnecke.mdx new file mode 100644 index 00000000..9e5f2f35 --- /dev/null +++ b/website/src/content/blog/release-0.6.0-zimtschnecke.mdx @@ -0,0 +1,86 @@ +--- +title: 'Release Notes v0.6.0 Zimtschnecke' +description: '' +date: '2023-02-01' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.6.0 Zimtschnecke + +## Package Versions + +- @strudel.cycles/core@0.6.8 +- @strudel.cycles/eval@0.6.2 +- @strudel.cycles/transpiler@0.6.0 +- @strudel.cycles/mini@0.6.0 +- @strudel.cycles/tonal@0.6.0 +- @strudel.cycles/tone@0.6.0 +- @strudel.cycles/xen@0.6.0 +- @strudel.cycles/webaudio@0.6.1 +- @strudel.cycles/react@0.6.0 +- @strudel.cycles/osc@0.6.0 +- @strudel.cycles/midi@0.6.0 +- @strudel.cycles/webdirt@0.6.0 +- @strudel.cycles/serial@0.6.0 +- @strudel.cycles/soundfonts@0.6.0 +- @strudel.cycles/csound@0.6.0 + +## What's Changed + +- support freq in pianoroll by @felixroos in https://github.com/tidalcycles/strudel/pull/308 +- ICLC2023 paper WIP by @yaxu in https://github.com/tidalcycles/strudel/pull/306 +- fix: copy share link to clipboard was broken for some browers by @felixroos in https://github.com/tidalcycles/strudel/pull/311 +- Jsdoc component by @felixroos in https://github.com/tidalcycles/strudel/pull/312 +- object support for .scale by @felixroos in https://github.com/tidalcycles/strudel/pull/307 +- Astro build by @felixroos in https://github.com/tidalcycles/strudel/pull/315 +- Reference tab sort by @felixroos in https://github.com/tidalcycles/strudel/pull/318 +- tutorial updates by @jarmitage in https://github.com/tidalcycles/strudel/pull/320 +- support notes without octave by @felixroos in https://github.com/tidalcycles/strudel/pull/323 +- mini repl improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/324 +- fix: workaround Object.assign globalThis by @felixroos in https://github.com/tidalcycles/strudel/pull/326 +- add examples route by @felixroos in https://github.com/tidalcycles/strudel/pull/327 +- add my-patterns by @felixroos in https://github.com/tidalcycles/strudel/pull/328 +- my-patterns build + deploy by @felixroos in https://github.com/tidalcycles/strudel/pull/329 +- my-patterns: fix paths + update readme by @felixroos in https://github.com/tidalcycles/strudel/pull/330 +- improve displaying 's' in pianoroll by @felixroos in https://github.com/tidalcycles/strudel/pull/331 +- fix: can now multiply floats in mini notation by @felixroos in https://github.com/tidalcycles/strudel/pull/332 +- Embed mode improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/333 +- testing + docs docs by @felixroos in https://github.com/tidalcycles/strudel/pull/334 +- animate mvp by @felixroos in https://github.com/tidalcycles/strudel/pull/335 +- Tidy parser, implement polymeters by @yaxu in https://github.com/tidalcycles/strudel/pull/336 +- animation options by @felixroos in https://github.com/tidalcycles/strudel/pull/337 +- move /my-patterns to /swatch by @yaxu in https://github.com/tidalcycles/strudel/pull/338 +- more animate functions + mini repl fix by @felixroos in https://github.com/tidalcycles/strudel/pull/340 +- Patternify euclid, fast, slow and polymeter step parameters in mininotation by @yaxu in https://github.com/tidalcycles/strudel/pull/341 +- fixes #346 by @felixroos in https://github.com/tidalcycles/strudel/pull/347 +- Fix prebake base path by @felixroos in https://github.com/tidalcycles/strudel/pull/345 +- Fix Bjorklund by @yaxu in https://github.com/tidalcycles/strudel/pull/343 +- docs: tidal comparison + add global fx + add missing sampler fx by @felixroos in https://github.com/tidalcycles/strudel/pull/356 +- Fix .out(), renaming webaudio's out() to webaudio() by @yaxu in https://github.com/tidalcycles/strudel/pull/361 +- Support for multiple mininotation operators by @yaxu in https://github.com/tidalcycles/strudel/pull/350 +- doc structuring by @felixroos in https://github.com/tidalcycles/strudel/pull/360 +- add https to url by @urswilke in https://github.com/tidalcycles/strudel/pull/364 +- document more functions + change arp join by @felixroos in https://github.com/tidalcycles/strudel/pull/369 +- improve new draw logic by @felixroos in https://github.com/tidalcycles/strudel/pull/372 +- Draw fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/377 +- update my-patterns instructions by @felixroos in https://github.com/tidalcycles/strudel/pull/384 +- docs: use note instead of n to mitigate confusion by @felixroos in https://github.com/tidalcycles/strudel/pull/385 +- add run + test + docs by @felixroos in https://github.com/tidalcycles/strudel/pull/386 +- Rename a to angle by @felixroos in https://github.com/tidalcycles/strudel/pull/387 +- document csound by @felixroos in https://github.com/tidalcycles/strudel/pull/391 +- Notes are not essential :) by @yaxu in https://github.com/tidalcycles/strudel/pull/393 +- add ribbon + test + docs by @felixroos in https://github.com/tidalcycles/strudel/pull/388 +- Add tidal-drum-patterns to examples by @urswilke in https://github.com/tidalcycles/strudel/pull/379 +- add pattern methods hurry, press and pressBy by @yaxu in https://github.com/tidalcycles/strudel/pull/397 +- proper builds + use pnpm workspaces by @felixroos in https://github.com/tidalcycles/strudel/pull/396 +- fix: minirepl styles by @felixroos in https://github.com/tidalcycles/strudel/pull/398 +- can now await initAudio + initAudioOnFirstClick by @felixroos in https://github.com/tidalcycles/strudel/pull/399 +- release webaudio by @felixroos in https://github.com/tidalcycles/strudel/pull/400 + +## New Contributors + +- @jarmitage made their first contribution in https://github.com/tidalcycles/strudel/pull/320 +- @urswilke made their first contribution in https://github.com/tidalcycles/strudel/pull/364 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.5.0...v0.6.0 diff --git a/website/src/content/blog/release-0.7.0-zuckerguss.mdx b/website/src/content/blog/release-0.7.0-zuckerguss.mdx new file mode 100644 index 00000000..55315a9c --- /dev/null +++ b/website/src/content/blog/release-0.7.0-zuckerguss.mdx @@ -0,0 +1,90 @@ +--- +title: 'Release Notes v0.7.0 Zimtschnecke' +description: '' +date: '2023-03-23' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.7.0 Zimtschnecke + +## Package Versions + +- @strudel.cycles/core@0.7.2 +- @strudel.cycles/transpiler@0.7.1 +- @strudel.cycles/mini@0.7.2 +- @strudel.cycles/tonal@0.7.1 +- @strudel.cycles/xen@0.7.1 +- @strudel.cycles/tone@0.7.1 +- @strudel.cycles/webaudio@0.7.1 +- @strudel.cycles/react@0.7.1 +- @strudel.cycles/osc@0.7.1 +- @strudel.cycles/serial@0.7.1 +- @strudel.cycles/midi@0.7.1 +- @strudel.cycles/csound@0.7.1 + +## What's Changed + +- pin @csound/browser to 6.18.3 + bump by @felixroos in https://github.com/tidalcycles/strudel/pull/403 +- update csound + fix sound output by @felixroos in https://github.com/tidalcycles/strudel/pull/404 +- fix: share url on subpath by @felixroos in https://github.com/tidalcycles/strudel/pull/405 +- add shabda doc by @felixroos in https://github.com/tidalcycles/strudel/pull/407 +- Update effects.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/410 +- improve effects doc by @felixroos in https://github.com/tidalcycles/strudel/pull/409 +- google gtfo by @felixroos in https://github.com/tidalcycles/strudel/pull/413 +- improve samples doc by @felixroos in https://github.com/tidalcycles/strudel/pull/411 +- PWA with offline support by @felixroos in https://github.com/tidalcycles/strudel/pull/417 +- add caching strategy for missing file types + cache all samples loaded from github by @felixroos in https://github.com/tidalcycles/strudel/pull/419 +- add more offline caching by @felixroos in https://github.com/tidalcycles/strudel/pull/421 +- add cdn.freesound to cache list by @felixroos in https://github.com/tidalcycles/strudel/pull/425 +- minirepl: add keyboard shortcuts by @felixroos in https://github.com/tidalcycles/strudel/pull/429 +- Themes by @felixroos in https://github.com/tidalcycles/strudel/pull/431 +- autocomplete preparations by @felixroos in https://github.com/tidalcycles/strudel/pull/427 +- Fix anchors by @felixroos in https://github.com/tidalcycles/strudel/pull/433 +- Update code.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/436 +- Update mini-notation.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/437 +- Update synths.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/438 +- FIXES: Warning about jsxBracketSameLine deprecation by @bwagner in https://github.com/tidalcycles/strudel/pull/461 +- Composable functions by @yaxu in https://github.com/tidalcycles/strudel/pull/390 +- weave and weaveWith by @yaxu in https://github.com/tidalcycles/strudel/pull/465 +- slice and splice by @yaxu in https://github.com/tidalcycles/strudel/pull/466 +- fix: osc should not return a promise by @felixroos in https://github.com/tidalcycles/strudel/pull/472 +- FIXES: freqs instead of pitches by @bwagner in https://github.com/tidalcycles/strudel/pull/464 +- Update input-output.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/471 +- settings tab with vim / emacs modes + additional themes and fonts by @felixroos in https://github.com/tidalcycles/strudel/pull/467 +- fix: hash links by @felixroos in https://github.com/tidalcycles/strudel/pull/473 +- midi cc support by @felixroos in https://github.com/tidalcycles/strudel/pull/478 +- Fix array args by @felixroos in https://github.com/tidalcycles/strudel/pull/480 +- docs: packages + offline by @felixroos in https://github.com/tidalcycles/strudel/pull/482 +- Update mini-notation.mdx by @yaxu in https://github.com/tidalcycles/strudel/pull/365 +- Revert "Another attempt at composable functions - WIP (#390)" by @felixroos in https://github.com/tidalcycles/strudel/pull/484 +- fix app height by @felixroos in https://github.com/tidalcycles/strudel/pull/485 +- add algolia creds + optimize sidebar for crawling by @felixroos in https://github.com/tidalcycles/strudel/pull/488 +- refactor react package by @felixroos in https://github.com/tidalcycles/strudel/pull/490 +- react style fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/491 +- implement cps in scheduler by @felixroos in https://github.com/tidalcycles/strudel/pull/493 +- Add control aliases by @yaxu in https://github.com/tidalcycles/strudel/pull/497 +- fix: nano-repl highlighting by @felixroos in https://github.com/tidalcycles/strudel/pull/501 +- Reinstate slice and splice by @yaxu in https://github.com/tidalcycles/strudel/pull/500 +- can now use : as a replacement for space in scales by @felixroos in https://github.com/tidalcycles/strudel/pull/502 +- Support list syntax in mininotation by @yaxu in https://github.com/tidalcycles/strudel/pull/512 +- update react to 18 by @felixroos in https://github.com/tidalcycles/strudel/pull/514 +- add arrange function by @felixroos in https://github.com/tidalcycles/strudel/pull/508 +- Update README.md by @bwagner in https://github.com/tidalcycles/strudel/pull/474 +- add 2 illegible fonts by @felixroos in https://github.com/tidalcycles/strudel/pull/518 +- registerSound API + improved sounds tab + regroup soundfonts by @felixroos in https://github.com/tidalcycles/strudel/pull/516 +- fix: envelopes in chrome by @felixroos in https://github.com/tidalcycles/strudel/pull/521 +- Update samples.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/524 +- Update intro.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/525 +- fix(footer): fix link to tidalcycles by @revolunet in https://github.com/tidalcycles/strudel/pull/529 +- FIXES: alias pm for polymeter by @bwagner in https://github.com/tidalcycles/strudel/pull/527 +- Maintain random seed state in parser, not globally by @ijc8 in https://github.com/tidalcycles/strudel/pull/531 +- feat: add freq support to gm soundfonts by @felixroos in https://github.com/tidalcycles/strudel/pull/534 +- Update lerna by @felixroos in https://github.com/tidalcycles/strudel/pull/535 + +## New Contributors + +- @revolunet made their first contribution in https://github.com/tidalcycles/strudel/pull/529 +- @ijc8 made their first contribution in https://github.com/tidalcycles/strudel/pull/531 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.6.0...v0.7.0 diff --git a/website/src/content/blog/release-0.8.0-himbeermuffin.mdx b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx new file mode 100644 index 00000000..d2ae211a --- /dev/null +++ b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx @@ -0,0 +1,130 @@ +--- +title: 'Release Notes v0.8.0 Himbeermuffin' +description: '' +date: '2023-06-30' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.8.0 Himbeermuffin + +These are the release notes for Strudel 0.8.0 aka "Himbeermuffin"! + +[Go to Tidal Club Forum for this Release](https://club.tidalcycles.org/t/strudel-0-8-0-released/4769) + +Let me write up some of the highlights: + +## Desktop App + +Besides the REPL (https://strudel.tidalcycles.org/), Strudel is now also distributed as a Desktop App via https://tauri.app/! Thanks to [vasilymilovidov](https://github.com/vasilymilovidov)! + +- [Linux: Debian based](https://github.com/tidalcycles/strudel/releases/download/v0.8.0/strudel_0.1.0_amd64.deb) +- [Linux: AppImage](https://github.com/tidalcycles/strudel/releases/download/v0.8.0/strudel_0.1.0_amd64.AppImage) +- [MacOS](https://github.com/tidalcycles/strudel/releases/download/v0.8.0/Strudel_0.1.0_x64.dmg) +- [Windows .exe](https://github.com/tidalcycles/strudel/releases/download/v0.8.0/Strudel_0.1.0_x64-setup.exe) +- [Windows .msi](https://github.com/tidalcycles/strudel/releases/download/v0.8.0/Strudel_0.1.0_x64_en-US.msi) + +edit: the desktop app performance on linux is currently not that great.. the web REPL runs much smoother (using firefox or chromium) + +The desktop App has the same features as the webapp, with the additional ability to load samples from disk. It is currently not documented yet, but you can do something like + +```js +await samples('~/music/xxx'); + +s('my_sound'); +``` + +You have to start with `~/music/`, followed by an arbitrary folder path that is expected to be present in the systems [audio directory](https://tauri.app/v1/api/js/path/#audiodir). +When you first run it, the app will create a strudel.json file in that directory to map out the available samples. + +I would be very happy to collect some feedback on how it works across different platforms & systems! + +## Spiral Visualization + +Also still undocumented, but you can now visualize patterns as a spiral via `.spiral()`: + +https://github.com/tidalcycles/strudel/assets/12023032/05bc2dba-b304-4298-9465-a1a6fafe5ded + +This is especially nice because strudel is not only the name of a dessert but also the german word for vortex! The spiral is very fitting to visualize cycles because you can align cycles vertically, while surfing along an infinite twisted timeline. + +## More settings + +In the settings tab, you can now toggle: + +- line numbers +- auto-complete +- line wrapping + +Thanks to [roipoussiere](https://github.com/roipoussiere)! + +## More + +Scroll down to see the full list of Changes! + +A big thanks to all the contributors! + +## Package Versions + +- @strudel.cycles/core: 0.8.2 +- @strudel.cycles/mini: 0.8.2 +- @strudel.cycles/transpiler: 0.8.2 +- @strudel.cycles/webaudio: 0.8.2 +- @strudel.cycles/soundfonts: 0.8.2 +- @strudel.cycles/react: 0.8.0 +- @strudel.cycles/midi: 0.8.0 +- @strudel.cycles/osc: 0.8.0 +- @strudel.cycles/csound: 0.8.0 +- @strudel.cycles/serial: 0.8.0 +- @strudel.cycles/tonal: 0.8.2 +- @strudel.cycles/xen: 0.8.0 +- @strudel/codemirror: 0.8.4 +- @strudel/web: 0.8.3 + +## What's Changed + +- fix period key for dvorak + remove duplicated code by @felixroos in https://github.com/tidalcycles/strudel/pull/537 +- improve initial loading + wait before eval by @felixroos in https://github.com/tidalcycles/strudel/pull/538 +- do not reset cps before eval #517 by @felixroos in https://github.com/tidalcycles/strudel/pull/539 +- feat: add loader bar to animate loading state by @felixroos in https://github.com/tidalcycles/strudel/pull/542 +- add firacode font by @felixroos in https://github.com/tidalcycles/strudel/pull/544 +- fix: allow whitespace at the end of a mini pattern by @felixroos in https://github.com/tidalcycles/strudel/pull/547 +- fix: reset time on stop by @felixroos in https://github.com/tidalcycles/strudel/pull/548 +- fix: load soundfonts in prebake by @felixroos in https://github.com/tidalcycles/strudel/pull/550 +- fix: colorable highlighting by @felixroos in https://github.com/tidalcycles/strudel/pull/553 +- fix: make soundfonts import dynamic by @felixroos in https://github.com/tidalcycles/strudel/pull/556 +- add basic triads and guidetone voicings by @felixroos in https://github.com/tidalcycles/strudel/pull/557 +- Patchday by @felixroos in https://github.com/tidalcycles/strudel/pull/559 +- Vanilla JS Refactoring by @felixroos in https://github.com/tidalcycles/strudel/pull/563 +- repl: add option to display line numbers by @roipoussiere in https://github.com/tidalcycles/strudel/pull/582 +- learn/tonal: fix typo in "scaleTran[s]pose" by @srenatus in https://github.com/tidalcycles/strudel/pull/585 +- Music metadata by @roipoussiere in https://github.com/tidalcycles/strudel/pull/580 +- New Workshop by @felixroos in https://github.com/tidalcycles/strudel/pull/587 +- Fix option dot by @felixroos in https://github.com/tidalcycles/strudel/pull/596 +- fix: allow f for flat notes like tidal by @felixroos in https://github.com/tidalcycles/strudel/pull/593 +- fix: division by zero by @felixroos in https://github.com/tidalcycles/strudel/pull/591 +- Solmization added by @dariacotocu in https://github.com/tidalcycles/strudel/pull/570 +- improve cursor by @felixroos in https://github.com/tidalcycles/strudel/pull/597 +- enable auto-completion by @roipoussiere in https://github.com/tidalcycles/strudel/pull/588 +- add ratio function by @felixroos in https://github.com/tidalcycles/strudel/pull/602 +- editor: enable line wrapping by @roipoussiere in https://github.com/tidalcycles/strudel/pull/581 +- tonal fixes by @felixroos in https://github.com/tidalcycles/strudel/pull/607 +- fix: flatten scale lists by @felixroos in https://github.com/tidalcycles/strudel/pull/605 +- clip now works like legato in tidal by @felixroos in https://github.com/tidalcycles/strudel/pull/598 +- fix: doc links by @felixroos in https://github.com/tidalcycles/strudel/pull/612 +- tauri desktop app by @vasilymilovidov in https://github.com/tidalcycles/strudel/pull/613 +- add spiral viz by @felixroos in https://github.com/tidalcycles/strudel/pull/614 +- patterning ui settings by @felixroos in https://github.com/tidalcycles/strudel/pull/606 +- Fix typo on packages.mdx by @paikwiki in https://github.com/tidalcycles/strudel/pull/520 +- cps dependent functions by @felixroos in https://github.com/tidalcycles/strudel/pull/620 +- desktop: play samples from disk by @felixroos in https://github.com/tidalcycles/strudel/pull/621 +- fix: midi clock drift by @felixroos in https://github.com/tidalcycles/strudel/pull/627 + +## New Contributors + +- @roipoussiere made their first contribution in https://github.com/tidalcycles/strudel/pull/582 +- @srenatus made their first contribution in https://github.com/tidalcycles/strudel/pull/585 +- @dariacotocu made their first contribution in https://github.com/tidalcycles/strudel/pull/570 +- @vasilymilovidov made their first contribution in https://github.com/tidalcycles/strudel/pull/613 +- @paikwiki made their first contribution in https://github.com/tidalcycles/strudel/pull/520 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.7.0...v0.8.0 diff --git a/website/src/content/blog/release-0.9.0-bananenbrot.mdx b/website/src/content/blog/release-0.9.0-bananenbrot.mdx new file mode 100644 index 00000000..1322362e --- /dev/null +++ b/website/src/content/blog/release-0.9.0-bananenbrot.mdx @@ -0,0 +1,114 @@ +--- +title: 'Release Notes v0.9.0 Bananenbrot' +description: '' +date: '2023-09-17' +tags: ['meta'] +author: froos +--- + +# Release Notes v0.9.0 Bananenbrot + +These are the release notes for Strudel 0.9.0 aka "Bananenbrot"! + +The last release was over 11 weeks ago, so a lot of things have happened! + +Let me write up some of the highlights: + +## Improved Synth Engine + +The synth engine has gotten a lot of love + a name: [superdough](https://www.npmjs.com/package/superdough) encapsulates the web audio based synth / sampler / fx engine into a reusable package, which is already used by [Topos](https://topos.raphaelforment.fr/). +Main new features include: + +- [filter envelopes](https://strudel.tidalcycles.org/learn/effects#filter-envelope) +- [FM Synthesis](https://strudel.tidalcycles.org/learn/synths#fm-synthesis) +- [looping samples](https://strudel.tidalcycles.org/learn/samples#loop), allowing [wavetable synthesis](https://strudel.tidalcycles.org/?I9myTNQoKKaP) +- [vibrato](https://strudel.tidalcycles.org/learn/synths#vibrato) +- an integration of [ZZFX](https://strudel.tidalcycles.org/learn/synths#zzfx) + +https://github.com/tidalcycles/strudel/assets/12023032/652e7042-f296-496b-95cd-b2a4987fe238 + +Related PRs: + +- superdough: encapsulates web audio output by @felixroos in https://github.com/tidalcycles/strudel/pull/664 +- basic fm by @felixroos in https://github.com/tidalcycles/strudel/pull/669 +- Wave Selection and Global Envelope on the FM Synth Modulator by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/683 +- control osc partial count with n by @felixroos in https://github.com/tidalcycles/strudel/pull/674 +- ZZFX Synth support by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/684 +- Adding filter envelopes and filter order selection by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/692 +- Adding loop points and thus wavetable synthesis by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/698 +- Adding vibrato to base oscillators by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/693 + +## Desktop App Improvements + +Thanks to @daslyfe and @vasilymilovidov , the desktop app now has its own rust based MIDI and OSC integrations, +which do not depend on browser APIs! + +You can see superdough, superdirt via OSC + hardware synths via MIDI all together playing in harmony in this [awesome video](https://www.youtube.com/watch?v=lxQgBeLQBgk). These are the related PRs: + +- Create Midi Integration for Tauri Desktop app by @daslyfe in https://github.com/tidalcycles/strudel/pull/685 +- add sleep timer + improve message iterating by @daslyfe in https://github.com/tidalcycles/strudel/pull/688 +- fix MIDI CC messages by @vasilymilovidov in https://github.com/tidalcycles/strudel/pull/690 +- Direct OSC Support in Tauri by @daslyfe in https://github.com/tidalcycles/strudel/pull/694 +- Add logging from tauri by @daslyfe in https://github.com/tidalcycles/strudel/pull/697 +- fix osc bundle timestamp glitches caused by drifting clock by @daslyfe in https://github.com/tidalcycles/strudel/pull/666 +- Midi time fixes by @daslyfe in https://github.com/tidalcycles/strudel/pull/668 +- [Bug Fix] Account for numeral notation when converting to midi by @daslyfe in https://github.com/tidalcycles/strudel/pull/656 +- [Bug Fix] Midi: Don't treat note 0 as false by @daslyfe in https://github.com/tidalcycles/strudel/pull/657 + +## Visuals + +- 2 new FFT based vizualisations have now landed: [scope and fscope](https://github.com/tidalcycles/strudel/pull/677) (featured in the video at the top). +- pianoroll has new options, see [PR](https://github.com/tidalcycles/strudel/pull/679) + +Related PRs: + +- Scope by @felixroos in https://github.com/tidalcycles/strudel/pull/677 ([demo](https://strudel.tidalcycles.org/?hXVQF-KxMI8p)) +- Pianoroll improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/679 ([demo](https://strudel.tidalcycles.org/?aPMKqXGVMgSM)) + +## Voicings + +There is now a new way to play chord voicings + a huge selection of chord voicings available. Find out more in these PRs: + +- stateless voicings + tonleiter lib by @felixroos in https://github.com/tidalcycles/strudel/pull/647 ([demo](https://strudel.tidalcycles.org/?FoILM0Hs9y9f)) +- ireal voicings by @felixroos in https://github.com/tidalcycles/strudel/pull/653 ([demo](https://strudel.tidalcycles.org/?bv_TjY9hOC28)) + +## Adaptive Highlighting + +Thanks to @mindofmatthew , the highlighting will adapt to edits instantly! Related PRs: + +- More work on highlight IDs by @mindofmatthew in https://github.com/tidalcycles/strudel/pull/636 +- Adaptive Highlighting by @felixroos in https://github.com/tidalcycles/strudel/pull/634 + +## UI Changes + +- teletext theme + fonts by @felixroos in https://github.com/tidalcycles/strudel/pull/681 (featured in video at the top) +- togglable panel position by @felixroos in https://github.com/tidalcycles/strudel/pull/667 + +## Other New Features + +- slice: list mode by @felixroos in https://github.com/tidalcycles/strudel/pull/645 ([demo](https://strudel.tidalcycles.org/?bAYIqz5NLjRr)) +- add emoji support by @felixroos in https://github.com/tidalcycles/strudel/pull/680 ([demo](https://strudel.tidalcycles.org/?a6FgLz475gN9)) + +## Articles + +- Understand pitch by @felixroos in https://github.com/tidalcycles/strudel/pull/652 + +## Other Fixes & Enhancements + +- fix: out of range error by @felixroos in https://github.com/tidalcycles/strudel/pull/630 +- fix: update canvas size on window resize by @felixroos in https://github.com/tidalcycles/strudel/pull/631 +- FIXES: TODO in rotateChroma by @bwagner in https://github.com/tidalcycles/strudel/pull/650 +- snapshot tests: sort haps by part by @felixroos in https://github.com/tidalcycles/strudel/pull/637 +- Delete old packages by @felixroos in https://github.com/tidalcycles/strudel/pull/639 +- update vitest by @felixroos in https://github.com/tidalcycles/strudel/pull/651 +- fix: welcome message for latestCode by @felixroos in https://github.com/tidalcycles/strudel/pull/659 +- fix: always run previous trigger by @felixroos in https://github.com/tidalcycles/strudel/pull/660 + +## New Contributors + +- @daslyfe made their first contribution in https://github.com/tidalcycles/strudel/pull/656 +- @Bubobubobubobubo made their first contribution in https://github.com/tidalcycles/strudel/pull/683 + +**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v0.8.0...v0.9.0 + +A big thanks to all the contributors! diff --git a/website/src/content/config.ts b/website/src/content/config.ts new file mode 100644 index 00000000..bc5d1dd3 --- /dev/null +++ b/website/src/content/config.ts @@ -0,0 +1,24 @@ +import { defineCollection, z } from 'astro:content'; + +const blog = defineCollection({ + // Type-check frontmatter using a schema + schema: z.object({ + title: z.string(), + author: z.string(), + description: z.string().optional(), + // Transform string to Date object + date: z + .string() + .or(z.date()) + .transform((val) => new Date(val)), + updatedDate: z + .string() + .optional() + .transform((str) => (str ? new Date(str) : undefined)), + image: z.string().optional(), + tags: z.array(z.string()).optional(), + draft: z.boolean().optional(), + }), +}); + +export const collections = { blog }; diff --git a/website/src/env.d.ts b/website/src/env.d.ts index 5263bd6a..bd7aa94b 100644 --- a/website/src/env.d.ts +++ b/website/src/env.d.ts @@ -2,3 +2,5 @@ /// /// /// + +declare module 'date-fns'; diff --git a/website/src/pages/blog.astro b/website/src/pages/blog.astro new file mode 100644 index 00000000..431244c6 --- /dev/null +++ b/website/src/pages/blog.astro @@ -0,0 +1,45 @@ +--- +import BlogPost from '../components/BlogPost.astro'; +import HeadCommon from '../components/HeadCommon.astro'; +import HeadSEO from '../components/HeadSEO.astro'; +import Header from '../components/Header/Header.astro'; +import LeftSidebar from '../components/LeftSidebar/LeftSidebar.astro'; +import PageContent from '../components/PageContent/PageContent.astro'; +import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; +import { getCollection } from 'astro:content'; +import { compareDesc } from 'date-fns'; + +const currentPage = Astro.url.pathname; + +const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.date, b.data.date)); +--- + + + + + + 🌀 Strudel Blog + + + +
+
+
+
+
+
+ + +

Strudel Blog

+ {posts.map((post) => )} +
+ +
+
+
+ + From ceb4376eb8336eda96ba24ac14306906f6122299 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 23:16:44 +0100 Subject: [PATCH 50/55] format autogenerated types --- website/.astro/types.d.ts | 316 +++++++++++++++++--------------------- 1 file changed, 141 insertions(+), 175 deletions(-) diff --git a/website/.astro/types.d.ts b/website/.astro/types.d.ts index ea8fd38b..64bd0ddf 100644 --- a/website/.astro/types.d.ts +++ b/website/.astro/types.d.ts @@ -1,206 +1,172 @@ declare module 'astro:content' { - interface Render { - '.mdx': Promise<{ - Content: import('astro').MarkdownInstance<{}>['Content']; - headings: import('astro').MarkdownHeading[]; - remarkPluginFrontmatter: Record; - }>; - } + interface Render { + '.mdx': Promise<{ + Content: import('astro').MarkdownInstance<{}>['Content']; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + }>; + } } declare module 'astro:content' { - interface Render { - '.md': Promise<{ - Content: import('astro').MarkdownInstance<{}>['Content']; - headings: import('astro').MarkdownHeading[]; - remarkPluginFrontmatter: Record; - }>; - } + interface Render { + '.md': Promise<{ + Content: import('astro').MarkdownInstance<{}>['Content']; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + }>; + } } declare module 'astro:content' { - export { z } from 'astro/zod'; + export { z } from 'astro/zod'; - type Flatten = T extends { [K: string]: infer U } ? U : never; + type Flatten = T extends { [K: string]: infer U } ? U : never; - export type CollectionKey = keyof AnyEntryMap; - export type CollectionEntry = Flatten; + export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; - export type ContentCollectionKey = keyof ContentEntryMap; - export type DataCollectionKey = keyof DataEntryMap; + export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; - // This needs to be in sync with ImageMetadata - export type ImageFunction = () => import('astro/zod').ZodObject<{ - src: import('astro/zod').ZodString; - width: import('astro/zod').ZodNumber; - height: import('astro/zod').ZodNumber; - format: import('astro/zod').ZodUnion< - [ - import('astro/zod').ZodLiteral<'png'>, - import('astro/zod').ZodLiteral<'jpg'>, - import('astro/zod').ZodLiteral<'jpeg'>, - import('astro/zod').ZodLiteral<'tiff'>, - import('astro/zod').ZodLiteral<'webp'>, - import('astro/zod').ZodLiteral<'gif'>, - import('astro/zod').ZodLiteral<'svg'>, - import('astro/zod').ZodLiteral<'avif'>, - ] - >; - }>; + // This needs to be in sync with ImageMetadata + export type ImageFunction = () => import('astro/zod').ZodObject<{ + src: import('astro/zod').ZodString; + width: import('astro/zod').ZodNumber; + height: import('astro/zod').ZodNumber; + format: import('astro/zod').ZodUnion< + [ + import('astro/zod').ZodLiteral<'png'>, + import('astro/zod').ZodLiteral<'jpg'>, + import('astro/zod').ZodLiteral<'jpeg'>, + import('astro/zod').ZodLiteral<'tiff'>, + import('astro/zod').ZodLiteral<'webp'>, + import('astro/zod').ZodLiteral<'gif'>, + import('astro/zod').ZodLiteral<'svg'>, + import('astro/zod').ZodLiteral<'avif'>, + ] + >; + }>; - type BaseSchemaWithoutEffects = - | import('astro/zod').AnyZodObject - | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> - | import('astro/zod').ZodDiscriminatedUnion - | import('astro/zod').ZodIntersection; + type BaseSchemaWithoutEffects = + | import('astro/zod').AnyZodObject + | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> + | import('astro/zod').ZodDiscriminatedUnion + | import('astro/zod').ZodIntersection; - type BaseSchema = - | BaseSchemaWithoutEffects - | import('astro/zod').ZodEffects; + type BaseSchema = BaseSchemaWithoutEffects | import('astro/zod').ZodEffects; - export type SchemaContext = { image: ImageFunction }; + export type SchemaContext = { image: ImageFunction }; - type DataCollectionConfig = { - type: 'data'; - schema?: S | ((context: SchemaContext) => S); - }; + type DataCollectionConfig = { + type: 'data'; + schema?: S | ((context: SchemaContext) => S); + }; - type ContentCollectionConfig = { - type?: 'content'; - schema?: S | ((context: SchemaContext) => S); - }; + type ContentCollectionConfig = { + type?: 'content'; + schema?: S | ((context: SchemaContext) => S); + }; - type CollectionConfig = ContentCollectionConfig | DataCollectionConfig; + type CollectionConfig = ContentCollectionConfig | DataCollectionConfig; - export function defineCollection( - input: CollectionConfig - ): CollectionConfig; + export function defineCollection(input: CollectionConfig): CollectionConfig; - type AllValuesOf = T extends any ? T[keyof T] : never; - type ValidContentEntrySlug = AllValuesOf< - ContentEntryMap[C] - >['slug']; + type AllValuesOf = T extends any ? T[keyof T] : never; + type ValidContentEntrySlug = AllValuesOf['slug']; - export function getEntryBySlug< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >( - collection: C, - // Note that this has to accept a regular string too, for SSR - entrySlug: E - ): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; + export function getEntryBySlug | (string & {})>( + collection: C, + // Note that this has to accept a regular string too, for SSR + entrySlug: E, + ): E extends ValidContentEntrySlug ? Promise> : Promise | undefined>; - export function getDataEntryById( - collection: C, - entryId: E - ): Promise>; + export function getDataEntryById( + collection: C, + entryId: E, + ): Promise>; - export function getCollection>( - collection: C, - filter?: (entry: CollectionEntry) => entry is E - ): Promise; - export function getCollection( - collection: C, - filter?: (entry: CollectionEntry) => unknown - ): Promise[]>; + export function getCollection>( + collection: C, + filter?: (entry: CollectionEntry) => entry is E, + ): Promise; + export function getCollection( + collection: C, + filter?: (entry: CollectionEntry) => unknown, + ): Promise[]>; - export function getEntry< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >(entry: { - collection: C; - slug: E; - }): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; - export function getEntry< - C extends keyof DataEntryMap, - E extends keyof DataEntryMap[C] | (string & {}), - >(entry: { - collection: C; - id: E; - }): E extends keyof DataEntryMap[C] - ? Promise - : Promise | undefined>; - export function getEntry< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >( - collection: C, - slug: E - ): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; - export function getEntry< - C extends keyof DataEntryMap, - E extends keyof DataEntryMap[C] | (string & {}), - >( - collection: C, - id: E - ): E extends keyof DataEntryMap[C] - ? Promise - : Promise | undefined>; + export function getEntry | (string & {})>(entry: { + collection: C; + slug: E; + }): E extends ValidContentEntrySlug ? Promise> : Promise | undefined>; + export function getEntry(entry: { + collection: C; + id: E; + }): E extends keyof DataEntryMap[C] ? Promise : Promise | undefined>; + export function getEntry | (string & {})>( + collection: C, + slug: E, + ): E extends ValidContentEntrySlug ? Promise> : Promise | undefined>; + export function getEntry( + collection: C, + id: E, + ): E extends keyof DataEntryMap[C] ? Promise : Promise | undefined>; - /** Resolve an array of entry references from the same collection */ - export function getEntries( - entries: { - collection: C; - slug: ValidContentEntrySlug; - }[] - ): Promise[]>; - export function getEntries( - entries: { - collection: C; - id: keyof DataEntryMap[C]; - }[] - ): Promise[]>; + /** Resolve an array of entry references from the same collection */ + export function getEntries( + entries: { + collection: C; + slug: ValidContentEntrySlug; + }[], + ): Promise[]>; + export function getEntries( + entries: { + collection: C; + id: keyof DataEntryMap[C]; + }[], + ): Promise[]>; - export function reference( - collection: C - ): import('astro/zod').ZodEffects< - import('astro/zod').ZodString, - C extends keyof ContentEntryMap - ? { - collection: C; - slug: ValidContentEntrySlug; - } - : { - collection: C; - id: keyof DataEntryMap[C]; - } - >; - // Allow generic `string` to avoid excessive type errors in the config - // if `dev` is not running to update as you edit. - // Invalid collection names will be caught at build time. - export function reference( - collection: C - ): import('astro/zod').ZodEffects; + export function reference( + collection: C, + ): import('astro/zod').ZodEffects< + import('astro/zod').ZodString, + C extends keyof ContentEntryMap + ? { + collection: C; + slug: ValidContentEntrySlug; + } + : { + collection: C; + id: keyof DataEntryMap[C]; + } + >; + // Allow generic `string` to avoid excessive type errors in the config + // if `dev` is not running to update as you edit. + // Invalid collection names will be caught at build time. + export function reference( + collection: C, + ): import('astro/zod').ZodEffects; - type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; - type InferEntrySchema = import('astro/zod').infer< - ReturnTypeOrOriginal['schema']> - >; + type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; + type InferEntrySchema = import('astro/zod').infer< + ReturnTypeOrOriginal['schema']> + >; - type ContentEntryMap = { - "blog": { -"hello.mdx": { - id: "hello.mdx"; - slug: "hello"; - body: string; - collection: "blog"; - data: any -} & { render(): Render[".mdx"] }; -}; + type ContentEntryMap = { + blog: { + 'hello.mdx': { + id: 'hello.mdx'; + slug: 'hello'; + body: string; + collection: 'blog'; + data: any; + } & { render(): Render['.mdx'] }; + }; + }; - }; + type DataEntryMap = {}; - type DataEntryMap = { - - }; + type AnyEntryMap = ContentEntryMap & DataEntryMap; - type AnyEntryMap = ContentEntryMap & DataEntryMap; - - type ContentConfig = never; + type ContentConfig = never; } From c02976782bf83f42d3061c923e0cb923088f7fdc Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 23:22:10 +0100 Subject: [PATCH 51/55] add video component --- website/src/components/BlogVideo.astro | 5 +++++ website/src/content/blog/release-0.8.0-himbeermuffin.mdx | 4 +++- website/src/content/blog/release-0.9.0-bananenbrot.mdx | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 website/src/components/BlogVideo.astro diff --git a/website/src/components/BlogVideo.astro b/website/src/components/BlogVideo.astro new file mode 100644 index 00000000..e9112fda --- /dev/null +++ b/website/src/components/BlogVideo.astro @@ -0,0 +1,5 @@ +--- +const { src } = Astro.props; +--- + + diff --git a/website/src/content/blog/release-0.8.0-himbeermuffin.mdx b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx index d2ae211a..49116666 100644 --- a/website/src/content/blog/release-0.8.0-himbeermuffin.mdx +++ b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx @@ -6,6 +6,8 @@ tags: ['meta'] author: froos --- +import BlogVideo from '../../components/BlogVideo.astro'; + # Release Notes v0.8.0 Himbeermuffin These are the release notes for Strudel 0.8.0 aka "Himbeermuffin"! @@ -43,7 +45,7 @@ I would be very happy to collect some feedback on how it works across different Also still undocumented, but you can now visualize patterns as a spiral via `.spiral()`: -https://github.com/tidalcycles/strudel/assets/12023032/05bc2dba-b304-4298-9465-a1a6fafe5ded + This is especially nice because strudel is not only the name of a dessert but also the german word for vortex! The spiral is very fitting to visualize cycles because you can align cycles vertically, while surfing along an infinite twisted timeline. diff --git a/website/src/content/blog/release-0.9.0-bananenbrot.mdx b/website/src/content/blog/release-0.9.0-bananenbrot.mdx index 1322362e..c18bc60e 100644 --- a/website/src/content/blog/release-0.9.0-bananenbrot.mdx +++ b/website/src/content/blog/release-0.9.0-bananenbrot.mdx @@ -6,6 +6,8 @@ tags: ['meta'] author: froos --- +import BlogVideo from '../../components/BlogVideo.astro'; + # Release Notes v0.9.0 Bananenbrot These are the release notes for Strudel 0.9.0 aka "Bananenbrot"! @@ -25,7 +27,7 @@ Main new features include: - [vibrato](https://strudel.tidalcycles.org/learn/synths#vibrato) - an integration of [ZZFX](https://strudel.tidalcycles.org/learn/synths#zzfx) -https://github.com/tidalcycles/strudel/assets/12023032/652e7042-f296-496b-95cd-b2a4987fe238 + Related PRs: From 98db3d37efda3a851161e943f019766e8243ef68 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 23:30:26 +0100 Subject: [PATCH 52/55] add anchor links --- website/src/components/BlogPost.astro | 2 +- website/src/pages/blog.astro | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/website/src/components/BlogPost.astro b/website/src/components/BlogPost.astro index 1fdb5a1a..0b3fc6a5 100644 --- a/website/src/components/BlogPost.astro +++ b/website/src/components/BlogPost.astro @@ -12,7 +12,7 @@ const { Content } = await post.render(); >
-

{post.title}

+

{post.title}

diff --git a/website/src/pages/blog.astro b/website/src/pages/blog.astro index 431244c6..d01eb6b8 100644 --- a/website/src/pages/blog.astro +++ b/website/src/pages/blog.astro @@ -36,7 +36,13 @@ const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.da {posts.map((post) => )}
From 79f1a863b6451eb1dee37036524c7df8a8f40fce Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 14 Jan 2024 23:39:03 +0100 Subject: [PATCH 53/55] add date + author to posts + dedupe headings --- website/src/components/BlogPost.astro | 8 +++++++- website/src/content/blog/release-0.0.2-schwindlig.mdx | 2 -- website/src/content/blog/release-0.0.2.1-stuermisch.mdx | 2 -- website/src/content/blog/release-0.0.3-maelstrom.mdx | 2 -- website/src/content/blog/release-0.0.4-gischt.mdx | 2 -- website/src/content/blog/release-0.3.0-donauwelle.mdx | 2 -- website/src/content/blog/release-0.4.0-brandung.mdx | 2 -- website/src/content/blog/release-0.5.0-wirbel.mdx | 2 -- website/src/content/blog/release-0.6.0-zimtschnecke.mdx | 2 -- website/src/content/blog/release-0.7.0-zuckerguss.mdx | 2 -- website/src/content/blog/release-0.8.0-himbeermuffin.mdx | 2 -- website/src/content/blog/release-0.9.0-bananenbrot.mdx | 2 -- website/src/pages/blog.astro | 1 - 13 files changed, 7 insertions(+), 24 deletions(-) diff --git a/website/src/components/BlogPost.astro b/website/src/components/BlogPost.astro index 0b3fc6a5..b5b82680 100644 --- a/website/src/components/BlogPost.astro +++ b/website/src/components/BlogPost.astro @@ -5,6 +5,7 @@ type Props = CollectionEntry<'blog'>['data']; const { post } = Astro.props; const { Content } = await post.render(); +import { format } from 'date-fns'; ---
-

{post.title}

+

{post.data.title}

+

+ +

diff --git a/website/src/content/blog/release-0.0.2-schwindlig.mdx b/website/src/content/blog/release-0.0.2-schwindlig.mdx index 3cb9b50b..b65ff98f 100644 --- a/website/src/content/blog/release-0.0.2-schwindlig.mdx +++ b/website/src/content/blog/release-0.0.2-schwindlig.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.0.2 Schwindlig - ## What's Changed - Most work done as [commits to main](https://github.com/tidalcycles/strudel/commits/2a0d8c3f77ff7b34e82602e2d02400707f367316) diff --git a/website/src/content/blog/release-0.0.2.1-stuermisch.mdx b/website/src/content/blog/release-0.0.2.1-stuermisch.mdx index 28da1a8f..3824bd6b 100644 --- a/website/src/content/blog/release-0.0.2.1-stuermisch.mdx +++ b/website/src/content/blog/release-0.0.2.1-stuermisch.mdx @@ -5,8 +5,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.0.2.1 Stürmisch - ## What's Changed - Add chunk, chunkBack and iterBack by @yaxu in https://github.com/tidalcycles/strudel/pull/25 diff --git a/website/src/content/blog/release-0.0.3-maelstrom.mdx b/website/src/content/blog/release-0.0.3-maelstrom.mdx index ee8d5143..542412d8 100644 --- a/website/src/content/blog/release-0.0.3-maelstrom.mdx +++ b/website/src/content/blog/release-0.0.3-maelstrom.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.0.3 Maelstrom - ## What's Changed - Add chunk, chunkBack and iterBack by @yaxu in https://github.com/tidalcycles/strudel/pull/25 diff --git a/website/src/content/blog/release-0.0.4-gischt.mdx b/website/src/content/blog/release-0.0.4-gischt.mdx index 93db4876..83b831a7 100644 --- a/website/src/content/blog/release-0.0.4-gischt.mdx +++ b/website/src/content/blog/release-0.0.4-gischt.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.0.4 Gischt - ## What's Changed - Webaudio rewrite by @felixroos in https://github.com/tidalcycles/strudel/pull/138 diff --git a/website/src/content/blog/release-0.3.0-donauwelle.mdx b/website/src/content/blog/release-0.3.0-donauwelle.mdx index ce086dbc..70dba0e6 100644 --- a/website/src/content/blog/release-0.3.0-donauwelle.mdx +++ b/website/src/content/blog/release-0.3.0-donauwelle.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.3.0 Donauwelle - ## Package Versions - @strudel.cycles/core@0.3.1 diff --git a/website/src/content/blog/release-0.4.0-brandung.mdx b/website/src/content/blog/release-0.4.0-brandung.mdx index 67e61ece..56a1d2e2 100644 --- a/website/src/content/blog/release-0.4.0-brandung.mdx +++ b/website/src/content/blog/release-0.4.0-brandung.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.4.0 Brandung - ## What's Changed - new transpiler based on acorn by @felixroos in https://github.com/tidalcycles/strudel/pull/249 diff --git a/website/src/content/blog/release-0.5.0-wirbel.mdx b/website/src/content/blog/release-0.5.0-wirbel.mdx index 8912627c..7d04f0d2 100644 --- a/website/src/content/blog/release-0.5.0-wirbel.mdx +++ b/website/src/content/blog/release-0.5.0-wirbel.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.5.0 Wirbel - ## Package Versions - @strudel.cycles/core@0.5.0 diff --git a/website/src/content/blog/release-0.6.0-zimtschnecke.mdx b/website/src/content/blog/release-0.6.0-zimtschnecke.mdx index 9e5f2f35..ee6353d3 100644 --- a/website/src/content/blog/release-0.6.0-zimtschnecke.mdx +++ b/website/src/content/blog/release-0.6.0-zimtschnecke.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.6.0 Zimtschnecke - ## Package Versions - @strudel.cycles/core@0.6.8 diff --git a/website/src/content/blog/release-0.7.0-zuckerguss.mdx b/website/src/content/blog/release-0.7.0-zuckerguss.mdx index 55315a9c..1d810cb2 100644 --- a/website/src/content/blog/release-0.7.0-zuckerguss.mdx +++ b/website/src/content/blog/release-0.7.0-zuckerguss.mdx @@ -6,8 +6,6 @@ tags: ['meta'] author: froos --- -# Release Notes v0.7.0 Zimtschnecke - ## Package Versions - @strudel.cycles/core@0.7.2 diff --git a/website/src/content/blog/release-0.8.0-himbeermuffin.mdx b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx index 49116666..7baea4c1 100644 --- a/website/src/content/blog/release-0.8.0-himbeermuffin.mdx +++ b/website/src/content/blog/release-0.8.0-himbeermuffin.mdx @@ -8,8 +8,6 @@ author: froos import BlogVideo from '../../components/BlogVideo.astro'; -# Release Notes v0.8.0 Himbeermuffin - These are the release notes for Strudel 0.8.0 aka "Himbeermuffin"! [Go to Tidal Club Forum for this Release](https://club.tidalcycles.org/t/strudel-0-8-0-released/4769) diff --git a/website/src/content/blog/release-0.9.0-bananenbrot.mdx b/website/src/content/blog/release-0.9.0-bananenbrot.mdx index c18bc60e..eed5bf55 100644 --- a/website/src/content/blog/release-0.9.0-bananenbrot.mdx +++ b/website/src/content/blog/release-0.9.0-bananenbrot.mdx @@ -8,8 +8,6 @@ author: froos import BlogVideo from '../../components/BlogVideo.astro'; -# Release Notes v0.9.0 Bananenbrot - These are the release notes for Strudel 0.9.0 aka "Bananenbrot"! The last release was over 11 weeks ago, so a lot of things have happened! diff --git a/website/src/pages/blog.astro b/website/src/pages/blog.astro index d01eb6b8..80270353 100644 --- a/website/src/pages/blog.astro +++ b/website/src/pages/blog.astro @@ -32,7 +32,6 @@ const posts = (await getCollection('blog')).sort((a, b) => compareDesc(a.data.da -

Strudel Blog

{posts.map((post) => )}