Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <button id="button-play">play</button>
<button id="button-stop">stop</button>





                var buttonPlay = document.querySelector('#button-play');
var buttonStop = document.querySelector('#button-stop');

// bap 
var bap =  window.bap;

// kit = instrument (kit de batterie ou autres)
var kit = bap.kit();

// pour la démo, on ne va pas utiliser de sample, juste une onde avec des réglages
var oscillator = bap.oscillator({
      attack: 0.01,
      release: 0.5,
      length: 0.6

// deux effects
var fx1 = bap.pingpong();
var fx2 = bap.reverb({ time: 2 });

// on ajoute nos sons dans le kit
// C4 = do 4
// E4 = mi 4
kit.slot('Q').layer(oscillator.with({ note: 'C4',shape:'sawtooth' }));
kit.slot('W').layer(oscillator.with({ note: 'E4',shape:'square' }));
kit.slot('E').layer(oscillator.with({ note: 'G4',shape:'triangle' }));

// j'ajoute le fx1 sur ce son
kit.slot('R').layer(oscillator.with({ note: 'C5',shape:'sine',length: 0.1 })).connect(fx1);

// on créé notre boucle (pattern en musique) avec ici un tempo à 60 BPM
var pattern = bap.pattern({tempo: 60});
  ['1.1.01', '1Q',95], // 4 noires
  ['1.2.01', '1W',95], // 
  ['1.3.01', '1E',95], //
  ['1.4.01', '1R',95]

// j'ajoute un autre canal
  ['1.1.49', '1E',95], // 4 contre-temps
  ['1.2.49', '1R',95], // 
  ['1.3.49', '1Q',95], // 
  ['1.4.49', '1W',95]

// j'ajoute une reverb sur le second canal;

// JS du click
  // on lie et lit
  pattern.kit(1, kit).start();  

  //  stop