Gibber.lib.js

Gibber.lib is a standalone JavaScript library that lets you use Gibber commands and syntax inside of any webpage. You can also use it inside of Node.js via the excellent web-audio-api module by Sebastien Piquemal.

Below is a simple example using Gibber.lib in a standard HTML page to start a bass line and drum loop playing.

<html>

<head>
  <script src='build/gibber.lib.js'></script>
</head>

<body></body>

<script>
Gibber.init() // REQUIRED!

Gibber.scale.root.seq( ['c4','eb4'], 2)

a = Mono('bass').note.seq( [0,7], 1/8 )

b = EDrums('xoxo')
b.snare.snappy = 1

c = Mono('easyfx')
  .note.seq( Rndi(0,12), [1/4,1/8,1/2,1,2].rnd( 1/8,4 ) )
</script>

</html>

For client-side use with HTML, Gibber.lib uses browserify to wrap everything into a single HTML file. When minimized, this file is ~166 KB in size.

Using with Node.js

You can install it for node using a node packaged module. If you have node installed it only takes a few lines of code to test out the same Gibber code that’s in the the HTML code above:

npm install web-audio-api
npm install gibber.lib
npm test gibber.lib

To use the libraries, simply place your .js file in the same directory as the node_modules folder containing the web-audio-api and gibber.lib modules. Then start the .js file with the following:

AudioContext = require('web-audio-api').AudioContext
Gibber       = require('gibber.lib')

Gibber.init()

AudioContext and Gibber currently both need to be global objects; I might try to clean this up in the future. Once you have those three lines of code you can start freely gibbering underneath.