From 3017ff1554c5e7e91c4cbea3dbccd9020c885225 Mon Sep 17 00:00:00 2001 From: Tobias Hienzsch Date: Thu, 15 Feb 2024 06:00:51 +0100 Subject: [PATCH] Add Hermas project --- .github/workflows/package.yml | 1 + CMakeLists.txt | 1 + src/hermas/CMakeLists.txt | 6 ++++ src/hermas/README.md | 7 +++++ src/hermas/main.cpp | 55 +++++++++++++++++++++++++++++++++++ src/hermas/signal_chain.mmd | 28 ++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 src/hermas/CMakeLists.txt create mode 100644 src/hermas/README.md create mode 100644 src/hermas/main.cpp create mode 100644 src/hermas/signal_chain.mmd diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 4c4c15e..c439d28 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -43,6 +43,7 @@ jobs: mkdir firmware cp build/src/kyma/Release/kyma.bin firmware cp build/src/hades/Release/hades.bin firmware + cp build/src/hermas/Release/hermas.bin firmware cp build/src/astra/Release/astra.bin firmware - name: Upload coverage artifacts diff --git a/CMakeLists.txt b/CMakeLists.txt index e9b0eb9..9742830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ if(CMAKE_CROSSCOMPILING) add_subdirectory(src/astra) add_subdirectory(src/benchmark) add_subdirectory(src/hades) + add_subdirectory(src/hermas) add_subdirectory(src/kyma) endif() diff --git a/src/hermas/CMakeLists.txt b/src/hermas/CMakeLists.txt new file mode 100644 index 0000000..3a65ac4 --- /dev/null +++ b/src/hermas/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.23...3.27) +project(hermas) + +add_baremetal_executable(${PROJECT_NAME} ${LINKER_SCRIPT}) +target_sources(${PROJECT_NAME} PRIVATE main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE daisy gritwave::eurorack) diff --git a/src/hermas/README.md b/src/hermas/README.md new file mode 100644 index 0000000..7b3679b --- /dev/null +++ b/src/hermas/README.md @@ -0,0 +1,7 @@ +# Hermas + +## Features + +- Transient Shaper + - Output gain control signal + - Sum of attack & sustain, or one only via switch/button diff --git a/src/hermas/main.cpp b/src/hermas/main.cpp new file mode 100644 index 0000000..78571d5 --- /dev/null +++ b/src/hermas/main.cpp @@ -0,0 +1,55 @@ +#include +#include +#include + +#include + +namespace hermas { + +constexpr auto blockSize = 16U; +constexpr auto sampleRate = 96'000.0F; + +auto patch = daisy::patch_sm::DaisyPatchSM{}; + +auto audioCallback( + daisy::AudioHandle::InterleavingInputBuffer in, + daisy::AudioHandle::InterleavingOutputBuffer out, + size_t size +) -> void +{ + patch.ProcessAllControls(); + + auto const input = grit::StereoBlock{in, size}; + auto const output = grit::StereoBlock{out, size}; + + auto const gainLeftKnob = patch.GetAdcValue(daisy::patch_sm::CV_1); + auto const gainRightKnob = patch.GetAdcValue(daisy::patch_sm::CV_2); + + auto const gainLeft = grit::fromDecibels(grit::remap(gainLeftKnob, -30.0F, 6.0F)); + auto const gainRight = grit::fromDecibels(grit::remap(gainRightKnob, -30.0F, 6.0F)); + + for (size_t i = 0; i < size; ++i) { + auto const inLeft = input(0, i); + auto const inRight = input(1, i); + + auto const leftGained = inLeft * gainLeft; + auto const rightGained = inRight * gainRight; + + output(0, i) = leftGained + rightGained; + output(1, i) = leftGained + rightGained; + } +} + +} // namespace hermas + +auto main() -> int +{ + using namespace hermas; + + patch.Init(); + patch.SetAudioSampleRate(sampleRate); + patch.SetAudioBlockSize(blockSize); + patch.StartAudio(audioCallback); + + while (true) {} +} diff --git a/src/hermas/signal_chain.mmd b/src/hermas/signal_chain.mmd new file mode 100644 index 0000000..16ba458 --- /dev/null +++ b/src/hermas/signal_chain.mmd @@ -0,0 +1,28 @@ +--- +title: Gritwave Hermás +--- +flowchart LR + subgraph Transient[TransientShaper] + Attack + Sustain + Strength + Smooth + SelectOut[Select CV Output] + end + + Knob1((Knob 1)) --> Attack + Knob2((Knob 2)) --> Sustain + Knob3((Knob 3)) --> Strength + Knob4((Knob 4)) --> Smooth + + %% Button + Switch --> SelectOut + + CV5(CV5) --> Attack + CV6(CV6) --> Sustain + CV7(CV7) --> Strength + CV8(CV8) --> Smooth + + Input --> |Signal| Transient + Transient --> |Signal| Output + Transient --> |Transient Gain| CVOut(CV Out) \ No newline at end of file