diff --git a/src/Filters/stream_filt.jl b/src/Filters/stream_filt.jl index 235c02e42..10d424ce6 100644 --- a/src/Filters/stream_filt.jl +++ b/src/Filters/stream_filt.jl @@ -229,7 +229,7 @@ function setphase!(kernel::FIRArbitrary, ϕ::Real) (ϕ, xThrowaway) = modf(ϕ) kernel.inputDeficit += round(Int, xThrowaway) kernel.ϕAccumulator = ϕ*(kernel.Nϕ) + 1.0 - kernel.ϕIdx = round(kernel.ϕAccumulator) + kernel.ϕIdx = floor(kernel.ϕAccumulator) kernel.α = modf(kernel.ϕAccumulator)[1] nothing end diff --git a/test/filt_stream.jl b/test/filt_stream.jl index 65457f1e0..1c17e1c03 100644 --- a/test/filt_stream.jl +++ b/test/filt_stream.jl @@ -365,3 +365,11 @@ end # check that these don't throw; the output should actually probably be longer @test resample(1:2, 3, [zeros(2); 1; zeros(3)]) == [1, 0, 0, 2] # [1, 0, 0, 2, 0, 0] @test resample(1:2, 3//2, [zeros(2); 1; zeros(3)]) == [1, 0] # [1, 0, 0] +let H = FIRFilter(2.22) + setphase!(H, 0.99) + @test length(filt(H, 1:2)) == 3 +end +let H = FIRFilter(122.2) + setphase!(H, 0.99) + @test length(filt(H, 1:2)) == 124 +end