ggwave v0.2.0 (#20)

* ggwave : add support for fixed length transmissions

* spectrogram : add sample rate offset for debugging purposes

* gwave : fix decoding bug

* waver : wip

* wip

* remove post-marker frames

* add resampler

* ggwave : input/output resampling

* ggwave : fix python build

* ggwave : update spm

* ggwave : refactor duplicate encode/decode code

* ggwave : fix sound marker detection

* waver : fix typo

* ggwave : fix uninitialized members

* ggwave : more sensitive receive
This commit is contained in:
Georgi Gerganov
2021-02-20 19:16:15 +02:00
committed by GitHub
parent ff5c569071
commit 19bf22df0d
17 changed files with 921 additions and 366 deletions

32
src/resampler.h Normal file
View File

@@ -0,0 +1,32 @@
#pragma once
class Resampler {
public:
int resample(
float factor,
int nSamples,
const float * samplesInp,
float * samplesOut);
private:
float gimme_data(long j) const;
void new_data(float data);
void make_sinc();
double sinc(double x) const;
/* this controls the number of neighboring samples
which are used to interpolate the new samples. The
processing time is linearly related to this width */
static const int kWidth = 64;
static const int kDelaySize = 140;
/* this defines how finely the sinc function
is sampled for storage in the table */
static const int kSamplesPerZeroCrossing = 32;
float m_sincTable[kWidth*kSamplesPerZeroCrossing] = { 0.0 };
float m_delayBuffer[3*kWidth] = { 0 };
float m_lastFactor = -1.0f;
};