All Projects → chrisguttandin → angular-audio-context

chrisguttandin / angular-audio-context

Licence: MIT license
An Angular wrapper for the Web Audio API's AudioContext.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to angular-audio-context

Mecca
Animated music editor in Clojurescript/re-frame
Stars: ✭ 125 (+525%)
Mutual labels:  web-audio
Audiomotion.js
High-resolution real-time spectrum analyzer and music player using Web Audio and Canvas APIs.
Stars: ✭ 177 (+785%)
Mutual labels:  web-audio
voder
An emulation of the Voder Speech Synthesizer.
Stars: ✭ 19 (-5%)
Mutual labels:  web-audio
Tone.js
A Web Audio framework for making interactive music in the browser.
Stars: ✭ 11,352 (+56660%)
Mutual labels:  web-audio
Wax
An experimental, JSX-compatible renderer for the Web Audio API
Stars: ✭ 171 (+755%)
Mutual labels:  web-audio
Timidity
Play MIDI files in the browser w/ Web Audio, WebAssembly, and libtimidity
Stars: ✭ 221 (+1005%)
Mutual labels:  web-audio
Cracked
Mac app for noise making - built w/ "I Dropped My Phone The Screen Cracked"
Stars: ✭ 98 (+390%)
Mutual labels:  web-audio
ngx-echarts
Apache ECharts component for Angular(基于 Angular 的 Apache ECharts 组件)
Stars: ✭ 82 (+310%)
Mutual labels:  ngx
Tonejs Instruments
A small instrument sample library with quick-loader for tone.js
Stars: ✭ 172 (+760%)
Mutual labels:  web-audio
ngx-ion-simple-mask
Input mask for Angular/Ionic
Stars: ✭ 21 (+5%)
Mutual labels:  ngx
Fetch Stream Audio
Low Latency web audio playback examples for decoding audio streams in chunks with Fetch & Streams APIs
Stars: ✭ 153 (+665%)
Mutual labels:  web-audio
Sono
A simple yet powerful JavaScript library for working with Web Audio
Stars: ✭ 164 (+720%)
Mutual labels:  web-audio
Audion
Audion (Web Audio Inspector) is a Chrome extension that adds a Web Audio panel to Developer Tools. This panel visualizes the web audio graph in real-time and lets users inspect nodes.
Stars: ✭ 230 (+1050%)
Mutual labels:  web-audio
R Audio
A library of React components for building Web Audio graphs.
Stars: ✭ 129 (+545%)
Mutual labels:  web-audio
angular-inviewport
A simple lightweight library for Angular with no other dependencies that detects when an element is within the browser viewport and adds a "sn-viewport-in" or "sn-viewport-out" class to the element
Stars: ✭ 72 (+260%)
Mutual labels:  ngx
Freedrum.js
Interact with the browser using the Freedrum sensors in JavaScript
Stars: ✭ 115 (+475%)
Mutual labels:  web-audio
Audioworklet Polyfill
🔊 Polyfill AudioWorklet using the legacy ScriptProcessor API.
Stars: ✭ 179 (+795%)
Mutual labels:  web-audio
extendable-media-recorder
An extendable drop-in replacement for the native MediaRecorder.
Stars: ✭ 123 (+515%)
Mutual labels:  web-audio
Tonalhub
Make your GitHub repository sing. Tonalhub will take the last year's commit activity and play it with web audio.
Stars: ✭ 18 (-10%)
Mutual labels:  web-audio
I dropped my phone the screen cracked
web audio, cracked.
Stars: ✭ 245 (+1125%)
Mutual labels:  web-audio

angular-audio-context

An Angular wrapper for the Web Audio API's AudioContext.

version

Besides being a wrapper this module also patches the deprecated and prefixed versions of the AudioContext which are out there. It uses the standardized-audio-context to do so.

Usage

This module can be installed via npm like this:

npm install angular-audio-context

It provides an Angular Module that can be imported into your Angular app as usual.

import { AudioContextModule } from 'angular-audio-context';

@NgModule({
    imports: [AudioContextModule.forRoot('balanced')]
})
export class AppModule {}

The AudioContext can then be injected into your components and services.

import { Injectable } from '@angular/core';
import { AudioContext } from 'angular-audio-context';

@Injectable()
export class AnyService {
    constructor(private _audioContext: AudioContext) {}
}

In addition to the AudioContext, this module also provides a function called isSupported which returns a promise which either resolves to true or false depending on the currently used browser's Web Audio API support. An example usage might look like this:

import { Component, Inject } from '@angular/core';
import { isSupported } from 'angular-audio-context';

@Component({
    selector: 'any-component',
    template: '<span *ngIf="this.isSupported() | async">Yeah, your browser is supported.</span>'
})
export class AnyComponent {
    constructor(@Inject(isSupported) public isSupported) {}
}

In case you are missing a feature or found a bug please create a pull request or raise an issue. Thanks.

Example

The following component defintion shows how to implement a basic component which produces a beep each time the button inside the template gets clicked.

import { Component } from '@angular/core';
import { AudioContext } from 'angular-audio-context';

@Component({
    selector: 'my-beep',
    template: '<button (click)="beep()">beep</button>'
})
export class BeepComponent {
    constructor(private _audioContext: AudioContext) {}

    public async beep(): void {
        if (this._audioContext.state === 'suspended') {
            await this._audioContext.resume();
        }

        const oscillatorNode = this._audioContext.createOscillator();

        oscillatorNode.onended = () => oscillatorNode.disconnect();
        oscillatorNode.connect(this._audioContext.destination);

        oscillatorNode.start();
        oscillatorNode.stop(this._audioContext.currentTime + 0.5);
    }
}

Compatibility

Up to version 5 this module was compatible with Angular 1.

Alternatives

There is also module called ngWebAudio which tries to simplify the buffering and playback of a single audio file by utilizing the Web Audio API.

ng-web-apis/audio is a library which allows the Web Audio API to be used from within the templates.

Acknowledgement

The naming of this module tries to align with the recommendations given in the Specification for reusable AngularJS components.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].