add csound minimal example
This commit is contained in:
parent
805bd7e930
commit
ac2aa7f288
11 changed files with 3783 additions and 0 deletions
27
packages/csound/example/main.js
Normal file
27
packages/csound/example/main.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Csound } from '@csound/browser';
|
||||
import './style.css';
|
||||
import csd from './tutorial1.csd?raw';
|
||||
|
||||
document.querySelector('#app').innerHTML = `
|
||||
<div>
|
||||
<button id="startButton">Start</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
let csound = null;
|
||||
const startCsound = async () => {
|
||||
if (csound) {
|
||||
return;
|
||||
}
|
||||
console.log('Starting Csound...');
|
||||
csound = await Csound();
|
||||
console.log(csound);
|
||||
window.csound = csound;
|
||||
|
||||
await csound.compileCsdText(csd);
|
||||
await csound.start();
|
||||
|
||||
document.querySelector('#startButton').remove();
|
||||
};
|
||||
|
||||
document.querySelector('#startButton').addEventListener('click', startCsound);
|
||||
Loading…
Add table
Add a link
Reference in a new issue