cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              button {
  display: block;
  margin: auto;
  height:  200px;
  width: 200px;
  border-radius: 50%;
  border-width: 0;
  font-size: 80px;
  line-height: 100px;
  text-align: center;
  background: #cceeff;
  box-shadow: 4px 4px 4px rgba(0, 0, 100, 0.3)
              var C4 = 263;
var B3 = 247;
var A3 = 220;
var G3 = 196;
var REST = 0;
  {frequency: C4, duration: 1/4},
  {frequency: G3, duration: 1/8},
  {frequency: G3, duration: 1/8},
  {frequency: A3, duration: 1/4},
  {frequency: G3, duration: 1/4},
  {frequency: REST, duration: 1/4},
  {frequency: B3, duration: 1/4},
  {frequency: C4, duration: 1/4},

var audioContext = window.AudioContext || window.webkitAudioContext;
var ctx = new audioContext();

var playNotes = function(notes) {
  var wholeNoteSeconds = 2;
  var startTime = ctx.currentTime;
  var time = ctx.currentTime;
  var osc = ctx.createOscillator();
  osc.type = 'sawtooth';
  var gainOsc = ctx.createGain();
  notes.forEach(function(note) {
    var noteSeconds = wholeNoteSeconds * note.duration;
    osc.frequency.setValueAtTime(note.frequency, time);
    gainOsc.gain.setValueAtTime(1, time);
    gainOsc.gain.exponentialRampToValueAtTime(0.01, time + note.duration);
    time += noteSeconds;

document.querySelector('#playsong').addEventListener('click', function() {


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................