Output
Source
uint8_t RIFF[4];
uint32_t chunkSize;
uint8_t WAVE[4];
uint8_t fmt[4];
uint32_t subchunk1Size;
uint16_t audioFormat;
uint16_t numOfChan;
uint32_t samplesPerSec;
uint32_t bytesPerSec;
uint16_t blockAlign;
uint16_t bitsPerSample;
uint8_t subchunk2ID[4];
uint32_t subchunk2Size;
int main(
int argc,
char *argv[])
{
FILE *wavFile = fopen("thx-sound-test.wav", "r");
fread(&wavHeader, 1,
sizeof(
wav_header), wavFile);
uint32_t Ns = (wavHeader.
chunkSize - 36) / Nb;
fread(x.memptr(), Nb, Ns, wavFile);
fclose(wavFile);
arma::Col<int16_t> x_left = x.row(0).t();
const int FFT_SIZE = 1024;
const int FFT_OVERLAP = 128;
arma::mat P = 10 * log10(abs(
specgram(x_left, FFT_SIZE, FFT_OVERLAP)));
arma::mat Q =
P.rows(FFT_SIZE / 2, FFT_SIZE - 1);
gp0.
window(
"Deep note spectrogram", 100, 100, 1200, 400);
return 0;
}