Skip to content

README file seems misleading, x = load("test.wav") seems to return a tuple now, I'm unsure how to save files... #58

@perrinmeyer

Description

@perrinmeyer

The documentation in the main README no longer seems to match the behavior I am seeing:

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> 

It appears to return a Tuple now? the data now appears in x[1][:]

julia> maximum(x[1][:])
0.988677632984405

julia> 

so apparently the 16bit/44100Hz file I ripped from a CD has been re scaled to -1 to 1 in floating point (which makes sense, Matlabs waveread used to do that as well). Here is what soxi thinks the file is:

perrin@ubuntu20:~/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


I have been using Matlab DSP for 20+ years, and I would like to use Julia to load/save wav files, but I need to save them in 24bit/48kHz, and I'm pretty sure LibSndFile can do this, but I just need one example... thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions