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.


    <script src=""> </script>
    <link href='' rel='stylesheet'>

    <div class='content' id='wait'>Put on headphones. We'll wait.</div>
    <div class='content' id='start' onclick="start()">CLICK TO TRIO ENDLESSLY.</div>
    <div class='content' id='playing'>
      <marquee scrollamount=15>ENDLESS TRIOS</marquee>
      <marquee scrollamount=15 direction=right >ENDLESS TRIOS</marquee>
      <div class='button' id='next' onclick="sampleAndPlayForever()">Next Trios</div> 
      <marquee behavior=alternate id='count' direction=right>0 TRIOS</marquee>
      <div class='button' onclick="stop()">END TRIOS</div>
      <marquee scrollamount=15>ENDLESS TRIOS</marquee>
      <marquee scrollamount=15 direction=right>ENDLESS TRIOS</marquee>
      <div class='button' onclick="changeTempo(1)">Faster Trios</div>
      <marquee behavior=alternate id='tempo'>bpm</marquee>
      <div class='button' onclick="changeTempo(-1)">Slower Trios</div>
      <marquee scrollamount=15>ENDLESS TRIOS</marquee>
      <marquee scrollamount=15 direction=right>ENDLESS TRIOS</marquee>
  <footer class='footer'>
    Plays back real-time generated 3-part (melody, bass, drums) from a miniaturized <a href="" target="_blank">MusicVAE</a> model. Listen to samples from the full model on <a href="" target="_blank">YouTube</a> or sample your own in <a href="" target="_blank">Colab</a>.



                body {
.content {
  min-height: 100vh;
  font-family: 'Codystar';
  font-size: 28px;
.footer {
  font-family: 'Poppins', Arial, sans-serif;
  font-size: 15px;
  height: 25px;

#start, marquee.button, div.button {
  cursor: pointer;

#start:hover, div.button:hover, marquee.button:hover {
    color: magenta

div.button {
  text-align: center;

marquee, div.button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;


                // Instantiate the model by specifying the desired checkpoint.
const model = new mm.MusicVAE(

const player = new mm.Player();

let stopSignal = false;
let count = 0;
let tempo = 80;

const sampleAndPlayForever = () => {
  count += 1;
  document.getElementById('count').innerHTML = `${count} trios`;
  return model.sample(1)
    .then((samples) => player.start(samples[0], tempo))
    .then(stopSignal ? undefined : sampleAndPlayForever)

const changeTempo = (delta) => {
  tempo = Math.max(Math.min(tempo + delta * 10, 120), 40);
  const tempoCounter = document.getElementById('tempo');
  tempoCounter.setAttribute('scrollamount', tempo / 10);
  tempoCounter.innerHTML = `${tempo} bpm`;

const start = () =>  {
  mm.Player.tone.context.resume();  // Required on mobile.
  document.getElementById('start').style.display = "none";
  stopSignal = false;

const stop = () => {
  stopSignal = true;
  document.getElementById('wait').style.display = "none";
  document.getElementById('start').style.display = "block";