let icons = ["?", "?", "?", "?", "?", "?"];
let osc_types = ['sine', 'triangle', 'sawtooth', 'square']
colorMode(HSB, 360, 100, 100, 100);
video = createCapture(VIDEO, function() {
for (let i = 0; i < 6; i++) {
let osc = new p5.Oscillator(osc_types[i % osc_types.length]);
ctracker = new clm.tracker();
ctracker.start(video.elt);
emotions = new emotionClassifier();
emotions.init(emotionModel);
emotionData = emotions.getBlank();
rect(0, 0, width, height);
positions = ctracker.getCurrentPosition();
var cp = ctracker.getCurrentParameters();
predictedEmotions = emotions.meanPredict(cp);
if (isPlaying && predictedEmotions) {
for (let i = 0; i < oscs.length; i++) {
freq = constrain(map(predictedEmotions[i].value, 0, 1, 0, 1000), 100, 500);
amp = constrain(map(predictedEmotions[i].value / 8, 0, 1, 0, 0.5), 0, 0.5);
cellW = (width - offset * 2 - margin * (predictedEmotions.length - 1)) / predictedEmotions.length;
for (var i = 0; i < predictedEmotions.length; i++) {
let x = map(i, 0, predictedEmotions.length - 1, offset, width - offset - cellW);
let y = height - margin * 3;
let h = map(i, 0, predictedEmotions.length, 0, 360);
let s = sq(predictedEmotions[i].value) * 100;
rect(x, y, cellW, -predictedEmotions[i].value * cellH);
textAlign(CENTER, CENTER);
let label = Object.values(predictedEmotions[i])[0];
text(label.toUpperCase(), x + cellW / 2, y + margin);
if (predictedEmotions[i].value > 0.5) {
text(icons[i], x + cellW / 2, y - predictedEmotions[i].value * cellH - 25);
for (var i = 0; i < positions.length - 3; i++) {
ellipse(positions[i][0], positions[i][1], 5, 5);
function mousePressed() {