You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's something weird going on with the streaming resampling FIR filter with a floating-point ratio. I'd expect to get the same result (modulo float precision) whether I resampled an array all at once or in chunks with the stateful FIR filter. In the below example it looks like that's not happening. It doesn't happen if I change the ratio to a rational number, so it seems to be a problem just with the FIRArbitrary kernel
functionruntest()
ratio =9000/48000
data =rand(64)
f =FIRFilter(resample_filter(ratio), ratio)
out1 =filt(f, data)
f =FIRFilter(resample_filter(ratio), ratio)
out2 =vcat(filt(f, data[1:32]), filt(f, data[33:end]))
@assertlength(out1) ==length(out2)
for i in1:length(out1)
if!isapprox(out1[i], out2[i])
println("mismatch at element $i: $(out1[i]) != $(out2[i])")
endendend
julia> runtest()
mismatch at element 7: 0.0021295247679830086 != 1.04360682293e-312
mismatch at element 13: 2.2729773433e-314 != 0.013122266681143116
julia> runtest()
mismatch at element 7: 0.002004266351359534 != 3.254494040945382e-86
mismatch at element 13: 2.2729773433e-314 != 0.012160209855406971
julia> runtest()
mismatch at element 7: 0.001037523637825713 != 1.4004377841750797e195
mismatch at element 13: 2.2729773433e-314 != 0.0076082268936907005
There's a comment in stream_filt.jl above function inputlength(kernel::FIRArbitrary, outputlength::Integer) that says
TODO: figure out why this fails. Might be fine, but the filter operation might not being stepping through the phases correcty.
So maybe that's a clue...
The text was updated successfully, but these errors were encountered:
There's something weird going on with the streaming resampling FIR filter with a floating-point ratio. I'd expect to get the same result (modulo float precision) whether I resampled an array all at once or in chunks with the stateful FIR filter. In the below example it looks like that's not happening. It doesn't happen if I change the ratio to a rational number, so it seems to be a problem just with the
FIRArbitrary
kernelThere's a comment in
stream_filt.jl
abovefunction inputlength(kernel::FIRArbitrary, outputlength::Integer)
that saysSo maybe that's a clue...
The text was updated successfully, but these errors were encountered: