Lade till en knapp för att stämma ner från E till Eb (1 semitone)

This commit is contained in:
crille committed 2026-11-22 10:48:51 +01:00
1 parent 2a06474177
commit a26de5091c
10 files changed
+1136 -110

No files matched your search

+27 -1
View File
@@ -1,6 +1,9 @@
#pragma once
#include <JuceHeader.h>
#include <atomic>
#include <array>
#include <signalsmith-stretch.h>
class CrilleBassStripAudioProcessor final : public juce::AudioProcessor
{
@@ -34,13 +37,36 @@ public:
float getGateInputLevelDb() const noexcept { return gateInputLevelDb.load(); }
float getCompressorInputLevelDb() const noexcept { return compressorInputLevelDb.load(); }
float getCompressorGainReductionDb() const noexcept { return compressorGainReductionDb.load(); }
double getDownTuneLatencyMs() const noexcept { return downTuneLatencyMs; }
float getDetectedFrequencyHz() const noexcept { return detectedFrequencyHz.load(std::memory_order_relaxed);}
private:
using Filter = juce::dsp::IIR::Filter<float>;
// DownTune
signalsmith::stretch::SignalsmithStretch<float> downTune;
juce::AudioBuffer<float> downTuneBuffer;
// Pitch detection
static constexpr int pitchBufferSize = 4096;
std::array<float, pitchBufferSize> pitchBuffer {};
int pitchWritePosition = 0;
int pitchSamplesCollected = 0;
int pitchAnalysisCounter = 0;
std::atomic<float> detectedFrequencyHz { 0.0f };
void updatePitchDetector(
const float* input,
int numSamples
);
void analysePitch();
juce::dsp::Compressor<float> compressor;
juce::dsp::ProcessorDuplicator<Filter, juce::dsp::IIR::Coefficients<float>> lowShelf, lowMid, mid, highShelf;
double currentSampleRate = 44100.0;
double downTuneLatencyMs = 0.0;
std::vector<float> gateEnvelope;
std::atomic<float> gateInputLevelDb { -80.0f };
@@ -51,4 +77,4 @@ private:
static float getBufferPeak(const juce::AudioBuffer<float>& buffer) noexcept;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CrilleBassStripAudioProcessor)
};
};