Mozzi  version v2.0
sound synthesis library for Arduino
Mozzi on MBED-based boards (Arduino Giga / Portenta).

port by Thomas Friedrichsmeier & Thomas Combriat

Port status and notes

Compiles and runs using Arduino's standard and Arduino_AdvancedAnalog libraries. This port is still experimental, testing reveals some instabilities for some configurations (in particular with MOZZI_AUDIO_INPUT) that are under active investigations.

This port is not complete yet, in particular:

  • Asynchroneous analog reads are not implemented (yet), mozziAnalogRead() relays to analogRead(). (Note that MOZZI_AUDIO_INPUT is implemented!)
  • This port should support other MBED based Arduino boards like the Arduino Portenta, in theory, but the developer have only tested it on the Giga. Feedback welcome!

Output modes

The following audio modes (see MOZZI_AUDIO_MODE) are currently supported on this hardware:

  • MOZZI_OUTPUT_EXTERNAL_TIMED
  • MOZZI_OUTPUT_EXTERNAL_CUSTOM
  • MOZZI_OUTPUT_PDM_VIA_SERIAL
  • MOZZI_OUTPUT_INTERNAL_DAC

The default mode is MOZZI_OUTPUT_INTERNAL_DAC .

MOZZI_OUTPUT_INTERNAL_DAC

This uses the inbuild DAC on the board. The default is setting is appropriate for the Arduino Giga: 12 bits going to A13 (3.5mm jack connector's tip), and in stereo mode to pin A12 (3.5mm jack connector's first ring) additionally.

For other boards is may be appropriate to customize:

#define MOZZI_AUDIO_PIN_1 ... // mono / left channel; default: A13
#define MOZZI_AUDIO_PIN_2 ... // stereo only: right channel; default: A12
#define MOZZI_AUDIO_BITS ... // default is 12

MOZZI_PDM_VIA_SERIAL

Returns a pulse-density modulated (mono only) signal on one of the hardware UARTs of the board (Serial ports). Default is using the SERIAL2, on pin D18. You can confiugre the pins to use, but it must be connected to a hardware UART. Output is written to the TX pin, only, but the RX pin needs to be claimed as well. Beware of confusing pinout labelling, for instance SERIAL2_TX iss labelled "TX1" on the Arduino Giga. The audio resolution can be enhanced using MOZZI_PDM_RESOLUTION, which is described in more detail here: @esp32_pdm_via_i2s .

Configuration options:

#define MOZZI_SERIAL_PIN_TX ... // default: SERIAL2_TX
#define MOZZI_SERIAL_PIN_RX ... // *must* specify the matching one, if customizing the above; default: SERIAL2_RX
#define MOZZI_PDM_RESOLUTION ... // default value is 2, for 2*32 ones and zeros per audio sample

MOZZI_OUTPUT_EXTERNAL_TIMED and MOZZI_OUTPUT_EXTERNAL_CUSTOM

See External audio output