AudioWorkletStream
txiki.js
AudioWorkletStream | txiki.js | |
---|---|---|
5 | 8 | |
25 | 2,337 | |
- | - | |
5.6 | 9.1 | |
3 months ago | 7 days ago | |
HTML | C | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
AudioWorkletStream
-
Node.js fetch() vs. Deno fetch(): Implementation details...
// Exits half way through reading response when --max-old-space-size=6 is set // Exits immediately when --jitless flag is set // // Usage: // // port.postMessage({ // url: 'https://github.com/guest271314/AudioWorkletStream/raw/master/house--64kbs-0-wav', // method: 'get', // body: null // })
-
Are you using generators?
Yes. Fetching a single or multiple files for an infinite stream of audio https://github.com/guest271314/AudioWorkletStream/blob/master/worker.js. Streaming (real-time) audio is non-trivial. Any gaps or glitches in playback will be audible to the user. We could test for expected Float32Arrays. I would suggest complentary manual test in, e.g., WPT to determine audio output does not have gaps or glitches; and renders the expected playback rate.
-
I Created A Web Speech API NPM Package Called SpeechKit
One way to do that is utilizing Native Messaging on Chromium or Firefox https://github.com/guest271314/native-messaging-espeak-ng, and https://github.com/guest271314/webtransport/blob/main/webTransportEspeakNg.js for some WebTransport experiments. Technically we don't need a local server. We can stream and parse the WAV directly and pipe to AudioWorklet or a MediaStreamTrackGenerator https://github.com/guest271314/AudioWorkletStream. The same is true for speech recognition, where audio is piped to the local application and text or JSON piped back. Note also espeak-ng has been compiled to WebAssembly. I created native-messaging-espeak-ng for the ability to pass SSML directly to espeak-ng.
-
How to stream/play a video or audio file on HTTP?
You can stream audio and/or video over HTTP using fetch() https://github.com/guest271314/AudioWorkletStream as long as you know how to parse the codec, if the media is encoded.
-
Is it possible to have an accurate timer in javascript
Re using a dedicated Worker and AudioWorklet to stream, see, e.g., https://github.com/guest271314/AudioWorkletStream; https://plnkr.co/edit/nECtUZ.
txiki.js
-
A list of JavaScript engines, runtimes, interpreters
txiki.js
-
JavaScript Standard Input/Output: Unspecified
// https://github.com/denoland/deno/discussions/17236#discussioncomment-4566134 // https://github.com/saghul/txiki.js/blob/master/src/js/core/tjs/eval-stdin.js async function readFullAsync(length, buffer = new Uint8Array(65536)) { const data = []; while (data.length < length) { const input = await open("/dev/stdin"); let { bytesRead } = await input.read({ buffer }); await input.close(); if (bytesRead === 0) { break; } data.push(...buffer.subarray(0, bytesRead)); } return new Uint8Array(data); }
- Node.js fetch() vs. Deno fetch(): Implementation details...
-
How to compile serveTls for import into QuickJS?
I've only dabbled with the shared libraries once, with the help of the owner of the lnked repository. I wound up solving the issue adjusting the code I was working on https://github.com/saghul/txiki.js/issues/294.
-
C++ to C string concatenation
I have written the same code in C++ https://github.com/guest271314/captureSystemAudio/blob/master/native_messaging/capture_system_audio/capture_system_audio.cpp, Python https://github.com/guest271314/captureSystemAudio/blob/master/native_messaging/capture_system_audio/capture_system_audio.py, and QuickJS (C source code) https://github.com/saghul/txiki.js/issues/294. QuickJS is the only implementation that winds up clipping the end of real-time audio capture.
-
QuickJS JavaScript Engine – Fabrice Bellard
QuickJS is awesome, simple to use and very easy to integrate.
Over the past few years I slowly built a small JS runtime using QuickJS as the engine and libuv as the platform layer, amongst other things, in case anyone wants to take a look: https://github.com/saghul/txiki.js
- GitHub - saghul/txiki.js: The tiny JavaScript runtime built with QuickJS, libuv
- GitHub - saghul/txiki.js: The tiny JavaScript runtime built with QuickJS, libuv and ❤️
What are some alternatives?
streams - Streams Standard
v8go - Execute JavaScript from Go
GoogleNetworkSpeechSynthesis - Google's Network Speech Synthesis: Bring your own Google API key and proxy
engine262 - An implementation of ECMA-262 in JavaScript
speech-kit - Simplifying the Speech Synthesis and Speech Recognition engines for Javascript. Listen for commands and perform callback actions, make the browser speak and transcribe your speech!
javascript-algorithms - 📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
musical-timer - Timers based in musical parameters (time signature, tempo and beat resolution)
proposal-common-minimum-api
native-messaging-espeak-ng - Native Messaging => eSpeak NG => MediaStreamTrack
rayjs - Javascript bindings for raylib in a single ~3mb executable
pocketsphinx - A small speech recognizer