🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Mozzi sound synthesis library for Arduino - how to make it work on the Core2

    Arduino
    3
    15
    20.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      oscillator
      last edited by oscillator

      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!

      O 1 Reply Last reply Reply Quote 0
      • O
        oscillator @oscillator
        last edited by oscillator

        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.

        O 1 Reply Last reply Reply Quote 2
        • O
          oscillator @oscillator
          last edited by

          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).

          0_1631443106619_Screenshot_20210912-123357.jpg

          1 Reply Last reply Reply Quote 1
          • O
            oscillator
            last edited by

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

            1_1631626023728_demo_syntheditor.jpg 0_1631626023728_demo_pianoroll.jpg

            1 Reply Last reply Reply Quote 1
            • O
              oscillator
              last edited by

              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).0_1631826372496_main.jpg

              1 Reply Last reply Reply Quote 0
              • O
                oscillator
                last edited by

                Drum sound editor
                0_1631826403786_drum_sound.jpg

                and drum editor!

                0_1631826421033_drum_editor.jpg

                1 Reply Last reply Reply Quote 0
                • O
                  oscillator
                  last edited by

                  Song mode (arranging sequences in programmed order)

                  0_1631826490724_song_editor.jpg

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

                  0_1631826534107_mixer.jpg

                  1 Reply Last reply Reply Quote 0
                  • O
                    oscillator
                    last edited by

                    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.

                    A 1 Reply Last reply Reply Quote 1
                    • A
                      AgreeDK @oscillator
                      last edited by

                      @oscillator looking forward to try it 👍

                      O 1 Reply Last reply Reply Quote 0
                      • O
                        oscillator @AgreeDK
                        last edited by

                        @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! :)

                        1 Reply Last reply Reply Quote 0
                        • O
                          oscillator
                          last edited by

                          The finished project with source code and video demo:
                          https://community.m5stack.com/topic/3584/oscpocketm-portable-beat-production-tool-for-the-m5stack-core2

                          1 Reply Last reply Reply Quote 1
                          • A
                            AgreeDK
                            last edited by

                            Great work, got it installed, looks nice, now i just need time to Play with it.

                            O 1 Reply Last reply Reply Quote 1
                            • O
                              oscillator @AgreeDK
                              last edited by

                              @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.

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                rodberry @oscillator
                                last edited by

                                @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! :)

                                O 1 Reply Last reply Reply Quote 1
                                • O
                                  oscillator @rodberry
                                  last edited by oscillator

                                  @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/#daisy

                                  Good luck with your projects -- and your music! :)

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post