I’m struggling with loading a wav file using LibSndFile.jl
julia> using FileIO: load, save, loadstreaming, savestreaming
julia> import LibSndFile
julia> x = load("JolieHollandSacha.wav")
([0.0 0.0; 0.0 0.0; … ; 0.0 0.0; 0.0 0.0], 44100.0f0, 0x0010, WAV.WAVChunk[WAV.WAVChunk(Symbol("fmt "), UInt8[0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04, 0x00, 0x10, 0x00])])
julia> x[1:10]
ERROR: BoundsError: attempt to access Tuple{Matrix{Float64}, Float32, UInt16, Vector{WAV.WAVChunk}} at index [5]
Stacktrace:
[1] getindex
@ ./tuple.jl:31 [inlined]
[2] #87
@ ./range.jl:434 [inlined]
[3] ntuple
@ ./ntuple.jl:19 [inlined]
[4] getindex(t::Tuple, r::UnitRange{Int64})
@ Base ./range.jl:434
[5] top-level scope
@ REPL[4]:1
julia>
according to the LibSndFile main Git page, this should be the result:
Julia> using FileIO: load, save, loadstreaming, savestreaming
julia> import LibSndFile
julia> load("audiofile.wav")
2938384-frame, 1-channel SampleBuf{FixedPointNumbers.Fixed{Int16,15}, 2}
66.63002267573697s sampled at 44100.0Hz`
x = load("myfile.wav")
plot(x[:, 1]) # plots with samples on the x axis
according to sox, the wav file I’m trying to load is fine, and I can load it into Matlab
perrin@perrinamdlaptop:~/perrin2013/SCaRF_Julia/LibSndFile$ soxi JolieHollandSacha.wav
Input File : 'JolieHollandSacha.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:03:08.89 = 8330196 samples = 14167 CDDA sectors
File Size : 33.3M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM
Any help would be greatly appreciated.