xxxxxxxxxx
51
//https://editor.p5js.org/p5/sketches/Sound:_Manipulate_Sound
let ig;
let pg;
let aa;
let matypo;
let song;
function preload() {
matypo = loadFont('pressuru.otf');
song = loadSound('son.ogg');
}
function setup() {
createCanvas (window.innerWidth, window.innerHeight);
song.loop();
pg = createGraphics(400,800);
pg.background('white');
pg.fill('#000000');
pg.textFont(matypo);
pg.textSize(170);
pg.textAlign(CENTER,CENTER);
pg.text('BASS',pg.width/2,pg.height/2);
}
function draw() {
background(255);
let off = 20
let mover = map(constrain(mouseX,off,width-off),off,width-off,0,width);
let movery = map(constrain(mouseY,off,height-off),off,height-off,0,height);
image(pg,0,0,mouseX,mouseY);
let volume = map(mouseX, 0, width, 0, 1);
volume = constrain(volume, 0, 1);
song.amp(volume);
}