Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

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


Save Automatically?

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.


                <script src="" type="text/javascript"></script>
<button id="start">start music</button>
<button id="dry">dry</button>
<button id="wet">wet</button>


                button {
    width: 100px;
    height: 30px;
    border: 2px solid #456;

button:hover {
    cursor: pointer;


    This is a demo of the Tuna delay node. See the source at

var inited = false;
var delay;
var source;
var audioContext;
function init() {
    //create an audio context and load an example audio file
    initAudioContext().then(function() {
        //create an instance of Tuna by passing the AudioContext we use
        var tuna = new Tuna(audioContext);
        //create a new Tuna delay instance
        delay = new tuna.Delay({
            delayTime: 95 //a short delayTime to create a slap-back delay
        //connect the source to the Tuna delay
        //connect delay as a standard web audio node to the audio context destination
        //start playing!

        inited = true;  

    This is just the boilerplate needed to load an audio file, create the audio context and provide the dry/wet button functionality

function initAudioContext() {
    return new Promise(function(resolve, reject) {
        var AC = "AudioContext" in window ? AudioContext : "webkitAudioContext" in window ? webkitAudioContext : document.write("Web Audio not supported");
        audioContext = new AC();
        source = audioContext.createBufferSource();
        var format = checkAudioFormat();
        var xhr = new XMLHttpRequest();"GET", "" + format);
        xhr.responseType = "arraybuffer";
        xhr.onload = function(e) {
            audioContext.decodeAudioData(, function(b) {
                source.buffer = b;

    Check file format to use

function checkAudioFormat () {
  var elem = document.createElement('audio');
  if (elem.canPlayType) {
    if (elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
      return "ogg";
    if (elem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
      return "mp3";
  return false;

    Setup dry/wet/start buttons
var start = document.getElementById("start");
var dry = document.getElementById("dry");
var wet = document.getElementById("wet");
dry.disabled = true;
wet.disabled = true;

start.addEventListener("click", function(e) {
    if (!inited) init();
    dry.disabled = false;
    wet.disabled = false;
    start.disabled = true;

dry.addEventListener("click", function(e) {
    if (!inited) init();
    if (delay) delay.bypass = true;

wet.addEventListener("click", function(e) {
    if (!inited) init();
    if (delay) delay.bypass = false;