This repository has been archived by the owner on Jun 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from skratchdot/skratchdot_extras
adding 2 new extras: mp3_decode and soundfont
- Loading branch information
Showing
20 changed files
with
18,357 additions
and
2 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
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
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,49 @@ | ||
mp3_decode | ||
========== | ||
Decode mp3s in the browser using jsmad | ||
|
||
## Installation | ||
|
||
Download 2 extra javascript files: | ||
|
||
- [jsmad.js](/timbre.js/src/extras/jsmad.js) | ||
- [mp3_decode.js](/timbre.js/src/extras/mp3_decode.js) | ||
|
||
|
||
```html | ||
<script src="timbre.js"></script> | ||
<script src="jsmad.js"></script> | ||
<script src="mp3_decode.js"></script> | ||
``` | ||
|
||
|
||
## Description ## | ||
|
||
(canvas canvas w:240 h:80) | ||
|
||
You can now play mp3s in the browser the same way you would play a .wav file | ||
|
||
```timbre | ||
var src = window.getDraggedFile() || "/timbre.js/misc/audio/note.mp3"; | ||
T("audio").loadthis(src, function () { | ||
this.plot({target:canvas}).play(); | ||
}).on("ended", function () { | ||
this.pause(); | ||
}); | ||
``` | ||
|
||
|
||
## See Also ## | ||
|
||
- [jsmad Source Code](https://github.com/audiocogs/jsmad/) | ||
|
||
|
||
## Source ## | ||
|
||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/jsmad.js | ||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/mp3_decode.js | ||
|
||
|
||
<script src="/timbre.js/src/extras/min/jsmad.min.js"></script> | ||
<script src="/timbre.js/src/extras/min/mp3_decode.min.js"></script> |
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,77 @@ | ||
soundfont | ||
========= | ||
Play soundfonts from a "soundfont url" such as [free-midi](https://code.google.com/p/free-midi/) | ||
|
||
|
||
## Installation | ||
|
||
Download 4 extra javascript files: | ||
|
||
- [audio-jsonp.js](/timbre.js/src/extras/audio-jsonp.js) | ||
- [jsmad.js](/timbre.js/src/extras/jsmad.js) | ||
- [mp3_decode.js](/timbre.js/src/extras/mp3_decode.js) | ||
- [soundfont.js](/timbre.js/src/extras/soundfont.js) | ||
|
||
|
||
```html | ||
<script src="timbre.js"></script> | ||
<script src="audio-jsonp.js"></script> | ||
<script src="jsmad.js"></script> | ||
<script src="mp3_decode.js"></script> | ||
<script src="soundfont.js"></script> | ||
``` | ||
|
||
|
||
## Description ## | ||
|
||
T.soundfont is a singleton object that caches various soundfont notes, and | ||
allows you to play them. | ||
|
||
```timbre | ||
// play note 64 using the current instrument | ||
// NOTE: this will change whenever someone calls T.soundfont.setInstrument(); | ||
T.soundfont.play(64); | ||
``` | ||
|
||
```timbre | ||
// set instrument to a "cello", and play note 64 | ||
T.soundfont.setInstrument(42); | ||
T.soundfont.play(64); | ||
``` | ||
|
||
```timbre | ||
// only play if this note has already been cached | ||
T.soundfont.play(70, false); | ||
``` | ||
|
||
## Methods ## | ||
|
||
- `T.soundfont.emptyCache();` | ||
- `T.soundfont.setUrlTemplate(newUrlTemplate);` | ||
- `T.soundfont.setName(newName);` | ||
- `T.soundfont.setChannel(newChannel);` | ||
- `T.soundfont.setInstrument(newInstrument);` | ||
- `T.soundfont.setLength(newLength);` | ||
- `T.soundfont.setJsonp(newJsonp);` | ||
- `T.soundfont.preload(noteArray);` | ||
- `T.soundfont.play(note, playOnLoad, options);` | ||
|
||
|
||
## See Also ## | ||
|
||
- [free-midi](https://code.google.com/p/free-midi/) | ||
|
||
|
||
## Source ## | ||
|
||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/audio-jsonp.js | ||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/jsmad.js | ||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/mp3_decode.js | ||
https://github.com/mohayonao/timbre.js/blob/master/src/extras/soundfont.js | ||
|
||
|
||
<script src="/timbre.js/src/extras/audio-jsonp.js"></script> | ||
<script src="/timbre.js/src/extras/jsmad.js"></script> | ||
<script src="/timbre.js/src/extras/mp3_decode.js"></script> | ||
<script src="/timbre.js/src/extras/soundfont.js"></script> | ||
|
Binary file not shown.
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
Oops, something went wrong.