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.


  <h1>Audio player with tempo adjustment</h1>
  <p>Maintains pitch while slowing an MP3 down.<br>For beginner guitarists, like myself, to practice chord progressions at a managable pace.</p>
  <div class=group>
    <h2>Audio source (.mp3)</h2>

    <div class=url>
      <label class=url_label for=url_input><span>Address</span></label>
      <input id=url_input class=url_input type=url value="">


    <div class=upload>
      <label class=upload_label for=upload_input><span>Upload</span></label>
      <input id=upload_input class=upload_input type=file accept="audio/*">

  <div class=group>
    <div class=player>
      <h3 class=player_display></h3>
      <audio class=player_audio controls>
        <track id=player-chords kind=captions srclang=en>

    <div class=tempo>
      <label class=tempo_label for=tempo_input>Tempo</label>
      <input class=tempo_input id=tempo_input type=range value=0.825 min=0.5 max=1 step=0.025>
      <span class=tempo_display></span>

<footer class=myStuff><style>.myStuff{z-index:10;font-weight:100;color:#777;font-size:16px;position:fixed;width:100vw;left:0;bottom:0;margin:0;background-color:hsla(269,19%,20%,.9);padding:.125em;line-height:1.5;text-align:center}.myStuff_lnk,.myStuff_lnk:visited{text-decoration-skip: ink;color:hsla(211,100%,72%,1);text-decoration-color:hsla(211,100%,72%,.5);transition:all .3s ease-out;white-space:nowrap}.myStuff_lnk:focus,.myStuff_lnk:hover{color:#fff;text-decoration-color:currentcolor}</style><a class=myStuff_lnk target=linkedin title="[LinkedIn - new window]" href="">Mike Foskett</a> &nbsp; <a class=myStuff_lnk target=popularpens title="[new window]" href="">Popular pens</a> &nbsp; <a class=myStuff_lnk target=latestpens title="[new window]" href="">Latest pens</a> &nbsp; <a class=myStuff_lnk target=webSemantics title="[new window]" href="">webSemantics</a></footer>


                body {
  --spacing: .75rem;
  font-family: sans-serif;
  line-height: 1.5;
  text-align: center;
  margin: .75rem;
  padding-bottom: 2rem;
  color: hsl(269,19%,30%);
  background-color: hsla(32,100%,85%,.35);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='100%25' xmlns=''%3E%3Cdefs%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.4'/%3E%3C/filter%3E%3C/defs%3E%3C!-- %3Cpath filter='url(%23a)' opacity='.3' d='M0 0h1200v256H0z'/%3E--%3E%3Crect filter='url(%23a)' opacity='.3' width='100%25' height='100%25'/%3E%3C/svg%3E");
@media (min-width: 48em) {
  body {--spacing: 1rem;}
body * {box-sizing: border-box;}
h1, h2, h3 {font-weight:100;}
h1 {margin: 1em 0 .5em;}
.group {
  border: 1px solid #fff;
  background-color: rgba(255,255,255,.25);
  padding: .5rem 1rem;
  margin: 1rem auto;

.url {
  display: flex;
  width: 100%;
  margin: 1rem auto;
[class*="_label"] {
  position: relative;
  white-space: nowrap;
  margin-right: .5em;
  min-width: 4em;
[class*="_label"] > span {
  display: block;
  position: relative;
  top: 50%;
  transform: translatey(-50%);
[class*="_input"] {
  display: inline-block;
  line-height: 1;
  width: 100%;
  margin: 0;
  padding: .25rem .5rem;
  font: inherit;
  border: 1px solid #fff;
  background-color: rgba(255,255,255,.5);

.upload {
  display: flex;
  width: 100%;
  margin: 1rem auto;

.player_audio {
  width: 100%;
.player_display {
  font-size: 1.25rem;
.tempo {
  display: flex;
  width: 100%;
  margin: 1rem auto;
.tempo_display {
  font-weight: 700;
  min-width: 3em;
  margin-left: .5em;


const player = document.querySelector('.player_audio');
const playerDisplay = document.querySelector('.player_display');

const changeTempo = function () {
  player.playbackRate = tempoInput.value;
  tempoDisplay.textContent = tempoInput.value;

const changeSongURL = function (e) {
  player.src = urlInput.value;
  let filename = player.src.split('\\').pop().split('/').pop();
  playerDisplay.textContent = filename;

const changeSongFile = function (e) {
  const target = e.currentTarget;
  const file = target.files[0];
  let reader;

  if (target.files && file) {
    reader = new FileReader();
    reader.onload = function (e) {
      playerDisplay.textContent =;
      //; // auto play on load

// Get the song from:
const urlInput = document.getElementById('url_input');
urlInput.addEventListener("change", changeSongURL, false);

// Or upload an MP3:
const uploadInput = document.getElementById('upload_input');
uploadInput.addEventListener('change', changeSongFile, false);

// Playback tempo 
const tempoInput = document.getElementById('tempo_input');
tempoInput.addEventListener("change", changeTempo, false);
const tempoDisplay = document.querySelector('.tempo_display');
tempoDisplay.textContent = tempoInput.value;

// Chords from:
const vtt = document.getElementById('url_input').value.replace('.mp3', '.vtt');
const player_chords = document.getElementById('player-chords');

player_chords.src = vtt;
// player.src = urlInput.value;