wavread with subrange of step >1 gives wrong result
Opened this issue · 4 comments
baggepinnen commented
See the following example, where I have overloaded getindex
on a LazyWAVFile
to do wavread(path, format="native", ind)
julia> f[1:10] # Correct
10-element Array{Int16,1}:
-15
-8
-4
-19
-3
-4
-12
-2
-17
-4
julia> f[1:2:10] # Incorrect, but no error message
5-element Array{Int16,1}:
-15
-8
-4
-19
-3
julia> f[collect(1:2:10)] # If range is collected to an array, result is correct
5-element Array{Int16,1}:
-15
-4
-3
-12
-17
dancasimiro commented
How many channels are in the WAV file?
baggepinnen commented
Single channel
mgkuhn commented
The wavread
docstring now says:
subrange
controls which samples are returned.
The default (:
) returns all samples in the file.
Passing an integerN
(or equivalently the range1:N
) returns
the firstN
samples of each channel.
Passing a unitrangeI:J
returnslength(I:J)
consecutive
samples from each channel, starting with theI
-th sample.
There is no support for StepRange
.
We could assert subrange::Union{Colon, Real, UnitRange{<:Real}}
if you want a compiler error.
mgkuhn commented
While testing a patch for this issue, I stumbled over JuliaLang/julia#37169