From 7689b97e26f479a9406bccd1ba02a1cbc49619c9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 11 Nov 2026 06:46:10 +0700 Subject: [PATCH 1/9] feat(harmonice): port reviewed Doubler engine/builtin_fx/ChannelHarmonyProcessor.h onto tested M3 candidate --- engine/builtin_fx/ChannelHarmonyProcessor.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engine/builtin_fx/ChannelHarmonyProcessor.h b/engine/builtin_fx/ChannelHarmonyProcessor.h index b54cea5cc..641d4fcff 100644 --- a/engine/builtin_fx/ChannelHarmonyProcessor.h +++ b/engine/builtin_fx/ChannelHarmonyProcessor.h @@ -165,7 +165,7 @@ class ChannelHarmonyProcessor final : public juce::AudioProcessor, void getStateInformation(juce::MemoryBlock& out) override { juce::MemoryOutputStream stream(out,false); stream.writeInt(0x41484d31); // AHM1 - stream.writeInt(2); + stream.writeInt(3); stream.writeInt(accepted_.key); stream.writeInt(accepted_.scale); stream.writeInt(accepted_.voices); @@ -176,29 +176,32 @@ class ChannelHarmonyProcessor final : public juce::AudioProcessor, stream.writeFloat(accepted_.gainDb); stream.writeInt(accepted_.guideMode); stream.writeInt64(static_cast(accepted_.guideChannelId)); + stream.writeInt(accepted_.voiceMode); } bool restoreUnpublishedState(const void* bytes,int len) { if(published_||!bytes||len<=0||len>128)return false; juce::MemoryInputStream stream(bytes,static_cast(len),false); if(stream.readInt()!=0x41484d31)return false; const int version=stream.readInt(); - if(version!=1&&version!=2)return false; + if(version!=1&&version!=2&&version!=3)return false; armix::harmony::Settings incoming{}; incoming.key=stream.readInt();incoming.scale=stream.readInt(); incoming.voices=stream.readInt();incoming.correction=stream.readBool(); incoming.wet=stream.readFloat();incoming.space=stream.readFloat(); incoming.color=stream.readFloat();incoming.gainDb=stream.readFloat(); - if(version==2){ + if(version>=2){ incoming.guideMode=stream.readInt(); const auto guide=stream.readInt64(); if(guide<0)return false; incoming.guideChannelId=static_cast(guide); } + if(version==3)incoming.voiceMode=stream.readInt(); + // v1/v2 lacked an explicit Doubler; they stay pitched Harmony. if(stream.getPosition()!=stream.getTotalLength()|| !armix::harmony::valid(incoming))return false; if(ready_&&!dsp_.setSettings(incoming))return false; // NativeMixerSessionFxRestore restores AFTER prepareToPlay. An accepted - // v2 ChannelId must become the actual AUDIO guide source, not merely a + // v2/v3 ChannelId must become the actual AUDIO guide source, not merely a // saved GUI value. This is unpublished/control-thread only. if(ready_) { guide_.reset(); From 5115648f5847f545727819d0115a175c36daef5e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 11 Nov 2026 06:46:13 +0700 Subject: [PATCH 2/9] feat(harmonice): port reviewed Doubler engine/builtin_fx/HarmonyDsp.h onto tested M3 candidate --- engine/builtin_fx/HarmonyDsp.h | 47 +++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/engine/builtin_fx/HarmonyDsp.h b/engine/builtin_fx/HarmonyDsp.h index 7b24eacc0..97a5a409e 100644 --- a/engine/builtin_fx/HarmonyDsp.h +++ b/engine/builtin_fx/HarmonyDsp.h @@ -21,6 +21,7 @@ namespace armix::harmony { struct Settings { int key=0, scale=0, voices=3; // C=0..B=11; 0=major, 1=natural minor; 2..5 voices + int voiceMode=0; // 0=pitched harmony (2-5), 1=true unison doubler (one wet take) bool correction=false; // Manual is always the trusted fallback. Music follows another accepted // ChannelId only after stable chroma confidence (never a PCM route). @@ -30,6 +31,7 @@ struct Settings { }; inline bool valid(const Settings& s) noexcept { return s.key>=0&&s.key<12&&s.scale>=0&&s.scale<=1&& + s.voiceMode>=0&&s.voiceMode<=1&& s.guideMode>=0&&s.guideMode<=1&& (s.guideMode==0?s.guideChannelId==0:s.guideChannelId>0)&& s.voices>=2&&s.voices<=5&&std::isfinite(s.wet)&&s.wet>=0&&s.wet<=1&& @@ -165,6 +167,19 @@ class Engine final { prepared.settings=next; prepared.gain=std::pow(10.f,next.gainDb/20.f); constexpr float pi=3.14159265358979323846f; + if(next.voiceMode==1){ + // Real unison double, NOT 2 pitched harmony voices. One + // independently windowed take follows source F0 at unity ratio. + // A tiny prepared left-back offset plus the existing shared + // room/detune/arrival give a second-take character. + const float pan=-.40f*next.space; + const float angle=(pan+1.f)*pi*.25f; + const float amount=next.wet*(.77f+.38f*next.wet)*.74f; + prepared.mixL[0]=amount*std::cos(angle); + prepared.mixR[0]=amount*std::sin(angle); + out=prepared; + return true; + } float profileEnergy=0.f; for(const auto& singer:singers) if(singerActive(singer.role,next.voices)) @@ -205,6 +220,12 @@ class Engine final { } if(settings_.correction&&!next.settings.correction) leadTune_.release(); + if(next.settings.voiceMode!=settings_.voiceMode){ + // Re-evaluate note targets on the next accepted analysis, + // without stopping the dry singer or reinitializing the room. + tonalTransitionPending_=true; + if(next.settings.voiceMode==1)targetRatio_.fill(1.f); + } settings_=next.settings; targetWet_=next.settings.wet;targetColor_=next.settings.color; targetSpace_=next.settings.space; @@ -587,7 +608,11 @@ class Engine final { } const int activeKey=effectiveKey(),activeScale=effectiveScale(); const int degree=nearestDegree(midi,activeKey,activeScale); - int note=noteAt(degree,activeKey,activeScale); + // In DOUBLE the source's own melody is authoritative, not the key + // wheel's diatonic quantization. Harmony keeps the existing scale. + int note=settings_.voiceMode==1? + static_cast(std::lround(midi)): + noteAt(degree,activeKey,activeScale); if(!tonalTransitionPending_ && !pitchChangeHasMargin(currentNote_,note,midi)){ note=currentNote_; @@ -615,7 +640,9 @@ class Engine final { leadTune_.observe(midi,note,confidence); } if(note!=currentNote_||tonalTransitionPending_){ - voicePlanner_.plan(note,activeKey,activeScale==0?major:minor); + if(settings_.voiceMode==0) + voicePlanner_.plan(note,activeKey,activeScale==0?major:minor); + else voicePlanner_.reset(); ensemble_.beginNote(); } currentNote_=note;voiced_=true;tonalTransitionPending_=false; @@ -633,11 +660,17 @@ class Engine final { }else weakSyncHops_=0; // Integer intervals come from the prepared LUT. The single // fractional ratio tracks the current microphone pitch. - const float baseRatio=std::exp2((note-midi)/12.f); - for(std::size_t v=0;v Date: Wed, 11 Nov 2026 06:46:17 +0700 Subject: [PATCH 3/9] feat(harmonice): port reviewed Doubler site/preview-v2/assets/mixer-fx-rack.css onto tested M3 candidate --- site/preview-v2/assets/mixer-fx-rack.css | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index 6e30248f0..0504b3c24 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -497,6 +497,22 @@ } .mx-harm-voice-glyph{display:block;flex:0 0 11px;width:11px;height:11px} .mx-harm-voices button span{display:block;font-variant-numeric:tabular-nums} +.mx-harm-type{display:flex;gap:3px;width:100%;margin-top:2px} +.mx-harm-type button{ + appearance:none;flex:1;min-width:0;height:23px;padding:0 2px; + border:1px solid #486673;border-radius:4px; + background:linear-gradient(#1b3540,#142c37); + color:#9bbac3;font-size:8px;font-weight:500;letter-spacing:.25px; + box-shadow:inset 0 1px 3px #081c264f; + cursor:pointer +} +.mx-harm-type button.active{ + background:linear-gradient(#3d7a72,#285d59); + border-color:#69b6a5;color:#f3fcf9 +} +.mx-harm-type button.queued:not(.active){outline:1px solid #d8ae64;outline-offset:1px} +.mx-harm-type button:focus-visible{outline:2px solid #a5dfde;outline-offset:1px} +.mx-harm-voices button:disabled{opacity:.5;cursor:default} .mx-harm-voices button.active{ background:linear-gradient(180deg,#438d7d,#326c63); color:#f6fffb;border-color:#77bdac; From 6e592bb6822708ddc13492c494afba4b53d080bc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 11 Nov 2026 06:46:21 +0700 Subject: [PATCH 4/9] feat(harmonice): port reviewed Doubler site/preview-v2/assets/mixer-native-harmony.js onto tested M3 candidate --- .../preview-v2/assets/mixer-native-harmony.js | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-harmony.js b/site/preview-v2/assets/mixer-native-harmony.js index a985603d6..1061c538f 100644 --- a/site/preview-v2/assets/mixer-native-harmony.js +++ b/site/preview-v2/assets/mixer-native-harmony.js @@ -19,6 +19,7 @@ root.innerHTML=` @@ -33,6 +34,10 @@ root.innerHTML=` +