Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no">

<div id="container">
  <h2>Play with three fingers on a touch screen</h2>
  <div id="touchArea"></div>
</div>		 		 

<xml id="WebAudioXML">
  <Audio version="1.0" timeUnit="ms" interactionArea="#touchArea">


    <Chain gain="-5dB">
      <OscillatorNode type="square">
        <frequency follow="touch[0].relX" map="0, 100, 48, 84, MIDI" steps="0 2 4 7 9 12"></frequency>
        <detune follow="touch[0].force" map="0, 1, 0, -20"></detune>
      </OscillatorNode>
      <BiquadFilterNode type="lowpass">
        <frequency follow="touch[0].relY" map="0, 100, 1500, 50"></frequency>
      </BiquadFilterNode>
      <GainNode>
        <gain>
          <envelope adsr="100, 200, 40, 50" trig="touch[0]"></envelope>
        </gain>
      </GainNode>
      <Send output=".delay1"></Send>
      <StereoPannerNode pan="-0.5"></StereoPannerNode>
    </Chain>


    <Chain gain="-5dB">
      <OscillatorNode type="sawtooth">
        <frequency follow="touch[1].relX" map="0, 100, 48, 84, MIDI" steps="0 2 4 7 9 12"></frequency>
        <detune follow="touch[1].force" map="0, 1, 0, -20"></detune>
      </OscillatorNode>
      <BiquadFilterNode type="lowpass">
        <frequency follow="touch[1].relY" map="0, 100, 1500, 50, 1"></frequency>
      </BiquadFilterNode>
      <GainNode>
        <gain>
          <Envelope adsr="100, 200, 40, 50" trig="touch[1]"></Envelope>
        </gain>
      </GainNode>
      <Send output=".delay2"></Send>
      <StereoPannerNode pan="0"></StereoPannerNode>
    </Chain>




    <Chain gain="-5dB">
      <OscillatorNode type="triangle">
        <frequency follow="touch[2].relX" map="0, 100, 48, 84, MIDI" steps="0 2 4 7 9 12"></frequency>
        <detune follow="touch[2].force" map="0, 1, 0, -20"></detune>
      </OscillatorNode>
      <BiquadFilterNode type="lowpass">
        <frequency follow="touch[2].relY" map="0, 100, 1500, 50, 1"></frequency>
      </BiquadFilterNode>
      <GainNode>
        <gain>
          <envelope adsr="100, 200, 40, 50" trig="touch[2]"></envelope>
        </gain>
      </GainNode>
      <Send output=".delay3"></Send>
      <StereoPannerNode pan="0.5"></StereoPannerNode>
    </Chain>


    <Chain class="delay1">
      <DelayNode delayTime="200"></DelayNode>
      <BiquadFilterNode frequency="400"></BiquadFilterNode>
      <GainNode gain="-6dB"></GainNode>
      <Send output=".delay3"></Send>
      <StereoPannerNode pan="-0.8"></StereoPannerNode>
    </Chain>

    <Chain class="delay2">
      <DelayNode delayTime="400"></DelayNode>
      <BiquadFilterNode frequency="300"></BiquadFilterNode>
      <GainNode gain="-6dB"></GainNode>
      <Send output=".delay1"></Send>
      <StereoPannerNode pan="0"></StereoPannerNode>
    </Chain>

    <Chain class="delay3">
      <DelayNode delayTime="600"></DelayNode>
      <BiquadFilterNode frequency="200"></BiquadFilterNode>
      <GainNode gain="-6dB"></GainNode>
      <Send output=".delay2"></Send>
      <StereoPannerNode pan="0.8"></StereoPannerNode>
    </Chain>


  </Audio>
</xml>


		<script src="https://momdev.se/interactivemusic/WebAudioXML/WebAudioXML.js" data-source="#WebAudioXML"></script>


<!--script src="https://hans.arapoviclindetorp.se/projects/web-audio-xml/WebAudioXML.js" data-source="#WebAudioXML"></script-->
              
            
!

CSS

              
                html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
* {
  -webkit-touch-callout: none; /* iOS Safari */
  -webk	it-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */
}

div {
  margin: 1em;
}

#touchArea {
  border: 1px solid black;
  flex: 1 1 auto;
  margin-bottom: 2em;
  background-image: linear-gradient(90deg, #B2A2CD 25%, #5F5370 25%, #5F5370 50%, #B2A2CD 50%, #B2A2CD 75%, #5F5370 75%, #5F5370 100%);
  background-size: 260.00px 80.00px;
  touch-action: none;
}

#container {
  display: flex;
  flex-flow: column;
  height: 100%;
}

              
            
!

JS

              
                
              
            
!
999px

Console