mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 21:48:27 +00:00
Update README.md
This commit is contained in:
parent
df35a5c9b1
commit
4463d4a417
@ -13,24 +13,43 @@ npm i @strudel.cycles/react
|
|||||||
Here is a minimal example of how to set up a MiniRepl:
|
Here is a minimal example of how to set up a MiniRepl:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { evalScope, controls } from '@strudel.cycles/core';
|
import * as React from 'react';
|
||||||
|
import '@strudel.cycles/react/dist/style.css';
|
||||||
import { MiniRepl } from '@strudel.cycles/react';
|
import { MiniRepl } from '@strudel.cycles/react';
|
||||||
import { prebake } from '../repl/src/prebake.mjs';
|
import { evalScope, controls } from '@strudel.cycles/core';
|
||||||
|
import { samples, initAudioOnFirstClick } from '@strudel.cycles/webaudio';
|
||||||
|
|
||||||
evalScope(
|
async function prebake() {
|
||||||
controls,
|
await samples(
|
||||||
import('@strudel.cycles/core'),
|
'https://strudel.tidalcycles.org/tidal-drum-machines.json',
|
||||||
import('@strudel.cycles/tonal'),
|
'github:ritchse/tidal-drum-machines/main/machines/'
|
||||||
import('@strudel.cycles/mini'),
|
);
|
||||||
import('@strudel.cycles/webaudio'),
|
await samples(
|
||||||
/* probably import other strudel packages */
|
'https://strudel.tidalcycles.org/EmuSP12.json',
|
||||||
);
|
'https://strudel.tidalcycles.org/EmuSP12/'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
prebake();
|
async function init() {
|
||||||
|
await evalScope(
|
||||||
|
controls,
|
||||||
|
import('@strudel.cycles/core'),
|
||||||
|
import('@strudel.cycles/mini'),
|
||||||
|
import('@strudel.cycles/webaudio'),
|
||||||
|
import('@strudel.cycles/tonal')
|
||||||
|
);
|
||||||
|
await prebake();
|
||||||
|
initAudioOnFirstClick();
|
||||||
|
}
|
||||||
|
|
||||||
export function Repl({ tune }) {
|
if (typeof window !== 'undefined') {
|
||||||
return <MiniRepl tune={tune} hideOutsideView={true} />;
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
return <MiniRepl tune={`s("bd sd,hh*4")`} />;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For a more sophisticated example, check out the [nano-repl](./examples/nano-repl/)!
|
- Open [example on stackblitz](https://stackblitz.com/edit/react-ts-saaair?file=tune.tsx,App.tsx)
|
||||||
|
- Also check out the [nano-repl](./examples/nano-repl/) for a more sophisticated example
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user