loading WebChuck and running its test code (tested on desktop and Quest2)

webchuck
Fabien Benetou 2 years ago
parent 730cfb5659
commit 8d4e66ae65
  1. 12
      index.html

@ -28,6 +28,11 @@
<script src="https://cdn.jsdelivr.net/npm/webmidi@next/dist/iife/webmidi.iife.js"></script>
<script src="https://unpkg.com/tone"></script>
<script> var whereIsChuck = "../content/webchuck/"; </script> <!-- Specify where ChucK is -->
<!-- Connect Web Audio API, Connect webchuck.js and webchuck.wasm -->
<script type="text/javascript" src="https://chuck.stanford.edu/webchuck/src/webchuck_host.js"></script> <!-- WebChucK IDE modules -->
<script type="text/javascript" src="https://chuck.stanford.edu/webchuck/js/Visualizer.js"></script> <!-- WebChucK to WebAudioAPI -->
<!-- replacing with local copies as CDNs are like unpkg tend to be slow
<script type="module" src="https://unpkg.com/immers-client/dist/destination.bundle.js"></script>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
@ -2168,7 +2173,9 @@ function addAllPrimitives(){
.map( (i,j) => addPrimitive( i, ""+ j/7 + " 1.4 -0.5" ) )
}
function startExperience(){
async function startExperience(){
await startChuck();
await startVisualizer();
startWebMIDI()
if (AFRAME.utils.device.checkHeadsetConnected())
AFRAME.scenes[0].enterVR();
@ -2460,6 +2467,8 @@ const drumkitBaseURL = "https://fabien.benetou.fr/pub/home/future_of_text_demo/c
</div>
<button id=mainbutton style="z-index: 1; position: absolute; width:50%; margin: auto; text-align:center; top:45%; left:30%; height:30%;" onclick="startExperience()">Start the experience (hand tracking recommended)</button>
<canvas class="canvas" id="canvas" style="width:650px; height:600px; display:none;"></canvas>
<a-scene physics="debug:true" cursor="rayOrigin: mouse" raycaster="objects: [html]; interval:100;" adjust-height-in-vr
toolbox disable-components-via-url enable-components-via-url NOcommands-from-external-json keyboard >
<!-- screenstack dynamic-view selectionboxonpinches glossary timeline issues fot
@ -2508,6 +2517,7 @@ const drumkitBaseURL = "https://fabien.benetou.fr/pub/home/future_of_text_demo/c
<a-entity hide-on-enter-ar="" id="environmentsky" class="hidableenvironment" gltf-model="../content/SourceCityToolkit/SKY_Market_day.glb" scale="1 1 1" position="17 -10 -4" rotation="0 0 0"></a-entity>
<a-troika-text anchor=left target value="instructions : \n--right pinch to move\n--left pinch to execute" position="0 1.65 -0.2" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target value="jxr theChuck.runCode('SinOsc osc => dac; 440 => osc.freq; 1::week => now;')" position="0 1.35 -0.1" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target value="jxr startWebMIDI()" position="0 1.25 -0.1" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target id="locationreload" value="jxr location.reload()" position="0 1.20 -0.1" scale="0.1 0.1 0.1"></a-troika-text>

Loading…
Cancel
Save