xxxxxxxxxx
let shape;
let mic;
let mySound;
let amplitude;
function preload() {
shape = loadImage("CALL.png");
sound = loadSound('discord.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
sound.setVolume(1);
sound.loop();
amplitude = new p5.Amplitude();
//mic = new p5.AudioIn();
//mic.start();
}
function draw() {
background(255, 5);
imageMode(CENTER);
translate(width/2, height/2);
let amp = map(amplitude.getLevel(), 0, 1, 10, 3000);
tint(55, 10, 130);
//var r = map(sound.getLevel(), 0, 2, 0, 200*PI);
//var s = map(sound.getLevel(), 0, 1, 0, );
//rotate(r);
image(shape, 0, 0, amp);
}
function mouseDragged()
{
let v = map(mouseY, 0, height, 1, 0);
sound.setVolume(v);
let p = map(mouseX, 0, width, -1, 1);
sound.pan(p);
}
function mousePressed()
{
if (sound.isPlaying() == false)
sound.loop();
}
function mouseReleased()
{
if (sound.isPlaying() == true)
sound.pause();
}