Mozzi sound synthesis library for Arduino - how to make it work on the Core2
-
Hi!
Has anyone got the Mozzi library to work on the M5Stack Core2? It now has support for ESP32.
I can compile Mozzi examples but don't know how to get audio output through the internal speaker.
Mozzi: link
Any help welcome!
-
OK, so I think I have figured out how to make Mozzi sound through the internal speaker.
In AudioConfigESP32.h change these lines to:
// Set output mode
#define ESP32_AUDIO_OUT_MODE PT8211_DAC// For external I2S output, only: I2S_PINS
#define ESP32_I2S_BCK_PIN 12
#define ESP32_I2S_WS_PIN 0
#define ESP32_I2S_DATA_PIN 2(Ref: https://github.com/m5stack/M5-ProductExampleCodes/blob/master/Core/M5Core2/Arduino/record/record.ino)
It seems to work, even though the Core2 uses the NS4168 I2S amp.In your code, put this at the top:
#include <M5Core2.h>
obviously, and in the setup():
M5.begin();
M5.Axp.SetSpkEnable(true);Put
M5.update()
in the updateControl() function.
Also, in the Arduino IDE, set PSRAM: Disable.
-
So now I've got a drum machine with 6 drum sounds (VA - not samples), and a bass synth up and running.
I have created a simple editor for the drum sounds -- on to make the synth note editor and the synth sound editor (it has selectable waveforms, a LPF and an ADSR envelope, plus a 2nd detunable oscillator).

-
And here are the synth sound editor and the piano roll where you enter/edit the notes for the synth.

-
Here is the main menu. The engine is running three editable synths and a 5 voice drum machine (kick, snare, hihat open/closed, tom hi/lo, clap/crash).

-
Drum sound editor

and drum editor!

-
Song mode (arranging sequences in programmed order)

and a primitive though useful mixer for the three synths and all the drum sounds!

-
Last thing on the list is data save/load (maybe even MIDI export), sequence copy function, demo, manual. Then I will release the project under a GPL license.
-
@oscillator looking forward to try it 👍
-
@agreedk said in Mozzi sound synthesis library for Arduino - how to make it work on the Core2:
@oscillator looking forward to try it 👍
Thanks a lot @AgreeDK, just a few more days and it will be finished! :)
-
The finished project with source code and video demo:
https://community.m5stack.com/topic/3584/oscpocketm-portable-beat-production-tool-for-the-m5stack-core2 -
Great work, got it installed, looks nice, now i just need time to Play with it.
-
@agreedk said in Mozzi sound synthesis library for Arduino - how to make it work on the Core2:
Great work, got it installed, looks nice, now i just need time to Play with it.
Thank you! :)
I've got audio output using the DAC to work now so it is easy to output the sound to a speaker or mixer. The instructions are in the updated PDF manual.
-
@oscillator congratulations Staffan, I'm a year late to the party but just wanted to say this is a lot of fun and I really appreciate the thorough documentation and the very readable code (speaking as a C-phobic beginner programmer).
I'm planning to make this into a module for my AE format modular synth. For now, I'll start by just feeding it into a converter but will eventually get the other components organised to make it work nicely in the system with my other modules. At least you have given me a nice wagon to fall off! :)
-
@rodberry said in Mozzi sound synthesis library for Arduino - how to make it work on the Core2:
@oscillator congratulations Staffan, I'm a year late to the party but just wanted to say this is a lot of fun and I really appreciate the thorough documentation and the very readable code (speaking as a C-phobic beginner programmer).
I'm planning to make this into a module for my AE format modular synth. For now, I'll start by just feeding it into a converter but will eventually get the other components organised to make it work nicely in the system with my other modules. At least you have given me a nice wagon to fall off! :)
Cool, I am glad you find it useful! The AE modular seems great.
I can also recommend the Daisy Seed, for which I've done a few projects:
https://www.oscillator.se/opensource/#daisyGood luck with your projects -- and your music! :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login