cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              <div class="element">
  <h1>I Can't Hear You!</h1>
</div>

<p class="view-collection"><span class="hint">&lt;hint&gt Must run over <a href="https://codepen.io/fleeting/pen/RoGRZg/" target="_blank">https</a>.</span><br />&bull; #codevember &bull; <a href="http://codepen.io/collection/nxZbMW/" target="_blank">View Collection</a> &bull;<br />
  <span>Handcrafted with <span class="love">♥</span> from Austin, TX by <a href="http://twitter.com/fleetingftw">James Fleeting</a></span></p>
            
          
!
            
              @use postcss-simple-vars;
@use postcss-media-minmax;
@use postcss-nested;

$bp: 400px;

h1 {
  color: #fff;
  text-align: center;
  font-size: 8px;
  transition: all 0.4s;
}

.element {
  flex: 0 0 auto;
  width: 280px;
  height: 350px;
  
  @media screen and (height <= $bp) {
    margin: 25px auto;
  }
}

html, body {
  height: 100%;
  
  @media screen and (height <= $bp) {
    height: auto;
  }
}

body {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, #343436 0%,#1d1f20 100%);
  
  @media screen and (height <= $bp) {
    display: block;
  }
}

.view-collection {
  flex: 0 0 auto;
  margin: 10px 0 0;
  color: #fff;
  text-align: center;
  font-size: 15px;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  
  @media screen and (height <= $bp) {
    margin: 25px auto;
  }
  
  span {
    font-size: 13px;
  }
  
  .hint {
    font-size: 11px;
    color: #d2d2d2;
  }
  
  .love {
    color: #cc0000;
  }
  
  a {
    color: #c90087;
    text-decoration: none;
    transition: all 0.7s;
    
    &:hover, &:focus {
      color: #fff;
    }
  }
}

            
          
!
            
              // set up audio context
var audioContext = (window.AudioContext || window.webkitAudioContext);
// create audio class
if (audioContext) {
  // Web Audio API is available.
  var audioAPI = new audioContext();
} else {
  // Web Audio API is not available. Ask the user to use a supported browser.
  alert("It appears your browser does not support the Web Audio API, please upgrade or use a different browser");
}

var analyserNode,
    frequencyData = new Uint8Array(64);    

// create an audio API analyser node and connect to source
function createAnalyserNode(audioSource) {
  analyserNode = audioAPI.createAnalyser();
  analyserNode.fftSize = 128;
  audioSource.connect(analyserNode);
}

// constantly picking up mic data
function animate() {
  requestAnimationFrame(animate);
  analyserNode.getByteFrequencyData(frequencyData);
  analyse();
}

// getUserMedia success callback -> pipe audio stream into audio API
var gotStream = function(stream) {
  // Create an audio input from the stream.
  var audioSource = audioAPI.createMediaStreamSource(stream);
  createAnalyserNode(audioSource);
  animate();
}

// pipe in analysing to getUserMedia
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
  .then(gotStream);

function analyse() {
  // console.log('frequencyData', frequencyData[0]);
  
  const text = document.querySelector('h1');
  if(frequencyData[15] <= 95) {
    text.style.fontSize = '8px';
    text.style.opacity = '0.2';
  } else if(frequencyData[15] <= 175 && frequencyData[15] >= 95) {
    text.style.fontSize = '30px';
    text.style.opacity = '0.6';
  } else if(frequencyData[15] >= 176) {
    text.style.fontSize = '65px';
    text.style.opacity = '1';
  }
}
            
          
!
999px
Close

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.

Go PRO

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

Console