All Projects → floatinghotpot → Cordova Plugin Nativeaudio

floatinghotpot / Cordova Plugin Nativeaudio

Licence: other
The low latency audio plugin is designed to enable low latency and polyphonic audio from Cordova/PhoneGap applications, using a very simple and basic API.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Cordova Plugin Nativeaudio

Framework7 Plugin 3d Panels
Framework7 plugin to add 3d effect for side panels
Stars: ✭ 56 (-74.55%)
Mutual labels:  plugin, cordova
Phaser Es6 Webpack
A bootstrap project for create games with Phaser + ES6 + Webpack.
Stars: ✭ 1,266 (+475.45%)
Mutual labels:  game, cordova
Ronn
Randomized overdrive neural networks
Stars: ✭ 64 (-70.91%)
Mutual labels:  plugin, audio
Soloud
Free, easy, portable audio engine for games
Stars: ✭ 1,048 (+376.36%)
Mutual labels:  game, audio
Audio Plugin Development Resources
Various resources related to developing plugins for audio production.
Stars: ✭ 136 (-38.18%)
Mutual labels:  plugin, audio
Kaichronicles
Lone Wolf game books player
Stars: ✭ 52 (-76.36%)
Mutual labels:  game, cordova
Audiokitsynthone
AudioKit Synth One: Open-Source iOS Synthesizer App
Stars: ✭ 1,258 (+471.82%)
Mutual labels:  plugin, audio
Awesome Musicdsp
A curated list of my favourite music DSP and audio programming resources
Stars: ✭ 871 (+295.91%)
Mutual labels:  plugin, audio
Cordova Plugin Audioinput
This iOS/Android Cordova/PhoneGap plugin enables audio capture from the device microphone, by in near real-time forwarding audio to the web layer of your application. A typical usage scenario for this plugin would be to use the captured audio as source for a web audio node chain, where it then can be analyzed, manipulated and/or played.
Stars: ✭ 137 (-37.73%)
Mutual labels:  audio, cordova
Tetris
👾 The original TETRIS game simulator
Stars: ✭ 111 (-49.55%)
Mutual labels:  game, audio
Baseplug
MVC audio plugin framework for rust
Stars: ✭ 44 (-80%)
Mutual labels:  plugin, audio
Awesome Python Applications
💿 Free software that works great, and also happens to be open-source Python.
Stars: ✭ 13,275 (+5934.09%)
Mutual labels:  game, audio
Guitard
Node based multi effects audio processor
Stars: ✭ 31 (-85.91%)
Mutual labels:  plugin, audio
Genshin Audio Extractor
Convert Genshin Impact audio files into a playable format
Stars: ✭ 54 (-75.45%)
Mutual labels:  game, audio
Minimumaudioplugin
Minimum implementation of a native audio plugin for Unity
Stars: ✭ 33 (-85%)
Mutual labels:  plugin, audio
Node Audio
Graph-based audio api for Node.js based on LabSound and JUCE
Stars: ✭ 67 (-69.55%)
Mutual labels:  plugin, audio
Blueprintsound
A plugin for Unreal Engine 4 that surfaces sound-related functionality to Blueprint.
Stars: ✭ 6 (-97.27%)
Mutual labels:  plugin, audio
Wdl Ol
Enhanced version of Cockos' iPlug - A simple-to-use C++ framework for developing cross platform audio plugins and targeting multiple plugin APIs with the same code. VST / VST3 / Audiounit / RTAS / AAX (Native) formats supported. NOTE: THIS IS OBSOLETE, PLEASE SEE IPLUG2:
Stars: ✭ 906 (+311.82%)
Mutual labels:  plugin, audio
Unityionicintegration
A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
Stars: ✭ 94 (-57.27%)
Mutual labels:  plugin, cordova
Cordova Plugin Document Viewer
A Document Viewer cordova/phonegap plugin for iOS, Android and Windows
Stars: ✭ 168 (-23.64%)
Mutual labels:  plugin, cordova

Cordova Native Audio Plugin

Cordova / PhoneGap 3.5+ extension for Native Audio playback, aimed at HTML5 gaming and audio applications which require minimum latency, polyphony and concurrency.

Contents

  1. Description
  2. History
  3. Roadmap
  4. Integration
  5. Supported Platforms
  6. Installation
  7. Usage
  8. API
  9. Demo

Description

This Cordova / PhoneGap (3.5+) plugin enables concurrency (multi-channel playback), polyphony (multi-voice playback) and minimized latency (via caching) in audio-based applications, by leveraging native audio APIs. Designed for the use in HTML5-based cross-platform games and mobile/hybrid audio applications.

History

Community-driven, clean fork of the Low Latency Audio Plugin for Cordova / PhoneGap, initially published by Andrew Trice and then maintained by Raymond Xie and Sidney Bofah.

This project cleans up a lot of legacy code, and adds success, error and completion callbacks. It also features integration in AngularJS projects via ngCordova.

Roadmap

