mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 05:28:41 +00:00
fix: nano-repl
This commit is contained in:
parent
d74cc234c4
commit
d93e396ce5
@ -15,6 +15,7 @@
|
|||||||
"@strudel.cycles/osc": "workspace:*",
|
"@strudel.cycles/osc": "workspace:*",
|
||||||
"@strudel.cycles/mini": "workspace:*",
|
"@strudel.cycles/mini": "workspace:*",
|
||||||
"@strudel.cycles/transpiler": "workspace:*",
|
"@strudel.cycles/transpiler": "workspace:*",
|
||||||
|
"@strudel.cycles/soundfonts": "workspace:*",
|
||||||
"@strudel.cycles/webaudio": "workspace:*",
|
"@strudel.cycles/webaudio": "workspace:*",
|
||||||
"@strudel.cycles/tonal": "workspace:*",
|
"@strudel.cycles/tonal": "workspace:*",
|
||||||
"@strudel.cycles/react": "workspace:*"
|
"@strudel.cycles/react": "workspace:*"
|
||||||
|
|||||||
@ -1,22 +1,34 @@
|
|||||||
import { controls, evalScope } from '@strudel.cycles/core';
|
import { controls, evalScope } from '@strudel.cycles/core';
|
||||||
import { CodeMirror, useHighlighting, useKeydown, useStrudel, flash } from '@strudel.cycles/react';
|
import { CodeMirror, useHighlighting, useKeydown, useStrudel, flash } from '@strudel.cycles/react';
|
||||||
import { getAudioContext, initAudioOnFirstClick, panic, webaudioOutput } from '@strudel.cycles/webaudio';
|
import {
|
||||||
|
getAudioContext,
|
||||||
|
initAudioOnFirstClick,
|
||||||
|
panic,
|
||||||
|
webaudioOutput,
|
||||||
|
registerSynthSounds,
|
||||||
|
} from '@strudel.cycles/webaudio';
|
||||||
|
import { registerSoundfonts } from '@strudel.cycles/soundfonts';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
// import { prebake } from '../../../../../repl/src/prebake.mjs';
|
// import { prebake } from '../../../../../repl/src/prebake.mjs';
|
||||||
|
|
||||||
initAudioOnFirstClick();
|
initAudioOnFirstClick();
|
||||||
|
|
||||||
// TODO: only import stuff when play is pressed?
|
async function init() {
|
||||||
evalScope(
|
// TODO: only import stuff when play is pressed?
|
||||||
controls,
|
const loadModules = evalScope(
|
||||||
import('@strudel.cycles/core'),
|
controls,
|
||||||
import('@strudel.cycles/tonal'),
|
import('@strudel.cycles/core'),
|
||||||
import('@strudel.cycles/mini'),
|
import('@strudel.cycles/tonal'),
|
||||||
import('@strudel.cycles/xen'),
|
import('@strudel.cycles/mini'),
|
||||||
import('@strudel.cycles/webaudio'),
|
import('@strudel.cycles/xen'),
|
||||||
import('@strudel.cycles/osc'),
|
import('@strudel.cycles/webaudio'),
|
||||||
);
|
import('@strudel.cycles/osc'),
|
||||||
|
);
|
||||||
|
|
||||||
|
await Promise.all([loadModules, registerSynthSounds(), registerSoundfonts()]);
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
|
||||||
const defaultTune = `samples({
|
const defaultTune = `samples({
|
||||||
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'],
|
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'],
|
||||||
@ -31,7 +43,7 @@ stack(
|
|||||||
.off(1/8,x=>x.add(12).degradeBy(.5)) // random octave jumps
|
.off(1/8,x=>x.add(12).degradeBy(.5)) // random octave jumps
|
||||||
.add(perlin.range(0,.5)) // random pitch variation
|
.add(perlin.range(0,.5)) // random pitch variation
|
||||||
.superimpose(add(.05)) // add second, slightly detuned voice
|
.superimpose(add(.05)) // add second, slightly detuned voice
|
||||||
.n() // wrap in "n"
|
.note() // wrap in "note"
|
||||||
.decay(.15).sustain(0) // make each note of equal length
|
.decay(.15).sustain(0) // make each note of equal length
|
||||||
.s('sawtooth') // waveform
|
.s('sawtooth') // waveform
|
||||||
.gain(.4) // turn down
|
.gain(.4) // turn down
|
||||||
@ -40,7 +52,7 @@ stack(
|
|||||||
,"<Am7!3 <Em7 E7b13 Em7 Ebm7b5>>".voicings('lefthand') // chords
|
,"<Am7!3 <Em7 E7b13 Em7 Ebm7b5>>".voicings('lefthand') // chords
|
||||||
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
|
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
|
||||||
.add(perlin.range(0,.5)) // random pitch variation
|
.add(perlin.range(0,.5)) // random pitch variation
|
||||||
.n() // wrap in "n"
|
.note() // wrap in "n"
|
||||||
.s('square') // waveform
|
.s('square') // waveform
|
||||||
.gain(.16) // turn down
|
.gain(.16) // turn down
|
||||||
.cutoff(500) // fixed cutoff
|
.cutoff(500) // fixed cutoff
|
||||||
@ -49,7 +61,7 @@ stack(
|
|||||||
,"a4 c5 <e6 a6>".struct("x(5,8)")
|
,"a4 c5 <e6 a6>".struct("x(5,8)")
|
||||||
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
|
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
|
||||||
.add(perlin.range(0,.5)) // random pitch variation
|
.add(perlin.range(0,.5)) // random pitch variation
|
||||||
.n() // wrap in "n"
|
.note() // wrap in "note"
|
||||||
.decay(.1).sustain(0) // make notes short
|
.decay(.1).sustain(0) // make notes short
|
||||||
.s('triangle') // waveform
|
.s('triangle') // waveform
|
||||||
.degradeBy(perlin.range(0,.5)) // randomly controlled random removal :)
|
.degradeBy(perlin.range(0,.5)) // randomly controlled random removal :)
|
||||||
@ -103,7 +115,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[scheduler, evaluate, view],
|
[scheduler, evaluate, view, code],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -341,6 +341,9 @@ importers:
|
|||||||
'@strudel.cycles/react':
|
'@strudel.cycles/react':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../..
|
version: link:../..
|
||||||
|
'@strudel.cycles/soundfonts':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../../soundfonts
|
||||||
'@strudel.cycles/tonal':
|
'@strudel.cycles/tonal':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../../tonal
|
version: link:../../../tonal
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user