Fix timeResolutionInMs calculation issues
This commit is contained in:
parent
2bb0f0f816
commit
837f1fa402
|
@ -7,11 +7,11 @@
|
|||
<p>Implementation of <a href="https://git.gammaspectra.live/S.O.N.G/Hibiki">Hibiki</a> / <a href="https://github.com/JorenSix/Panako">Panako</a> in C++ for WebAssembly.</p>
|
||||
|
||||
<p>
|
||||
Select or drop an audio file to be fingerprinted. Computations are all done locally in-browser, then calculated fingerprints are sent to the query server.
|
||||
Select or drop an audio file to be fingerprinted. Computations are all done locally in-browser, then calculated fingerprints are sent to a <a href="https://git.gammaspectra.live/S.O.N.G/METANOIA">METANOIA</a> query server.
|
||||
</br>
|
||||
You can process full tracks or segments of them. Or try a recording from a microphone!
|
||||
</br>
|
||||
It might take a few seconds to see results. For more progress information (thanks blocking main thread) open the Developer Tools.
|
||||
It might take a few seconds to see the full result.
|
||||
</br>
|
||||
</br>
|
||||
<input type="file" id="song-upload" accept="audio/*">
|
||||
|
@ -56,7 +56,7 @@
|
|||
progressCallback: (progress) => {
|
||||
progressBar.value = Math.round(progress * 100);
|
||||
},
|
||||
audioResolutionInMs: 50
|
||||
timeResolutionInMs: 50
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
const int maxFilterWindowSizeFrequency = PANAKO_FREQ_MAX_FILTER_SIZE;
|
||||
const int maxFilterWindowSizeTime = PANAKO_TIME_MAX_FILTER_SIZE;
|
||||
public:
|
||||
EventPointProcessor(int sampleRate, int channels, int timeResolutionInMs) : sampleRate(sampleRate), channels(channels), timeResolution(double(sampleRate) * (double(timeResolutionInMs) / 1000)){
|
||||
EventPointProcessor(int sampleRate, int channels, int timeResolutionInMs) : sampleRate(sampleRate), channels(channels), timeResolution(double(PANAKO_SAMPLE_RATE) * (double(timeResolutionInMs) / 1000)){
|
||||
gaborator = gaborator_initialize(
|
||||
audioBlockSize,
|
||||
PANAKO_SAMPLE_RATE,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
const PANAKO_AUDIO_BLOCK_SIZE = 1 << 17;
|
||||
const PANAKO_AUDIO_DEFAULT_RESOLUTION = 8;
|
||||
const PANAKO_SAMPLE_RATE = 16000;
|
||||
|
||||
function processSlice (pointProcessor, slice, buf) {
|
||||
Module["HEAPU8"].set(new Uint8Array(slice.buffer, slice.byteOffset, slice.length*slice.BYTES_PER_ELEMENT), buf);
|
||||
|
@ -14,11 +15,11 @@ Module["fromArrayBuffer"] = async (buffer, options) => {
|
|||
options = options || {};
|
||||
let compactHash = options["compactHash"] || true;
|
||||
let packedPrint = options["packedPrint"] || true;
|
||||
let audioResolutionInMs = options["audioResolutionInMs"] || PANAKO_AUDIO_DEFAULT_RESOLUTION;
|
||||
let timeResolutionInMs = options["timeResolutionInMs"] || PANAKO_AUDIO_DEFAULT_RESOLUTION;
|
||||
|
||||
let audioCtx = new AudioContext({
|
||||
latencyHint: "balanced",
|
||||
//sampleRate: 16000 //TODO: maybe this can be changed once there is a proper api
|
||||
//sampleRate: PANAKO_SAMPLE_RATE //TODO: maybe this can be changed once there is a proper api
|
||||
});
|
||||
|
||||
let audioData = await audioCtx.decodeAudioData(buffer);
|
||||
|
@ -26,7 +27,7 @@ Module["fromArrayBuffer"] = async (buffer, options) => {
|
|||
options["progressCallback"](0);
|
||||
}
|
||||
|
||||
let pointProcessor = Module["ccall"]('new_point_processor', 'number', ['number', 'number', 'number'], [audioData.sampleRate, audioData.numberOfChannels, audioResolutionInMs]);
|
||||
let pointProcessor = Module["ccall"]('new_point_processor', 'number', ['number', 'number', 'number'], [audioData.sampleRate, audioData.numberOfChannels, timeResolutionInMs]);
|
||||
|
||||
let channels = [];
|
||||
for (let i = 0; i < audioData.numberOfChannels; ++i){
|
||||
|
|
Loading…
Reference in a new issue