-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (49 loc) · 1.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<script src = "https://mimicproject.com/libs/nexusUI.js"></script>
<script src = "./maximilian.v.0.1.js"></script>
<script src = "./enable-threads.js"></script>
<link href="https://fonts.googleapis.com/css?family=Staatliches" rel="stylesheet"/>
<link rel="stylesheet" href="https://mimicproject.com/libs/maximilian-example.css" />
<div>
<div id="title">Maximilian.js Seed</div>
<div id="subtitle">This is a starting point for your own projects</div>
<div><button id="playButton">Play</button></div>
</div>
<div id="oscilloscope"></div>
<div id="spectrogram"></div>
</head>
<body>
<!-- Maximilian code goes here -->
<script id = "myAudioScript">
var osc1 = new Maximilian.maxiOsc();
var osc2 = new Maximilian.maxiOsc();
function play() {
return osc1.saw(100) + osc2.saw(100.2)
}
</script>
<!-- Main Javascript code goes here -->
<script language="javascript">
let maxi;
initAudioEngine("https://louismac.github.io/maximilian-js-local").then((dspEngine)=>{
maxi = dspEngine;
setup();
//Get audio code from script element
maxi.setAudioCode("myAudioScript");
})
///////YOU CAN IGNORE ME - CODE FOR SCOPES///////
let setup = ()=> {
Nexus.context = maxi.audioWorkletNode.context;
new Nexus.Oscilloscope('oscilloscope', {'size': [400,100]}).connect(maxi.audioWorkletNode);
new Nexus.Spectrogram('spectrogram', {'size': [400,100]}).connect(maxi.audioWorkletNode);
const playButton = document.getElementById('playButton');
let playAudio = () => {
playButton.innerHTML = maxi.play() ? "STOP":"PLAY"
}
playButton.addEventListener("click", () => playAudio());
}
///////////////////////////////////////////////
</script>
</body>
</html>