I would like to save the generated symbols so that it creates a picture. I used teachable machine sound to classify the certain symbols as sound. Also it generates almost 140 symbols for example triangles or circles per voice input - how can I reduce it, so that it only creates one or two per voice input?
let label = "Male dein eigenes Bild indem du Dreieck, Linie, Kreis oder Quadrat sagst.";
let classifier;
let modelURL = 'https://teachablemachine.withgoogle.com/models/3ThLR_ntF';
// STEP 1: Load the model!
function preload() {
classifier = ml5.soundClassifier('https://teachablemachine.withgoogle.com/models/3ThLR_ntF/model.json');
}
function setup() {
createCanvas(640, 520);
classifyAudio();
}
// STEP 2 classify the videeo!
function classifyAudio() {
classifier.classify(gotResults);
}
function draw() {
background(255, 204, 0);
// STEP 4: Draw the label
textSize(18);
textAlign(CENTER, CENTER);
fill(0);
text(label, width-320, height-35);
//Setting Symbols
if (label == "Dreieck") {
triangle(random(640),random(520), random(640),random(520),random(640),random(520));
}
else if (label == "Linie") {
line(random(640), random(520), random(640), random(520));
}
else if (label == 'Kreis'){
circle(random(640), random(520), random(300));
}
else if (label=='Quadrat'){
quad(x1=random(640), y1=random(520),x2=(x1+random(50,200)),y2=(y1),x3=(x2),y3=(y2+random(50,200)),x4=(x1), y4=(y3))
}
// Draw the symbols
textSize(256);
}
// STEP 3: Get the classification!
function gotResults(error, results) {
// Something went wrong!
if (error) {
console.error(error);
return;
}
// Store the label and classify again!
label = results[0].label;
}
In draw the symbols I thought I could save the symbols but its not working also not with print. How can I save the symbols on the canva so that it looks like a piture created with the symbols. And how can I reduce the generated symbols? Please help thank you!