Last active
April 6, 2020 05:54
-
-
Save monogenea/1848b960ed75d78f8f3361477befb847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot spectrogram from random training sample - range is 0-22.05 kHz | |
image(train$X[sample(dim(train$X)[1], 1),,,], | |
xlab = "Time (s)", | |
ylab = "Frequency (kHz)", | |
axes = F) | |
# Generate mel sequence from Hz points, standardize to plot | |
freqs <- c(0, 1, 5, 15, 22.05) | |
mels <- 2595 * log10(1 + (freqs*1e3) / 700) # https://en.wikipedia.org/wiki/Mel_scale | |
mels <- mels - min(mels) | |
mels <- mels / max(mels) | |
axis(1, at = seq(0, 1, by = .2), labels = seq(0, 10, by = 2)) | |
axis(2, at = mels, las = 2, | |
labels = round(freqs, 2)) | |
axis(3, labels = F); axis(4, labels = F) | |
#### Save #### | |
save(train, val, test, file = "prepAudio.RData") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment