audio-hacker
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

🎧audio-hacker

A magical library for controlling audio pitch and volume, based on jungle.js

Installation

npm i audio-hacker

yarn add audio-hacker

pnpm add audio-hacker

Initial 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 audioHacker = new Audiohacker(audioCtx, source);

Update pitch

// best step 0.01
audioHacker.setPitchOffset(0.22);
audioHacker.setPitchOffset(-0.12);

Update volume

// minimum value is 0;
audioHacker.setVolume(0.3);
audioHacker.setVolume(3.3);

Update panner

audioHacker.setPanner(true);
audioHacker.setPanner(false);

Update stereoPanner

audioHacker.setStereoPanner(1);
audioHacker.setStereoPanner(-1);

Disconnect

audioHacker.disconnect();

What more

If you want to do it in a simpler way, use Video Roll browser extension.

Package Sidebar

Install

npm i audio-hacker

Weekly Downloads

1

Version

1.0.8

License

MIT

Unpacked Size

18.8 kB

Total Files

5

Last publish

Collaborators

  • gxy5202