Created
July 2, 2024 22:38
-
-
Save wchargin/cd9a41195d463d871f401f7e744ac12b to your computer and use it in GitHub Desktop.
bookmarklets for audio manipulation (speed and panning)
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
javascript:((pan) => { if (!window.__wcharginPanState) { const ctx = new AudioContext(); const panner = new StereoPannerNode(ctx); panner.connect(ctx.destination); const vsrcSymbol = Symbol("mediaSourceOutput"); window.__wcharginPanState = { ctx, panner, vsrcSymbol };}; const {ctx, panner, vsrcSymbol} = window.__wcharginPanState; for (const video of document.querySelectorAll("video")) { if (!video[vsrcSymbol]) { video[vsrcSymbol] = ctx.createMediaElementSource(video); video[vsrcSymbol].connect(panner); } } panner.pan.value = pan; })(Number(prompt("pan? (-1 to 1)"))); |
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
javascript:(function() { const r = prompt("New playback rate? Was: " + (document.querySelector("video") || {playbackRate: null}).playbackRate); if (r == null) return; for(const v of [...document.querySelectorAll("video"), ...document.querySelectorAll("audio")]) v.playbackRate = Number(r) || 1.0; })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment