xxxxxxxxxx
let sound;
let peaks;
let index = 0;
let last_time = 0;
let amplitude;
let table;
let pixel = 0;
let peak = 0;
function preload() {
vid = createVideo("220427_video.mp4")
vid.size(2000, 720)
vid.loop();
vid.hide();
}
function setup() {
cnv = createCanvas(windowWidth, windowHeight);
background(100);
vid.loadPixels();
print(vid.duration());
table = new p5.Table();
table.addColumn('color');
}
function draw() {
background(255);
image(vid, 0, 0);
if (millis() - last_time > 1000) {
pixel = vid.get(vid.width / 2, vid.height / 2);
let newRow = table.addRow();
newRow.setString('color', pixel);
last_time = millis();
peak = 0;
}
}
function keyPressed() {
if (key == "c") {
saveTable(table, 'color.csv');
}
}