Vizualizer
Small library to simplify the creation of audio visualisation
Static Method Summary
Static Public Methods | ||
public static |
withArrayBuffer(arrayBuffer: ArrayBuffer, bufferLength: number): Vizualizer Create a new Vizualizer with the specified array buffer |
|
public static |
withContextSource(context: AudioContext, source: AudioSourceNode, bufferLength: number): Vizualizer Create a new Vizualizer with the specified audio context and source |
|
public static |
withElement(element: Element, bufferLength: number): Vizualizer Create a new Vizualizer with the specified audio element |
|
public static |
withMedia(mediaUrl: String, bufferLength: number): Vizualizer Create a new Vizualizer with the specified url of a media |
Constructor Summary
Public Constructor | ||
public |
Default constructor with null members |
Member Summary
Public Members | ||
public |
audioAnalyser: AnalyserNode Audio Analyser |
|
public |
Audio Context |
|
public |
Audio Element |
|
public |
audioSource: AudioSourceNode Audio Source |
|
public |
Array of data of the audio |
|
public |
Array of effects |
|
public |
The ID value returned by the call to window.requestAnimationFrame() |
Method Summary
Public Methods | ||
public |
addEffect(effect: EffectVizualizer) Add an effect at the end of the array |
|
public |
changeEffect(effectVizualizer: EffectVizualizer, i: number) Change the effect of the vizualizer |
|
public |
Initialize the visibilty change event to stop the visualisation when the page is not visible. |
|
public |
loadArrayBuffer(arraybuffer: ArrayBuffer) Load the vizualizer with the specified array buffer |
|
public |
loadAudioContext(context: AudioContext) Change the audio context |
|
public |
loadDataUrl(dataUrl: string) Load the vizualizer with the specified data url |
|
public |
loadElement(element: Element) Change the audio element |
|
public |
Remove the last effect added |
|
public |
removeEffect(index: number) Remove the effect specified by the index |
|
public |
start() Start the visualisation |
|
public |
Render every effect in the array effects |
|
public |
stop() Stop the visualisation |
Static Public Methods
public static withArrayBuffer(arrayBuffer: ArrayBuffer, bufferLength: number): Vizualizer source
Create a new Vizualizer with the specified array buffer
Params:
Name | Type | Attribute | Description |
arrayBuffer | ArrayBuffer | Array buffer |
|
bufferLength | number |
|
The length of the buffer |
Throw:
Web Audio not supported by the browser |
public static withContextSource(context: AudioContext, source: AudioSourceNode, bufferLength: number): Vizualizer source
Create a new Vizualizer with the specified audio context and source
Params:
Name | Type | Attribute | Description |
context | AudioContext | Audio context |
|
source | AudioSourceNode | Source |
|
bufferLength | number |
|
The length of the buffer |
public static withElement(element: Element, bufferLength: number): Vizualizer source
Create a new Vizualizer with the specified audio element
Throw:
Web Audio not supported by the browser |
public static withMedia(mediaUrl: String, bufferLength: number): Vizualizer source
Create a new Vizualizer with the specified url of a media
Throw:
Web Audio not supported by the browser |
Public Constructors
Public Members
Public Methods
public addEffect(effect: EffectVizualizer) source
Add an effect at the end of the array
Params:
Name | Type | Attribute | Description |
effect | EffectVizualizer | Effect to add |
public changeEffect(effectVizualizer: EffectVizualizer, i: number) source
Change the effect of the vizualizer
Params:
Name | Type | Attribute | Description |
effectVizualizer | EffectVizualizer | Effect |
|
i | number |
|
Index of the effect to change |
public initializeVisibilityEvent() source
Initialize the visibilty change event to stop the visualisation when the page is not visible.
public loadArrayBuffer(arraybuffer: ArrayBuffer) source
Load the vizualizer with the specified array buffer
Params:
Name | Type | Attribute | Description |
arraybuffer | ArrayBuffer | Array buffer to load |
public loadAudioContext(context: AudioContext) source
Change the audio context
Params:
Name | Type | Attribute | Description |
context | AudioContext | AudioContext |
public loadDataUrl(dataUrl: string) source
Load the vizualizer with the specified data url
Params:
Name | Type | Attribute | Description |
dataUrl | string | Url of the data |
public loadElement(element: Element) source
Change the audio element
Params:
Name | Type | Attribute | Description |
element | Element | Element |