Invalid 'n' argument error in readBin() when trying to load a large (4GB+ audio file)

萝らか妹 提交于 2019-12-24 03:44:07

问题


I'm trying to load a sample from a 4GB+ mono WAV file (total file duration 24h, I'm loading a 15min slice).

library(tuneR)

so <-
  readWave(
    "file.wav", from = 1, to = 15, units = "minutes"
  )

This is the traceback Error in readBin(con, int, n = N, size = bytes, signed = (bytes != 1), : invalid 'n' argument 2 readBin(con, int, n = N, size = bytes, signed = (bytes != 1), endian = "little") 1 readWave(filePath, from = 1, to = 15, units = "minutes")

This happens for every 'from' and 'to' params (5,10,15,etc).

What I initially though is that I'm overflowing the data type of n, which I assume is long, but it doesn't really make sense because the error appears even when I try to load a 1min sample.

Any ideas about what may be causing this?

Note: The original file was mp3 stereo. It was split into 2 channels with WavePad and one of the channels was saves as a WAV. Maybe the conversion is the problem?


回答1:


Wave files are limited to 4GB of audio data because all of the size fields in a wave header are 32-bits. See http://en.wikipedia.org/wiki/WAV#Limitations

It's possible that WavePad uses the W64 format mentioned in the Wikipedia article but that readWave does not.



来源:https://stackoverflow.com/questions/30581289/invalid-n-argument-error-in-readbin-when-trying-to-load-a-large-4gb-audio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!