1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
context("Read raw audio")
wonderland <- system.file('samples/Synapsis-Wonderland.mp3', package='av')
test_that("Audio FFT", {
extensions <- c("wav", "mkv", "ac3", "flac")
av_log_level(16) # muffle some warnings about ac3 vbr
for(ext in extensions){
filename <- paste0('wonderland.', ext)
av_audio_convert(wonderland, filename, verbose = FALSE)
data <- read_audio_fft(filename, window = hanning(2048))
expect_equal(dim(data)[1], 1024)
unlink(filename)
}
})
test_that("Read binary audio", {
out1 <- read_audio_bin(wonderland)
out2 <- read_audio_bin_old(wonderland)
expect_identical(out1, out2)
out1 <- read_audio_bin(wonderland, channels = 1)
out2 <- read_audio_bin_old(wonderland, channels = 1)
expect_identical(out1, out2)
out1_short <- read_audio_bin(wonderland, start_time = 5)
out2_short <- read_audio_bin_old(wonderland, start_time = 5)
expect_identical(out1_short, out2_short)
})
|