the-drunk-coder / ruffbox Goto Github PK
View Code? Open in Web Editor NEWSimple sampler/synth with text-based step sequencer, running in the web browser.
Home Page: https://parkellipsen.de/ruffbox
License: Other
Simple sampler/synth with text-based step sequencer, running in the web browser.
Home Page: https://parkellipsen.de/ruffbox
License: Other
I try to understand your code cause I would like to implement a web sequencer. Why do you need to use JS setTimeout
? Doesn't Rust have an timer system? Or would this timer need separate thread to don't block the whole Rust process?
Have you thought about using non blocking timer like it is often done on microcontroller? I remember to have used this on esp-open-rtos https://github.com/SuperHouse/esp-open-rtos
Have a look there: https://en.wikipedia.org/wiki/FreeRTOS#Implementation
FreeRTOS implements multiple threads by having the host program call a thread tick method at regular short intervals. The thread tick method switches tasks depending on priority and a round-robin scheduling scheme. The usual interval is 1 to 10 milliseconds (1/1000 to 1/100 of a second), via an interrupt from a hardware timer, but this interval is often changed to suit a particular application.
I guess you might still need to somehow trigger the tick on regular interval and for this you might need setTimeout
. Or maybe it would be possible to run the Rust code in loop and regurlarly call a yield()
function to check if a timer is ready.
When starting server.sh, the following output is printed:
Serving HTTP on 0.0.0.0 port 1234 (http://0.0.0.0:1234/) ...
When opening that link in a browser, the following error message appears in a popup:
AudioWorklet isn't supported... It cannot work.
I believe the reason is that AudioWorklet
is only available in a secure context (see https://developers.google.com/web/updates/2017/12/audio-worklet). The workaround I found is to connect to http://localhost:1234/ instead, as http://localhost is considered secure for local testing (as per the previous link).
The demo wasn't working. I found this error in the console:
Uncaught TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer
at Float32Array.set (<anonymous>)
at AudioWorkletProcessor.process (worklet.js?t=1600116398531:185)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.