Skip to content

Add m4a/aac file type to list of supported audio file types #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can use it as-as, or integrate it into your existing framework.

At its heart it's composed of
just two, short, independent functions: `makeSound` and `soundEffect`. The `makeSound` function helps you
load and play sound files (mp3, wav, ogg, and webm). The `soundEffect`
load and play sound files (mp3, mp4, wav, ogg, and webm). The `soundEffect`
function helps you generate a wide range of sound and music effects
from pure code.
These two functions are completely modular and free of dependencies, so
Expand Down Expand Up @@ -46,7 +46,8 @@ method's array. Then assign a callback function to `sounds.whenLoaded`.
sounds.load([
"sounds/shoot.wav",
"sounds/music.wav",
"sounds/bounce.mp3"
"sounds/bounce.mp3",
"sounds/wapo_march.m4a"
]);

//Assign the callback function that should run
Expand Down Expand Up @@ -84,6 +85,7 @@ they're easier to work with:
var shoot = sounds["sounds/shoot.wav"],
music = sounds["sounds/music.wav"],
bounce = sounds["sounds/bounce.mp3"];
bounce = sounds["sounds/wapo_march.mp4"];
```
You now have three sound objects, `shoot`, `music`, and `bounce` that
you can play and control.
Expand Down
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
</ul>
</p>
<p>
<a href="javascript:sounds['sounds/bounce.mp3'].play();">hyperlink trigger (bounce)<a/>
<a href="javascript:sounds['sounds/bounce.mp3'].play();">Hyperlink trigger #1 (bounce)<a/>
<button id="btn_some_trigger">Button Trigger (bounce + bonus)</button>
<a href="javascript:sounds['sounds/wapo_march.m4a'].play();">Hyperlink trigger #2 (wapo march)<a/>
</p>
<script>

Expand All @@ -42,7 +43,8 @@
sounds.load([
"sounds/shoot.wav",
"sounds/music.wav",
"sounds/bounce.mp3"
"sounds/bounce.mp3",
"sounds/wapo_march.m4a"
]);

//Assign the callback function that should run
Expand Down
8 changes: 5 additions & 3 deletions sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Thank you, Chris!

var exports = {};
if (window['module'] && module.exports) {
exports = module.exports = {};
exports = module.exports = {};
}

/*
Expand Down Expand Up @@ -188,7 +188,8 @@ call a `setup` method when all the files have finished loading:
sounds.load([
"sounds/shoot.wav",
"sounds/music.wav",
"sounds/bounce.mp3"
"sounds/bounce.mp3",
"sounds/wapo_march.m4a"
]);
sounds.whenLoaded = setup;

Expand All @@ -197,6 +198,7 @@ You can now access these loaded sounds in your application code like this:
var shoot = sounds["sounds/shoot.wav"],
music = sounds["sounds/music.wav"],
bounce = sounds["sounds/bounce.mp3"];
march = sounds["sounds/wapo_march.m4a"];

*/

Expand All @@ -206,7 +208,7 @@ var sounds = {
loaded: 0,

//File extensions for different types of sounds.
audioExtensions: ["mp3", "ogg", "wav", "webm"],
audioExtensions: ["mp3", "ogg", "wav", "webm","m4a","aac"],

//The callback function that should run when all assets have loaded.
//Assign this when you load the fonts, like this: `assets.whenLoaded = makeSprites;`.
Expand Down
Binary file added sounds/wapo_march.m4a
Binary file not shown.