24 uint8_t subchunk2ID[4];
28 int main(
int argc,
char *argv[])
34 FILE *wavFile = fopen(
"thx-sound-test.wav",
"r");
37 fread(&wavHeader, 1,
sizeof(
wav_header), wavFile);
41 uint32_t Ns = (wavHeader.
chunkSize - 36) / Nb;
44 fread(x.memptr(), Nb, Ns, wavFile);
48 arma::Col<int16_t> x_left = x.row(0).t();
51 const int FFT_SIZE = 1024;
52 const int FFT_OVERLAP = 128;
53 arma::mat P = 10 * log10(abs(
specgram(x_left, FFT_SIZE, FFT_OVERLAP)));
57 P.rows(FFT_SIZE / 2, FFT_SIZE - 1);
59 gp0.
window(
"Deep note spectrogram", 100, 100, 1200, 400);
arma::mat specgram(const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
Power spectrogram calculation.
struct WAV_HEADER wav_header
void image(const arma::Mat< T > &x)
Plot mat as image.
int main(int argc, char *argv[])
void window(const int fig, const char *name, const int x, const int y, const int width, const int height)
Configure the figure used Windows environment.
void send2gp(const char *cmdstr)
Send command to Gnuplot pipe.