1
0

Compare commits

..

No commits in common. "4529d88042a9124903a6d6bac4389df812b9c2d6" and "6fcdd0a158e0ef2adc1fe936b5a97ceb31398fc6" have entirely different histories.

2 changed files with 6 additions and 21 deletions

View File

@ -36,7 +36,7 @@ struct AnalyserSTFX : public BaseEffect {
storage.range("barkResolution", barkResolution)
.info("res.", "in Bark scale")
.range(2, 10, 25)
.range(1, 10, 25)
.unit("", 0);
if (storage.extra()) {
@ -52,7 +52,7 @@ struct AnalyserSTFX : public BaseEffect {
stft.configure(channels, 0, stftBlockMs*0.001*sampleRate, stftIntervalMs*0.001*sampleRate);
subRate = sampleRate/stft.defaultInterval();
bands = spectrum.resize(channels, barkResolution, sampleRate, stft.blockSamples());
bands = spectrum.resize(channels, barkResolution, sampleRate);
updateBands();
tmp.resize(stft.defaultInterval());
}
@ -158,7 +158,7 @@ private:
void stftStep() {
if (barkResolution != prevBarkResolution) {
prevBarkResolution = barkResolution;
bands = spectrum.resize(channels, barkResolution, sampleRate, stft.blockSamples());
bands = spectrum.resize(channels, barkResolution, sampleRate);
updateBands();
}
@ -196,26 +196,16 @@ private:
std::vector<Sample> hz, bwHz;
std::vector<std::vector<Sample>> energy;
size_t resize(size_t channels, Sample barkResolution, Sample sampleRate, size_t fftBands) {
size_t resize(size_t channels, Sample barkResolution, Sample sampleRate) {
bandsChanged = true;
hz.resize(0);
bwHz.resize(0);
Sample maxBwHz = sampleRate/fftBands;
auto barkScale = signalsmith::curves::Reciprocal<Sample>::barkScale();
Sample barkStep = 1/barkResolution, barkEnd = barkScale.inverse(sampleRate/2);
for (Sample bark = barkScale.inverse(0); bark < barkEnd; bark += barkStep) {
auto bw = barkScale.dx(bark)*barkStep;
if (!hz.empty() && bw >= maxBwHz) {
// our Bark scale would be less dense than the FFT, so we might miss data
for (auto linearHz = hz.back() + maxBwHz; linearHz < sampleRate/2; linearHz += maxBwHz) {
hz.push_back(linearHz);
bwHz.push_back(maxBwHz);
}
break;
}
hz.push_back(barkScale(bark));
bwHz.push_back(bw);
bwHz.push_back(barkScale.dx(bark)*barkStep);
}
hz.push_back(sampleRate/2);
bwHz.push_back(barkScale.dx(barkEnd)*barkStep);

View File

@ -385,11 +385,6 @@ struct WebUILibraryEffect : public LibraryEffect<Sample, WebUIHelper<EffectSTFX,
}
}
void webClosed() {
// stops new messages from being queued up until the reset message is sent
requestEntireState();
}
// Replace `.process()` to add meter messages if they exist
template<class Buffers>
void process(Buffers &&buffers, int blockLength) {