Created
March 20, 2016 02:33
-
-
Save naoyashiga/074e11c3103f321dfcfb to your computer and use it in GitHub Desktop.
p5.js sound test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
</style> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.22/p5.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.23/addons/p5.sound.min.js"></script> | |
<script src="sketch.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sketch = function($p) { | |
var mySound; | |
$p.preload = function() { | |
mySound = $p.loadSound('symphony.mp3'); | |
}; | |
$p.setup = function() { | |
$p.createCanvas(window.innerWidth, window.innerHeight); | |
mySound.setVolume(0.1); | |
mySound.play(); | |
}; | |
$p.draw = function() { | |
$p.background(0); | |
$p.fill(255); | |
}; | |
}; | |
var myp5 = new p5(sketch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
folder directory