Rebuild web release, bump version (1.3.0)

This commit is contained in:
Geraint 2025-04-18 21:29:45 +01:00
parent b84e9cf5e9
commit 94a41f9436
9 changed files with 64 additions and 11 deletions

View File

@ -32,7 +32,7 @@ namespace _impl {
template<typename Sample=float, class RandomEngine=void> template<typename Sample=float, class RandomEngine=void>
struct SignalsmithStretch { struct SignalsmithStretch {
static constexpr size_t version[3] = {1, 2, 0}; static constexpr size_t version[3] = {1, 3, 0};
SignalsmithStretch() : randomEngine(std::random_device{}()) {} SignalsmithStretch() : randomEngine(std::random_device{}()) {}
SignalsmithStretch(long seed) : randomEngine(seed) {} SignalsmithStretch(long seed) : randomEngine(seed) {}

View File

@ -109,6 +109,12 @@
<label>tonality limit</label> <label>tonality limit</label>
<input type="range" min="2000" max="20000" step="100" data-key="tonalityHz" class="diagram-red"> <input type="range" min="2000" max="20000" step="100" data-key="tonalityHz" class="diagram-red">
<input type="number" min="2000" max="20000" step="1" data-key="tonalityHz" class="diagram-red"> <input type="number" min="2000" max="20000" step="1" data-key="tonalityHz" class="diagram-red">
<label>formant</label>
<div>
<input type="checkbox" data-key="formantCompensation" class="diagram-yellow">
<input type="range" min="50" max="500" step="1" data-key="formantBaseHz" class="diagram-brown">
</div>
<input type="number" min="50" max="500" step="1" data-key="formantBaseHz" class="diagram-brown">
<label>block (ms)</label> <label>block (ms)</label>
<input type="range" min="50" max="180" step="1" data-key="blockMs" class="diagram-green"> <input type="range" min="50" max="180" step="1" data-key="blockMs" class="diagram-green">
<input type="number" min="50" max="180" step="1" data-key="blockMs" class="diagram-green"> <input type="number" min="50" max="180" step="1" data-key="blockMs" class="diagram-green">
@ -131,6 +137,9 @@
active: false, active: false,
rate: 1, rate: 1,
semitones: 0, semitones: 0,
formantSemitones: 0,
formantCompensation: false,
formantBaseHz: 200,
loopStart: 0, loopStart: 0,
loopEnd: 0 // disabled (<= start), but this gets set when we load an audio file loopEnd: 0 // disabled (<= start), but this gets set when we load an audio file
}; };

View File

@ -2,6 +2,11 @@
export SCRIPT_DIR=`dirname "$0"` export SCRIPT_DIR=`dirname "$0"`
if [ ! -z "$EMSDK" ]
then
export EMSDK_DIR="$EMSDK"
fi
if [ -z "$EMSDK_DIR" ] if [ -z "$EMSDK_DIR" ]
then then
export EMSDK_DIR="${SCRIPT_DIR}/emsdk" export EMSDK_DIR="${SCRIPT_DIR}/emsdk"

View File

@ -55,6 +55,15 @@ extern "C" {
void EMSCRIPTEN_KEEPALIVE setTransposeSemitones(Sample semitones, Sample tonalityLimit) { void EMSCRIPTEN_KEEPALIVE setTransposeSemitones(Sample semitones, Sample tonalityLimit) {
stretch.setTransposeSemitones(semitones, tonalityLimit); stretch.setTransposeSemitones(semitones, tonalityLimit);
} }
void EMSCRIPTEN_KEEPALIVE setFormantFactor(Sample multiplier, bool compensate) {
stretch.setFormantFactor(multiplier, compensate);
}
void EMSCRIPTEN_KEEPALIVE setFormantSemitones(Sample semitones, bool compensate) {
stretch.setFormantSemitones(semitones, compensate);
}
void EMSCRIPTEN_KEEPALIVE setFormantBase(Sample freq) {
stretch.setFormantBase(freq);
}
// We can't do setFreqMap() // We can't do setFreqMap()
void EMSCRIPTEN_KEEPALIVE seek(int inputSamples, double playbackRate) { void EMSCRIPTEN_KEEPALIVE seek(int inputSamples, double playbackRate) {
stretch.seek(buffersIn, inputSamples, playbackRate); stretch.seek(buffersIn, inputSamples, playbackRate);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "signalsmith-stretch", "name": "signalsmith-stretch",
"version": "1.2.0", "version": "1.3.0",
"description": "JS/WASM release of the Signalsmith Stretch library", "description": "JS/WASM release of the Signalsmith Stretch library",
"main": "SignalsmithStretch.mjs", "main": "SignalsmithStretch.mjs",
"exports": { "exports": {

View File

@ -21,6 +21,9 @@ function registerWorkletProcessor(Module, audioNodeKey) {
output: 0, output: 0,
rate: 1, rate: 1,
semitones: 0, semitones: 0,
formantSemitones: 0,
formantCompensation: false,
formantBaseHz: 0, /* 0 = attempt to detect */
loopStart: 0, loopStart: 0,
loopEnd: 0 loopEnd: 0
}]; }];
@ -230,7 +233,9 @@ function registerWorkletProcessor(Module, audioNodeKey) {
let currentMapSegment = this.timeMap[0]; let currentMapSegment = this.timeMap[0];
let wasmModule = this.wasmModule; let wasmModule = this.wasmModule;
wasmModule._setTransposeSemitones(currentMapSegment.semitones, this.config.tonalityHz/sampleRate) wasmModule._setTransposeSemitones(currentMapSegment.semitones, this.config.tonalityHz/sampleRate);
wasmModule._setFormantSemitones(currentMapSegment.formantSemitones, currentMapSegment.formantCompensation);
wasmModule._setFormantBase(currentMapSegment.formantBaseHz/sampleRate);
// Check the input/output channel counts // Check the input/output channel counts
if (outputList[0].length != this.channels) { if (outputList[0].length != this.channels) {