Bleep.js Examples

Works best in Chrome.

Try the library yourself with the built in console by pressing 'cmd + shift + j' or 'ctrl + shift + j'

Bleep.bloop();
Bleep.start();

Run code



Bleep.setWaveform("sawtooth"); // indicate sine, sqaure, sawtooth, or triangle
Bleep.bloop();
Bleep.setWaveform("sine");     // reset the waveform for future use 
Bleep.start();

Run code



var params = {
  rootNote: "C",
  scaleType: "blues",     // options: "minor" (default), "major", "pentatonic", "blues"
  notes: 32,          // default: 8
  noteLength: 8,        // default: 32
  bpm: 90,          // default: 120
  octave: 3,          // default: 4
  octaveRange: 2     // default: 1
}

Bleep.bloop(params);
Bleep.start();

Run code


var params = {
  direction: "down",  // default: "up"
}

Bleep.arp(params); 
Bleep.start();

Run code


Bleep.tone("C4");       // default note_length: 16th note
Bleep.tone("A#5",16);   // Bleep.tone(note, note_length);
Bleep.tone("F", 2, 4);  // Bleep.tone(note, note_length, octave);

Run code


// Formatted to one quarter measure per line
var mySequence = [
  "A4", "A5", "A4", "A5", // Four 16th notes
  "R4",                   // rest for a quarter measure
  "R8",       ["C4", 8],  // 8th rest and an eighth note
  ["E4", 4]               // One quarter note
]
Bleep.sequence(mySequence);
Bleep.start();

Run code


// A more familiar tune
var lambSeq = [
  "E", "D", "C", "D",
  "E", "E", "E", "R16",
  "D", "D", "D", "R16",
  "E", "G", "G"
  ]
Bleep.sequence(lambSeq);
Bleep.start();

Run code


// An essential 90s jam
Bleep.setbpm(140);
var seq = [
  "Bb", "R8", "D", "F","R16","Bb", "R16",
  "F3","R8", "Bb", "C", "R6",
  "F3", "R8", "Bb", "C", "R16", "A", "R16", ["Bb",4],
  "R4"
]
Bleep.sequence(seq);
Bleep.sequence(seq); // enqueue again to play it twice
Bleep.start();

Run code


Bleep.roll();
Bleep.start();

Run code