-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1533c62
Showing
39 changed files
with
3,712 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin/ | ||
obj/ | ||
demo/bin/ | ||
demo/obj/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"as3mxml.sdk.framework": "c:\\AIR\\AIR_SDK_32_0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "actionscript", | ||
"debug": false | ||
}, | ||
{ | ||
"type": "actionscript", | ||
"debug": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Syrinx - Sound Manager: Changelog | ||
|
||
## v0.1 (2019-04-05) | ||
|
||
- Initial version of the library | ||
- Added WAV format support (PCM 16bit & IEEE 32bit, mono/stereo, 44100 Hz) | ||
- Added full sound management capability (see feature list in README.md) | ||
- Added custom sampling capability | ||
- Added trimming capability | ||
- Added pitch capability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Simplified BSD License | ||
====================== | ||
|
||
Copyright 2019 Aurélien Da Campo (Adolio). All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of | ||
conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
of conditions and the following disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY ADOLIO "AS IS" AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ADOLIO OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those of the | ||
authors and should not be interpreted as representing official policies, either expressed | ||
or implied, of Adolio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
# Syrinx - Sound Manager for Adobe AIR | ||
|
||
by Aurélien Da Campo ([Adolio](https://twitter.com/AurelienDaCampo)) | ||
|
||
## ⭐ Key features | ||
|
||
- MP3 & WAV formats support | ||
- Tracks registration / configuration management | ||
- Intuitive & friendly API | ||
- Seamless sound looping via silence trimming and/or WAV files format | ||
- Pitch capability | ||
|
||
## ▶️ Try it! | ||
|
||
Go to the [demo](./demo/) folder, configure the project & run it or if you get the latest [release](https://github.com/Adolio/AS3-Sound-Manager/releases), the demo binary should by available in the archive. | ||
|
||
## 📄 Full features | ||
|
||
- **Sound Manager** | ||
- Tracks registration management | ||
- Register / unregister track | ||
- Get all registered tracks | ||
- Has registered track? | ||
- **Track configuration** | ||
- Type | ||
- Sampling rate | ||
- Trimming (start / end) | ||
- Automatic trimming detection | ||
- Sound instantiation from registered tracks | ||
- Play sound (returns a *Sound Instance*) | ||
- Starting volume | ||
- Starting position | ||
- Loop & infinite looping | ||
- Starting paused | ||
- Sound format modularity | ||
- Supported formats: | ||
- MP3 | ||
- WAV | ||
- Sound instances management | ||
- Master volume | ||
- Get all sound instances | ||
- Get all sound instances by type | ||
- Stop all sound instances | ||
- Destroy all sound instances | ||
- Events | ||
- Track registered | ||
- Track unregistered | ||
- Sound instance added | ||
- Sound instance removed | ||
- **Sound Instance** | ||
- Controls | ||
- Execution (play / pause / resume / stop) | ||
- Volume | ||
- Position (time & ratio) | ||
- Mute | ||
- Pan | ||
- Pitch | ||
- Status & configuration | ||
- Length | ||
- Total length (incl. loops) | ||
- Volume / Mixed volume | ||
- Is muted? | ||
- Pan | ||
- Pitch | ||
- Loops / remaining loops | ||
- Position (time & ratio) | ||
- Is playing? | ||
- Is started? | ||
- Is paused? | ||
- Is destroyed? | ||
- Events | ||
- Started | ||
- Paused | ||
- Resumed | ||
- Stopped | ||
- Completed | ||
- Destroyed | ||
|
||
## ⌨️ How to use? | ||
|
||
### 📻 Sound Manager | ||
|
||
Main class to register tracks & instantiate sounds. The following example registers two tracks (MP3 & Wav), setups the trimming & sampling options. | ||
Then three sounds are instantiated. | ||
|
||
```actionscript | ||
// Embedded sounds (Note that WAV files requires a mime type) | ||
[Embed(source = "../media/sound/engine.mp3")] public static const EngineSoundMp3:Class; | ||
[Embed(source = "../media/sound/engine.wav", mimeType="application/octet-stream")] public static const EngineSoundWav:Class; | ||
private var _soundManager:SoundManager; | ||
public function SoundManagerExample() | ||
{ | ||
// Create Sound Manager | ||
_soundManager = new SoundManager(); | ||
// Register sounds | ||
var engineSoundMp3Config:TrackConfiguration = _soundManager.registerTrack("Engine 1", new Mp3Track(new EngineSoundMp3())); // Register a MP3 track | ||
var engineSoundWavConfig:TrackConfiguration = _soundManager.registerTrack("Engine 2", new WavTrack(new EngineSoundWav())); // Register a WAV track | ||
// Trimming configuration | ||
engineSoundMp3Config.findTrim(0.01); // Find start & end trim durations to remove silences inherent to mp3 format (with a silent threshold of 0.01) | ||
// Sampling rate configuration | ||
engineSoundWavConfig.sampling = 4096; // This defines how much samples are read per sampling request. The value must be between 2048 (included) and 8192 (included). | ||
// Play sounds | ||
var engine1_once:SoundInstance = _soundManager.play("Engine 1", 1.0); // Play once | ||
var engine1_twice:SoundInstance = _soundManager.play("Engine 1", 1.0, 0, 2); // Play twice | ||
var engine2_infinite:SoundInstance = _soundManager.play("Engine 2", 1.0, 0, -1); // Play infinite | ||
// Control master volume | ||
_soundManager.volume = 0.8; | ||
} | ||
``` | ||
|
||
### 🎵 Sound Instance | ||
|
||
Instance of a sound that can be controlled. The following example shows how to listen to sound events, how to control a sound and how to get various information about it. | ||
|
||
```actionscript | ||
var si:SoundInstance = _soundManager.play("Engine 1", 1.0, 1337, 5); // Play at max volume, starting at 1,337 sec., 6 times (looping 5 times) | ||
//----------------------------------------------------------------------------- | ||
//-- Events | ||
//----------------------------------------------------------------------------- | ||
si.started.add(function (si:SoundInstance):void { trace("Sound started. " + si.type); } ); | ||
si.stopped.add(function (si:SoundInstance):void { trace("Sound stopped. " + si.type); } ); | ||
si.paused.add(function (si:SoundInstance):void { trace("Sound paused. " + si.type); } ); | ||
si.resumed.add(function (si:SoundInstance):void { trace("Sound resumed. " + si.type); } ); | ||
si.completed.add(function (si:SoundInstance):void { trace("Sound completed. " + si.type); } ); | ||
si.destroyed.add(function (si:SoundInstance):void { trace("Sound destroyed. " + si.type); } ); | ||
//----------------------------------------------------------------------------- | ||
//-- Controls | ||
//----------------------------------------------------------------------------- | ||
// Execution controls | ||
si.pause(); | ||
si.resume(); | ||
si.stop(); | ||
si.play(0.5, 0, 1.0); // (Re)play twice (repeat once) | ||
// Position | ||
si.position = 1337; // In milliseconds | ||
si.positionRatio = 0.5; // This includes the loops so here it will play only the second loop! | ||
// Mute | ||
si.isMuted = true; | ||
si.isMuted = false; | ||
// Volume | ||
si.volume = 0; | ||
si.volume = 0.8; | ||
// Pan | ||
si.pan = -0.5; // Half left | ||
// Pitch | ||
si.pitch = 0.8; // 20% slower | ||
si.pitch = 1.2; // 20% faster | ||
si.pitch = 1.0; // Back to default | ||
//----------------------------------------------------------------------------- | ||
//-- Status info | ||
//----------------------------------------------------------------------------- | ||
trace("Type: " + si.type); // Type | ||
trace("Volume: " + si.volume); // Volume | ||
trace("Mixed volume: " + si.mixedVolume); // Equals to _soundManager.volume * volume | ||
trace("Pan: " + si.pan); // Pan | ||
trace("Pitch: " + si.pitch); // Pitch | ||
trace("Sound length: " + si.length); // One loop length in milliseconds (trimmed) | ||
trace("Sound total length: " + si.totalLength); // Total length in milliseconds (including loops & trim durations) | ||
trace("Loops: " + si.loops); // Total loops | ||
trace("Remaining loops: " + si.loopsRemaining); // Remaining loops | ||
trace("Current position: " + si.position); // Current position in milliseconds | ||
trace("Current position (ratio): " + si.positionRatio); // Current position (ratio, between 0..1) | ||
trace("Is started: " + si.isStarted); // Is started? | ||
trace("Is playing: " + si.isPlaying); // Is playing? | ||
trace("Is paused: " + si.isPaused); // Is paused? | ||
trace("Is muted: " + si.isMuted); // Is muted? | ||
trace("Is destroyed: " + si.isDestroyed); // Is destroyed? | ||
``` | ||
|
||
### 💡 Recommendations | ||
|
||
- Wav file format is recommended for seamless looping sound since MP3 format introduces silent parts at the beginning & the end of the track. | ||
- Another option could be to use MP3 & configure trimming durations either manually or by using the `TrackConfiguration.findTrim()` utility method. | ||
- Use higher sampling rate for tracks that require more robustness against frame drop (e.g. during loading). | ||
|
||
## 📦 How to install? | ||
|
||
- Checkout this repository & add `src` folder in your `classpath` or copy paste the content of the `src` folder in your source folder. | ||
|
||
or | ||
|
||
- Use the `.swc` file provided in each release. | ||
|
||
Don't forget to include dependencies (see below). | ||
|
||
## ☝️ Limitations | ||
|
||
- Supported Wav formats: | ||
- PCM 16 bits, 1 channel, 44100 Hz | ||
- PCM 16 bits, 2 channels, 44100 Hz | ||
- IEEE Float 32 bits, 1 channel, 44100 Hz | ||
- IEEE Float 32 bits, 2 channels, 44100 Hz | ||
|
||
## 🔗 Minimum Requirements | ||
|
||
- Adobe AIR 32.0 in order to fix crackling artifacts: https://github.com/Gamua/Adobe-Runtime-Support/issues/46 | ||
|
||
## 🖇 Dependencies (included in `libs` folder) | ||
|
||
- AS3 Signals: https://github.com/robertpenner/as3-signals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"type": "lib", | ||
"compilerOptions": { | ||
"source-path": [ | ||
"src" | ||
], | ||
"external-library-path": [ | ||
"libs" | ||
], | ||
"include-sources": [ | ||
"src" | ||
], | ||
"output": "bin/syrinx.swc" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "swf", | ||
"request": "launch", | ||
"name": "AIR desktop: Build release & launch", | ||
"profile": "extendedDesktop", | ||
"preLaunchTask": "ActionScript: compile release - asconfig.json" | ||
}, | ||
{ | ||
"type": "swf", | ||
"request": "launch", | ||
"name": "AIR desktop: Build debug & launch", | ||
"profile": "extendedDesktop", | ||
"preLaunchTask": "ActionScript: compile debug - asconfig.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"as3mxml.sdk.framework": "c:\\AIR\\AIR_SDK_32_0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "actionscript", | ||
"debug": false | ||
}, | ||
{ | ||
"type": "actionscript", | ||
"debug": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Syrinx - Sound Manager - Demo | ||
|
||
by Aurélien Da Campo ([Adolio](https://twitter.com/AurelienDaCampo)) | ||
|
||
## 📍 Introduction | ||
|
||
The demo shows the main features provided by the *Syrinx Sound Manager* extension for Adobe AIR. | ||
|
||
![](media/images/Syrinx-Sound-Manager-Demo.png) | ||
|
||
This demo relies on [Starling Framework](https://github.com/Gamua/Starling-Framework) & [Feathers UI](https://github.com/BowlerHatLLC/feathers). | ||
|
||
## 🎶 Resources origin | ||
|
||
### Sounds | ||
- [Steinway cinematic phasing intro piano](https://freesound.org/people/XHALE303/sounds/440931/) by [XHALE303](https://freesound.org/people/XHALE303/) - This sound is licensed under the [Attribution Noncommercial License](https://creativecommons.org/licenses/by-nc/3.0/). | ||
|
||
## 🔨 How to build? | ||
|
||
Install [Visual Studio Code](https://code.visualstudio.com/) and [ActionScript & MXML](https://as3mxml.com/#install-extension) and then follow the build procedure provided by the *ActionScript & MXML* extension. |
Oops, something went wrong.