Arduino Mozzi synth polyphony help

Hello, so my project is slowly heading in the right direction to have a 4 voice synth controlled by ribbon potentiometers. So far i have managed to get a monophonic version going where i control one voice with one potentiometer, but i am struggling on figuring out how to make this work with more than one voice and pot.

any help? thanks

#include <MozziGuts.h>
#include <Oscil.h> // oscillator 
#include <mozzi_midi.h>
#include <tables/sin2048_int8.h>
#include <tables/saw2048_int8.h>
#include <tables/sin1024_int8.h>
#include <tables/triangle2048_int8.h>
#include <tables/cos2048_int8.h>
#include <tables/square_no_alias_2048_int8.h>
#include <AutoMap.h>
#include <Metronome.h>
#include <IntMap.h>

#define CONTROL_RATE 128

const int POT = A0;
int inputVal = 0;

byte Pitch;
long out;
long finalOut;


#define MIDI_NOTE_MIN (Q16n16)(33L << 16L)

void setup() {
 startMozzi(CONTROL_RATE); // :)

void updateControl(){
  // read the piezo
  int piezo_value = mozziAnalogRead(POT); // value is 0-1023

  // print the value to the Serial monitor for debugging
  Serial.print("piezo_value = ");
  Serial.print("\t \t"); // prints 2 tabs

  int frequencya; // calibrate

  if (piezo_value < 5)
    frequencya = 0;
  if (piezo_value > 20)
    frequencya = piezo_value;

  // print the frequency to the Serial monitor for debugging
  Serial.print("frequencya = ");


  Serial.println(); // next line

AudioOutput_t updateAudio(){
  return MonoOutput::from8Bit(;

void loop(){



The usual method of doing this would be to create an array of objects instead of a single one along with arrays of other values or an array of structs holding values associated with each object

I know nothing about the Mozzi library so cannot provide much more help. Do any of the examples with the Mozzi library do anything like you want ?

It looks like the Oscil named 'aSin' is your first voice. Create three more with different names and set their frequency similar to how you use POT to set the frequency of 'aSin'.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.