Following the Cordova philosophy, this is a shim for a web audio implementation (on mobile) which is as fast and feature-rich as native mobile APIs. Currently, neither HTML5 Audio or the more recent Web Audio API offer a cross-platform solution which 1) is fast, 2) supports polyphony, 3) concurrency and 4) maintains a low overhead.

It should be replaced by a standardised W3C solution as soon as such an implementation offers comparable performance across (mobile) devices, which is crucial for HTML5-based games.

Integration

This plugin is available as an AngularJS service module, facilitating the usage in AngularJS-based Cordova/PhoneGap projects.

It extends the ngCordova project, an effort by the great guys at Drifty, creators of the Ionic Framework. Download it at the ngCordova website or the repository.

Supported Platforms

  • iOS (tested with 7.1.2, 8.1.3)
  • Android (tested in API levels 14 - 21)

Installation

Via Cordova CLI:

cordova plugin add cordova-plugin-nativeaudio

Usage

  1. Wait for deviceReady.
  2. Preload an audio asset and assign an id - either optimized for single-shot style short clips (preloadSimple()) or looping, ambient background audio (preloadComplex())
  3. play() the audio asset via its id.
  4. unload() the audio asset via its id.

API

Preloading

preloadSimple: function ( id, assetPath, successCallback, errorCallback)

Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.

Uses lower-level native APIs with small footprint (iOS: AudioToolbox/AudioServices). Fully concurrent and multichannel.

  • params
  • id - string unique ID for the audio file
  • assetPath - the relative path or absolute URL (inluding http://) to the audio asset.
  • successCallback - success callback function
  • errorCallback - error callback function
preloadComplex: function ( id, assetPath, volume, voices, delay, successCallback, errorCallback)

Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.

Volume & Voices

The default volume is 1.0, a lower default can be set by using a numerical value from 0.1 to 1.0.

By default, there is 1 vice, that is: one instance that will be stopped & restarted on play(). If there are multiple voices (number greater than 0), it will cycle through voices to play overlapping audio.

Change the float-based delay parameter to increase the fade-in/fade-out timing.

Playback

  • params
  • id - string unique ID for the audio file
  • assetPath - the relative path to the audio asset within the www directory
  • volume - the volume of the preloaded sound (0.1 to 1.0)
  • voices - the number of multichannel voices available
  • successCallback - success callback function
  • errorCallback - error callback function
play: function (id, successCallback, errorCallback, completeCallback)

Plays an audio asset.

  • params:
  • id - string unique ID for the audio file
  • successCallback - success callback function
  • errorCallback - error callback function
  • completeCallback - error callback function
loop: function (id, successCallback, errorCallback)

Loops an audio asset infinitely - this only works for assets loaded via preloadComplex.

  • params
  • ID - string unique ID for the audio file
  • successCallback - success callback function
  • errorCallback - error callback function
stop: function (id, successCallback, errorCallback)

Stops an audio file. Only works for assets loaded via preloadComplex.

  • params:
  • ID - string unique ID for the audio file
  • successCallback - success callback function
  • errorCallback - error callback function
unload: function (id, successCallback, errorCallback)

Unloads an audio file from memory.

  • params:
  • ID - string unique ID for the audio file
  • successCallback - success callback function
  • errorCallback - error callback function
setVolumeForComplexAsset: function (id, volume, successCallback, errorCallback)

Changes the volume for preloaded complex assets.

  • params:
  • ID - string unique ID for the audio file
  • volume - the volume of the audio asset (0.1 to 1.0)
  • successCallback - success callback function
  • errorCallback - error callback function

Example Code

In this example, the resources reside in a relative path under the Cordova root folder "www/".

if( window.plugins && window.plugins.NativeAudio ) {
	
	// Preload audio resources
	window.plugins.NativeAudio.preloadComplex( 'music', 'audio/music.mp3', 1, 1, 0, function(msg){
	}, function(msg){
		console.log( 'error: ' + msg );
	});
	
	window.plugins.NativeAudio.preloadSimple( 'click', 'audio/click.mp3', function(msg){
	}, function(msg){
		console.log( 'error: ' + msg );
	});


	// Play
	window.plugins.NativeAudio.play( 'click' );
	window.plugins.NativeAudio.loop( 'music' );


	// Stop multichannel clip after 60 seconds
	window.setTimeout( function(){

		window.plugins.NativeAudio.stop( 'music' );
			
		window.plugins.NativeAudio.unload( 'music' );
		window.plugins.NativeAudio.unload( 'click' );

	}, 1000 * 60 );
}

Demo

The Drumpad in the examples directory is a first starting point.

[sudo] npm install plugin-verify -g
plugin-verify cordova-plugin-nativeaudio ios
plugin-verify cordova-plugin-nativeaudio android

Or, type the commands step by step:

cordova create drumpad com.example.nativeaudio drumpad
cd drumpad
cordova platform add ios
cordova plugin add cordova-plugin-nativeaudio
rm -r www/*
cp -r plugins/cordova-plugin-nativeaudio/test/* www
cordova build ios
cordova emulate ios
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].