-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
7bf2560
commit 5d45752
Showing
1 changed file
with
46 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,46 @@ | ||
Make your browser beep | ||
====================== | ||
|
||
Step 1. Include beep.js | ||
----------------------- | ||
|
||
<script type="text/javascript" src="beep.js"></script> | ||
|
||
Step 2. Beep! | ||
------------- | ||
|
||
<script type="text/javascript"> | ||
new Beep(22050).play(1000, 1, [Beep.utils.amplify(8000)]); | ||
</script> | ||
|
||
Step 3. That's all! | ||
------------------- | ||
|
||
Nothing here. | ||
|
||
API | ||
=== | ||
|
||
Read the source for more detail. | ||
|
||
Constructor | ||
----------- | ||
|
||
new Beep(number:samplingrate) -> Beep | ||
|
||
Makes `Beep`s. | ||
|
||
Methods | ||
------- | ||
|
||
#generate(number:samplingrate) -> [number:sample] | ||
|
||
Generates a list of numbers representing samples of the sine wave. | ||
|
||
#encode(number:frequency, number:duration, [function:filters]) -> string:wavencode | ||
|
||
Repeats the sine samples to fulfill a specified duration and encodes them to a WAV format. | ||
|
||
#play(number:frequency, number:duration, [function:filters]) | ||
|
||
Generates and encodes a sine wave and tries to `play` it with the `<audio>` element. |