* Fix bug with `.reset()` after silent input (thanks Steve!)
This commit is contained in:
Geraint 2025-01-29 16:08:57 +00:00
parent 44c8f865af
commit 1eeba87b13
3 changed files with 13 additions and 3 deletions

View File

@ -146,3 +146,7 @@ We'd like to particularly thank the following people who sponsored specific feat
* **Metronaut**: web audio (JS/WASM) release
* **Daniel L Bowling** and the Stanford School of Medicine: web audio improvements
We're also grateful for the following community contributions:
* **Steve MacKinnon** for finding/resolving a bug in `.reset()`

View File

@ -9,8 +9,15 @@
#include "util/wav.h"
int main(int argc, char* argv[]) {
signalsmith::stretch::SignalsmithStretch<float/*, std::mt19937*/> stretch; // optional cheaper RNG for performance comparison
SimpleArgs args(argc, argv);
if (args.hasFlag("v", "prints the version")) {
std::cout << stretch.version[0] << "." << stretch.version[1] << "." << stretch.version[2] << "\n";
return 0;
}
std::string inputWav = args.arg<std::string>("input.wav", "16-bit WAV file");
std::string outputWav = args.arg<std::string>("output.wav", "output WAV file");
@ -46,7 +53,6 @@ int main(int argc, char* argv[]) {
signalsmith::Stopwatch stopwatch;
stopwatch.start();
signalsmith::stretch::SignalsmithStretch<float/*, std::mt19937*/> stretch; // optional cheaper RNG for performance comparison
stretch.presetDefault(inWav.channels, inWav.sampleRate);
stretch.setTransposeSemitones(semitones, tonality/inWav.sampleRate);
double initSeconds = stopwatch.seconds(stopwatch.lap());

View File

@ -14,7 +14,7 @@ namespace signalsmith { namespace stretch {
template<typename Sample=float, class RandomEngine=std::default_random_engine>
struct SignalsmithStretch {
static constexpr size_t version[3] = {1, 1, 0};
static constexpr size_t version[3] = {1, 1, 1};
SignalsmithStretch() : randomEngine(std::random_device{}()) {}
SignalsmithStretch(long seed) : randomEngine(seed) {}
@ -37,7 +37,7 @@ struct SignalsmithStretch {
inputBuffer.reset();
prevInputOffset = -1;
channelBands.assign(channelBands.size(), Band());
silenceCounter = 2*stft.windowSize();
silenceCounter = 0;
didSeek = false;
flushed = true;
}