[R] tuneR - readWave
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Oct 20 08:53:09 CEST 2004
Sam Ferguson wrote:
> Hi R-people,
>
> I'm trying to use the fantastic tuneR package to read wave files for
> analysis. I have followed some of the demos but am having trouble
> getting readWave to work on any wave file not saved by tuneR. As per
> the help example Wobj2 <- readWave("testfile.wav") works when I have
> used writeWave to save testfile.wav. However I cannot find any other
> wav file that is satisfactory for tuneR to load. I have saved a short
> pink noise file from protools in (bwf)wav format 16/44.1 Khz and when
> i say x <- readWave("pinkNoisePT.wav") I get :-
>
> Error in readBin(con, int, n = N, size = bytes, signed = (bytes == 2)) :
> invalid value of `n'
> In addition: Warning message:
> Looks like 'pinkNoisePT.wav' is not a valid wave file. in:
> readWave("pinkNoisePT.wav")
>
>
> With another file that quicktime says is also 16/44.1 :-
>
> Error in readBin(con, int, n = N, size = bytes, signed = (bytes == 2)) :
> That size is unknown on this machine
> In addition: Warning messages:
> 1: Looks like 'voice.wav' is not a valid wave file. in:
> readWave("voice.wav")
> 2: NAs produced by integer overflow in: sample.rate * block.align
> 3: Wave file 'voice.wav' seems to be corrupted. in: readWave("voice.wav")
>
> These both play happily in quicktime. I have searched for quite some
> time, but cannot locate what I am doing wrong ???
>
> I have similar problems with my Windows XP box though my main box is
> MacOsX 10.3.4, R2.0.0.0 and tuneR compiled for 2.0.0.0
>
> Thanks to Uwe L for what appears to be a fantastic package of analysis
> functions.
>
> Sam Ferguson
>
Well, it's not that fantastic yet, because most of the stuff intended to
be included is either not yet included or still heavily in development.
Anyway, reading Wave files should work, iff the Wave files follows the
Wave file definition I have read to implement that function.
It should work with Wave files generated by Microsoft software, some Mac
studio software from the musicians at our university, and also by
WaveLab (all tested). Looks like the Wave formats you are using are
different.
Please can you upload small example Wave files to a website or sent them
in a private message? Or even better, can you send the Wave file
specification your software has implemented?
I might be able to fix the problem.
Please note that package specific questions are ought to be send to the
package maintainer in the first place.
Uwe Ligges
More information about the R-help
mailing list