|
1 | | -<html> |
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
2 | 3 | <head> |
3 | | -<title>csound-wasm dev</title> |
4 | | -</head> |
5 | | -<body> |
6 | | - <h1>csound-wasm dev</h1> |
7 | | - <script src="/libcsound.js"></script> |
8 | | - <script src="/main.js"></script> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>csound-wasm dev</title> |
| 6 | + </head> |
| 7 | + <body> |
| 8 | + <h1>csound-wasm dev</h1> |
| 9 | + <script src="main.js"></script> |
9 | 10 | <script> |
10 | | - var csound = csound_wasm; |
| 11 | + // var csound = csound_wasm.browser.main; |
11 | 12 | const beeper = ` |
12 | 13 | <CsoundSynthesizer> |
13 | 14 | <CsOptions> |
14 | | - -+rtmidi=null -M0 |
| 15 | + -+rtmidi=null -M0 |
15 | 16 | </CsOptions> |
16 | 17 | <CsInstruments> |
17 | | - ;Example by Andrés Cabrera |
| 18 | + ;Example by Andrés Cabrera |
18 | 19 |
|
19 | | - sr = 44100 |
20 | | - ksmps = 32 |
21 | | - nchnls = 2 |
22 | | - 0dbfs = 1 |
| 20 | + sr = 44100 |
| 21 | + ksmps = 32 |
| 22 | + nchnls = 2 |
| 23 | + 0dbfs = 1 |
23 | 24 |
|
24 | 25 | massign 0, 1 ;assign all MIDI channels to instrument 1 |
25 | | - |
| 26 | + |
26 | 27 | opcode declick, a, a |
27 | | - ain xin |
28 | | - aenv linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0 |
| 28 | + ain xin |
| 29 | + aenv linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0 |
29 | 30 | xout ain * aenv ; apply envelope and write output |
30 | 31 | endop |
31 | | - |
32 | | - instr 1 |
33 | | - iCps cpsmidi ;get the frequency from the key pressed |
34 | | - iAmp ampmidi 0dbfs * 0.3 ;get the amplitude |
35 | | - aOut poscil iAmp, iCps ;generate a sine tone |
36 | | - kenv mxadsr 0.1, 0, 1, 0.5 |
37 | | - aOut *= kenv |
| 32 | + |
| 33 | + instr 1 |
| 34 | + iCps cpsmidi ;get the frequency from the key pressed |
| 35 | + iAmp ampmidi 0dbfs * 0.3 ;get the amplitude |
| 36 | + aOut poscil iAmp, iCps ;generate a sine tone |
| 37 | + kenv mxadsr 0.1, 0, 1, 0.5 |
| 38 | + aOut *= kenv |
38 | 39 | outs aOut, aOut ;write it to the output |
39 | | - endin |
| 40 | + endin |
40 | 41 |
|
41 | 42 | </CsInstruments> |
42 | 43 | <CsScore> |
|
0 commit comments