// https://stackoverflow.com/q/78133607/2801559
// https://codegolf.stackexchange.com/q/271654/31257
var floats = new Float32Array([-0.1, 1.0])
var i0 = new Int32Array(floats.buffer);
var i1 = Int32Array.from(floats, f => f < 0 ? f * 32768 : f * 32767);
var i2 = Int32Array.from(floats, f => f * 32768);
var i3 = Int32Array.from(floats, f => (f<<15)-(f<0)*f);
var i4 = Int32Array.from(floats, f => f * 1<<15);
var i5 = Int32Array.from(floats, f => f * 32767.5);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function to play audio | |
function playAudio(audioFile) { | |
console.log(audioFile, chrome.runtime.getURL(audioFile)); | |
const audio = new Audio(chrome.runtime.getURL(audioFile)); // Use chrome.runtime.getURL for packaged extension resources | |
// Play the audio only when the EventListener for click is triggered | |
audio.play(); | |
} | |
// Helper function for setting volume | |
function setAudioVolume(volumeLevel) { |
test.html
<!doctype html>
<html>
<head></head>
<body>
<script type="module">
import * as data from "./exports.js";
console.log(data, location.protocol);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
var url = URL.createObjectURL(new Blob([await (await fetch('https://raw.githubusercontent.com/guest271314/captureSystemAudio/master/native_messaging/capture_system_audio/lame.min.js')).text()],{ | |
type: "text/javascript" | |
})); | |
*/ | |
var dir = await navigator.storage.getDirectory(); | |
var handle; | |
try { | |
handle = await dir.getFileHandle("lame.js", { | |
create: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const decoder = new TextDecoder(); | |
const command = new Deno.Command(Deno.execPath(), { | |
args: [ | |
"info", | |
"--json", | |
], | |
}); | |
const { code, stdout, stderr } = await command.output(); | |
// https://tc39.es/ecma262/multipage/structured-data.html#sec-json.parse | |
// 11.b. Let rootName be the empty String. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finally possible to capture speechSynthesis.speak() on Chromium and Chrome | |
// Enable Speech Dispatcher, PulseAudio loopback for screen capture, disable default WebRTC input volume adjustment from 100% to 8% | |
// chrome --enable-speech-dispatcher --enable-features=PulseaudioLoopbackForScreenShare --disable-features=WebRtcAllowInputVolumeAdjustment | |
// Still have to manually select share system audio in picker with systemAudio set to "include" | |
// https://issues.chromium.org/issues/40155218 | |
let stream = await navigator.mediaDevices.getDisplayMedia({ | |
// We're not going to be using the video track | |
video: { | |
width: 0, | |
height: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// git clone https://github.com/feross/buffer | |
// cd buffer | |
// bun install base64-js ieee754 | |
// bun build ./index.js --target=browser --outfile=buffer.js | |
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); | |
// node_modules/base64-js/index.js | |
var require_base64_js = __commonJS((exports) => { | |
var getLens = function(b64) { |