🎧audio-hacker 介绍
你是否想冲破网页中视频的音量的限度?或者还原那些被变声过的声音?
audio-hacker 是一个基于谷歌 jungle.js 封装的 ts 库,提供了 ts 类型和音量增益办法,应用形式非常简略。
A magical library for controlling audio pitch and volume, based on jungle.js
装置
npm i audio-hacker
yarn add audio-hacker
pnpm add audio-hacker
初始化 Audiohacker
import Audiohacker from 'audio-hacker';
const audioCtx = new AudioContext();
if (audioCtx.state !== 'running') {await audioCtx.resume();
}
const video = document.querySelector('video');
const source = audioCtx.createMediaElementSource(video);
const audioController = new Audiohacker(audioCtx, source);
调整音调
// best step 0.01
audioController.setPitchOffset(0.22);
audioController.setPitchOffset(-0.12);
调整音量
// minimum value is 0;
audioController.setVolume(0.3);
audioController.setVolume(3.3);
断开连接
audioController.disconnect();
更多
If you want to do it in a simpler way, use Video Roll browser extension.