Units such as seconds are not recognized
Closed this issue ยท 1 comments
bafonso commented
Using x[0s..1s] gives out an error. Is this a known broken feature? I am surprised as it is extensively used in the readme.
stream = loadstreaming(fname)
LibSndFile.SndFileSource{FixedPointNumbers.Fixed{Int16,15},String}
path: "/nvme/ml4a/Tango_project/tango-analysis/flacs/DE0D1DF3D0EBD28F.flac"
channels: 1
samplerate: 22050Hz
position: 0 of 3197250 frames
0.00 of 145.00 seconds
stream = loadstreaming(fname)
x = read(stream, 4s)
close(stream)
MethodError: no method matching inframes(::Type{Int64}, ::Array{Float32,1}, ::Int32)
Closest candidates are:
inframes(::Type{T}, !Matched::Union{Unitful.Quantity{T,๐,U}, Unitful.Level{L,S,Unitful.Quantity{T,๐,U}} where S where L} where U where T, ::Any) where T<:Integer at /home/gordinho/.julia/packages/SampledSignals/COYZW/src/units.jl:26
inframes(::Type{T}, !Matched::Union{Unitful.Quantity{T,๐^-1,U}, Unitful.Level{L,S,Unitful.Quantity{T,๐^-1,U}} where S where L} where U where T, ::Any) where T<:Integer at /home/gordinho/.julia/packages/SampledSignals/COYZW/src/units.jl:29
inframes(::Type{T}, !Matched::Unitful.AbstractQuantity{T,NoDims,U} where U where T, ::Any) where T<:Integer at /home/gordinho/.julia/packages/SampledSignals/COYZW/src/units.jl:23
...
Stacktrace:
[1] toindex(::LibSndFile.SndFileSource{FixedPointNumbers.Fixed{Int16,15},String}, ::Array{Float32,1}) at /home/gordinho/.julia/packages/SampledSignals/COYZW/src/SampleStream.jl:53
[2] read(::LibSndFile.SndFileSource{FixedPointNumbers.Fixed{Int16,15},String}, ::Array{Float32,1}) at /home/gordinho/.julia/packages/SampledSignals/COYZW/src/SampleStream.jl:59
[3] top-level scope at In[341]:3
nantonel commented
with the latest version this seems to be working:
julia> using FileIO: load, save, loadstreaming, savestreaming
julia> using LibSndFile, SampledSignals
julia> fname = "440left_880right_0.5amp.flac"
"440left_880right_0.5amp.flac"
julia> stream = loadstreaming(fname)
LibSndFile.SndFileSource{FixedPointNumbers.Q0f15, String}
path: "440left_880right_0.5amp.flac"
channels: 2
samplerate: 44100Hz
position: 0 of 100 frames
0.00 of 0.00 seconds
julia> x = read(stream, 0.5s)
100-frame, 2-channel SampleBuf{FixedPointNumbers.Q0f15, 2}
0.0022675736961451248s sampled at 44100.0Hz
โโ
โโโโโโโโโโโโโโโโโโโโโโ
โ
โโ
โโโโโโโโโโโโโโโโโโโโโโ
โ
โ
โโโโโโโโโโโโ
โ
โโโโโโโโโโโ
โ
โโโโโโโโโโโโ
โ
โโโโโโโโโโโ