Skip to content
This repository was archived by the owner on Jan 23, 2021. It is now read-only.

Commit 2a17928

Browse files
committed
dont require libcsound as global
1 parent 0af2ed8 commit 2a17928

21 files changed

+1910
-2440
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ package-lock.json
66
*.wav
77
browser/cljs-runtime
88
browser/manifest.edn
9+
.shadow-cljs
10+
yarn.lock

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ node_modules
44
package-lock.json
55
*~
66
*.wav
7+
deps.cljs
8+
project.clj
9+
shadow-cljs.edn
10+
src
11+
.shadow-cljs
12+
yarn.lock

browser/index.html

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
1-
<html>
1+
<!DOCTYPE html>
2+
<html lang="en">
23
<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>
910
<script>
10-
var csound = csound_wasm;
11+
// var csound = csound_wasm.browser.main;
1112
const beeper = `
1213
<CsoundSynthesizer>
1314
<CsOptions>
14-
-+rtmidi=null -M0
15+
-+rtmidi=null -M0
1516
</CsOptions>
1617
<CsInstruments>
17-
;Example by Andrés Cabrera
18+
;Example by Andrés Cabrera
1819
19-
sr = 44100
20-
ksmps = 32
21-
nchnls = 2
22-
0dbfs = 1
20+
sr = 44100
21+
ksmps = 32
22+
nchnls = 2
23+
0dbfs = 1
2324
2425
massign 0, 1 ;assign all MIDI channels to instrument 1
25-
26+
2627
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
2930
xout ain * aenv ; apply envelope and write output
3031
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
3839
outs aOut, aOut ;write it to the output
39-
endin
40+
endin
4041
4142
</CsInstruments>
4243
<CsScore>

browser/libcsound.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

browser/main.js

Lines changed: 1607 additions & 2141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps.cljs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{:foreign-libs
2+
[{:file "csound_wasm/libcsound.js"
3+
:provides ["libcsound"]}]}

examples/example1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const csound = require('../index.js');
1+
const csound = require('../');
22

33
const beeper = `
44
instr 1

examples/example2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const csound = require('../index.js');
1+
const csound = require('../');
22

33
const beeper = `
44
instr 1

examples/example3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const csound = require('../index.js');
1+
const csound = require('../');
22

33
const csd = `
44
<CsoundSynthesizer>

examples/example4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const csound = require('../index.js');
1+
const csound = require('../');
22

33
const csd = `
44
<CsoundSynthesizer>

0 commit comments

Comments
 (0)