From 8d7a2c728da56280447f834a4d96fd10f8a76bf6 Mon Sep 17 00:00:00 2001 From: chriskiefer Date: Mon, 8 Sep 2025 11:13:10 +0100 Subject: [PATCH] display update --- MEMLNaut-PAF-CARL.ino | 27 +++++++++++---------- PAFSynthAudioApp.cpp | 56 ++++++++++++++++++++++++++++++++++++------- PAFSynthAudioApp.hpp | 2 ++ src/memllib | 2 +- src/memlp | 2 +- 5 files changed, 65 insertions(+), 24 deletions(-) diff --git a/MEMLNaut-PAF-CARL.ino b/MEMLNaut-PAF-CARL.ino index 1053feb..326c1a2 100644 --- a/MEMLNaut-PAF-CARL.ino +++ b/MEMLNaut-PAF-CARL.ino @@ -1,6 +1,6 @@ // #include "src/memllib/interface/InterfaceBase.hpp" #include "src/memllib/interface/MIDIInOut.hpp" -#include "src/memllib/hardware/memlnaut/display.hpp" +// #include "src/memllib/hardware/memlnaut/display.hpp" #include "src/memllib/audio/AudioAppBase.hpp" #include "src/memllib/audio/AudioDriver.hpp" #include "src/memllib/hardware/memlnaut/MEMLNaut.hpp" @@ -12,7 +12,7 @@ #define APP_SRAM __not_in_flash("app") -display APP_SRAM scr; +// display APP_SRAM scr; bool core1_disable_systick = true; bool core1_separate_stack = true; @@ -55,16 +55,16 @@ constexpr size_t kN_InputParams = 3; #define READ_VOLATILE(var) ({ MEMORY_BARRIER(); typeof(var) __temp = (var); MEMORY_BARRIER(); __temp; }) -struct repeating_timer APP_SRAM timerDisplay; -inline bool __not_in_flash_func(displayUpdate)(__unused struct repeating_timer *t) { - scr.update(); - return true; -} +// struct repeating_timer APP_SRAM timerDisplay; +// inline bool __not_in_flash_func(displayUpdate)(__unused struct repeating_timer *t) { +// scr.update(); +// return true; +// } void setup() { - scr.setup(); + // scr.setup(); bus_ctrl_hw->priority = BUSCTRL_BUS_PRIORITY_DMA_W_BITS | BUSCTRL_BUS_PRIORITY_DMA_R_BITS | BUSCTRL_BUS_PRIORITY_PROC1_BITS; @@ -89,8 +89,8 @@ void setup() // Setup interface with memory barrier protection WRITE_VOLATILE(interface_ready, true); // Bind interface after ensuring it's fully initialized - RLInterface->bind_RL_interface(scr); - Serial.println("Bound RL interface to MEMLNaut."); + // RLInterface->bind_RL_interface(scr); + // Serial.println("Bound RL interface to MEMLNaut."); midi_interf = std::make_shared(); midi_interf->Setup(0); @@ -115,9 +115,10 @@ void setup() delay(1); } - scr.post("MEMLNaut PAF CARL"); - scr.post("let's go!"); - add_repeating_timer_ms(-39, displayUpdate, NULL, &timerDisplay); + // scr.post("MEMLNaut PAF CARL"); + // scr.post("let's go!"); + // add_repeating_timer_ms(-39, displayUpdate, NULL, &timerDisplay); + MEMLNaut::Instance()->addSystemInfoView(); Serial.println("Finished initialising core 0."); } diff --git a/PAFSynthAudioApp.cpp b/PAFSynthAudioApp.cpp index 35a2cbc..1635f30 100644 --- a/PAFSynthAudioApp.cpp +++ b/PAFSynthAudioApp.cpp @@ -1,6 +1,8 @@ #include "PAFSynthAudioApp.hpp" #include "src/memllib/synth/maximilian.h" // Required for maxiSettings etc. +#define ARPEGGIATOR + PAFSynthAudioApp::PAFSynthAudioApp() : AudioAppBase() {} bool PAFSynthAudioApp::euclidean(float phase, const size_t n, const size_t k, const size_t offset, const float pulseWidth) @@ -41,22 +43,53 @@ stereosample_t PAFSynthAudioApp::Process(const stereosample_t x) // y = y * 0.3f; // const float envamp = env.play(counter==0); // const float envamp = line.play(counter==0); - if(newNote) { - // if(zxdetect.onZX(euclidNewNote)) { - newNote = false; +// if(newNote) { +// // if(zxdetect.onZX(euclidNewNote)) { +// newNote = false; +// envamp=0.8f; +// // freqIndex++; +// // if(freqIndex >= 4) { +// // freqIndex = 0; +// // } +// // arpFreq = frequencies[freqIndex]; +// }else{ +// constexpr float envdec = 0.2f/9000.f; +// envamp -= envdec; +// if (envamp < 0.f) { +// envamp = 0.f; +// } +// } + + +#ifdef ARPEGGIATOR + const float ph = phasorOsc.phasor(1); + const bool euclidNewNote = euclidean(ph, 12, euclidN, 0, 0.1f); + if(zxdetect.onZX(euclidNewNote)) { envamp=0.8f; - // freqIndex++; - // if(freqIndex >= 4) { - // freqIndex = 0; - // } - // arpFreq = frequencies[freqIndex]; + freqIndex++; + if(freqIndex >= nFREQs) { + freqIndex = 0; + } + baseFreq = frequencies[freqIndex]; }else{ - constexpr float envdec = 0.2f/9000.f; + // constexpr float envdec = 0.2f/9000.f; envamp -= envdec; if (envamp < 0.f) { envamp = 0.f; } } +#else + if(newNote) { + newNote = false; + envamp=0.8f; + }else{ + // constexpr float envdec = 0.2f/9000.f; + envamp -= envdec; + if (envamp < 0.f) { + envamp = 0.f; + } + } +#endif // PERIODIC_DEBUG(3000, Serial.println(y);) y = y * envamp* envamp; // counter++; @@ -73,7 +106,9 @@ stereosample_t PAFSynthAudioApp::Process(const stereosample_t x) // Serial.println(envamp); // }) +#ifndef ARPEGGIATOR y *= noteVel; +#endif float d1 = (dl1.play(y, 3500, 0.8f) * dl1mix); // float d2 = (dl2.play(y, 15000, 0.8f) * dl2mix); @@ -188,5 +223,8 @@ void PAFSynthAudioApp::ProcessParams(const std::vector& params) euclidN = static_cast(2 + (params[19] * 5)); + envdec=((params[20] * 3.f) + 0.1f)/9000.f; // Decay rate for the envelope + + // Serial.printf("%f %f %f %f %f\n", paf0_cf, paf0_bw, paf0_vib, paf0_vfr, paf0_shift); } diff --git a/PAFSynthAudioApp.hpp b/PAFSynthAudioApp.hpp index 7c23ecc..8920325 100644 --- a/PAFSynthAudioApp.hpp +++ b/PAFSynthAudioApp.hpp @@ -96,6 +96,8 @@ protected: float noteVel = 0.f; bool firstParamsReceived = false; + float envdec=0.2f/9000.f; // Decay rate for the envelope + }; #endif // __PAF_SYNTH_AUDIO_APP_HPP__ diff --git a/src/memllib b/src/memllib index 96d0c87..5998f31 160000 --- a/src/memllib +++ b/src/memllib @@ -1 +1 @@ -Subproject commit 96d0c879fcbbebc1ee57198251029f849c99a278 +Subproject commit 5998f312f887b60d13ce3437c0dca5cbf3df819b diff --git a/src/memlp b/src/memlp index 053d7b0..a81f235 160000 --- a/src/memlp +++ b/src/memlp @@ -1 +1 @@ -Subproject commit 053d7b075e509b302dc45cb6664c01f73a96fead +Subproject commit a81f2358a42b3b202c6a3eaf1e89407e0aa026c8