Skip to content

chadselph/beepjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 Beeps.

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.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.5%
  • CoffeeScript 39.5%