Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Append reverb effect to audio source.

License

NotificationsYou must be signed in to change notification settings

logue/Reverb.js

Repository files navigation

jsdelivr CDNNPM DownloadsOpen in unpkgnpm versionOpen in GitpodTwitter Follow

Append reverb effect to audio source.

This script is originally a spin out ofsf2synth.js's reverb effect.

Sample

Syntax

constreverb=newReverb(ctx,{/**   * Randam noise algorythm   *@see {@link https://github.com/thi-ng/umbrella/tree/develop/packages/random}   */randomAlgorithm:SYSTEM;/**   * IR (Inpulse Response) colord noise algorithm (BLUE, GREEN, PINK, RED, VIOLET, WHITE)   *@see {@link https://github.com/thi-ng/umbrella/tree/develop/packages/colored-noise}   */noise:Noise.WHITE,/** IR source noise scale */scale:1;/** Number of IR source noise peaks */peaks:2;/** Amount of IR decay. 0~100 */decay:5,/** Delay time o IR. (NOT delay effect) 0~100 [sec] */delay:0,/** Filter frequency. 20~5000 [Hz] */filterFreq:2200,/** Filter Q. 0~10 */filterQ:1,/**   * Filter type. 'bandpass' etc.   *@see {@link https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/type}   */filterType:'lowpass',/** Dry (Original Sound) and Wet (Effected sound) raito. 0~1 */mix:0.5,/** Reverse IR. */reverse:false,/** Time length of IR. 0~50 [sec] */time:3,});

Usage

// Setup Audio Contextconstctx=newwindow.AudioContext();// iOS fix.document.addEventListener('touchstart',initAudioContext);functioninitAudioContext(){document.removeEventListener('touchstart',initAudioContext);// wake up AudioContextconstemptySource=ctx.createBufferSource();emptySource.start();emptySource.stop();}// Setup Reverb Classconstreverb=newReverb(ctx,{});// put Audio data to audio buffer sourceconstsourceNode=ctx.createBufferSource();sourceNode.buffer=[AudioBuffer];// Connect Reverbreverb.connect(sourceNode);sourceNode.connect(ctx.destination);// firesourceNode.play();

CDN Usage

Not really intended for use with a CDN.

The dependent libraries@thi.ng/colored-noise,@thi.ng/random and@thi.ng/transducers need to be loaded separately.

Reference

License

©2019-2025 by Logue. Licensed under theMIT License.


[8]ページ先頭

©2009-2025 Movatter.jp