Skip to content

Commit

Permalink
More experimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKickliter committed Sep 10, 2014
1 parent bada707 commit 53f3743
Showing 1 changed file with 68 additions and 15 deletions.
83 changes: 68 additions & 15 deletions test/Δ Test.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,69 @@
resamp = 1.5
δ_hr = 0.0
δ_acc = 0.0
δ_lr = 0.0
count = 0
numfilters = 32
= inv(resamp)
tau = 0.0

while count < 10
count = count + 1
tau +=
hIdx = floor( tau * numfilters )
count % numfilters == 0 && (tau -= 1)
println( "$count $tau, $hIdx")

type ArbResamplerState
rate::Float64
N𝜙::Int
::Float64
𝜙Accumulator::Float64
𝜙Idx::Int
Δ::Float64
𝜙IdxVirtual::Float64
function ArbResamplerState( rate::Real, N𝜙::Integer = 32 )
rate = rate
N𝜙 = N𝜙
= inv(rate)
𝜙Accumulator = 0.0
𝜙IdxVirtual = 1.0
𝜙Idx = 1
Δ = 0.0
new( rate, N𝜙, ∇, 𝜙Accumulator, 𝜙Idx, Δ, 𝜙IdxVirtual )
end
end

function increment!( self::ArbResamplerState )
self.𝜙Accumulator += self.∇
self.𝜙IdxVirtual = self.𝜙Accumulator * self.N𝜙
self.𝜙Idx = ifloor( self.𝜙IdxVirtual )
self.Δ = mod( self.𝜙Idx, 1 )

if self.𝜙Idx > self.N𝜙
self.𝜙Accumulator -= 1
self.𝜙IdxVirtual -= self.N𝜙
self.𝜙Idx = ifloor( self.𝜙IdxVirtual )
self.Δ = self.𝜙IdxVirtual - self.𝜙Idx
end
end


resamp = 0.9
N𝜙 = 32
yCount = 0
xCount = 0
self = ArbResamplerState( resamp, 32 )

while xCount < 10
xCount += 1
if self.𝜙Idx
println( "$yCount: 𝜙Idx = $(self.𝜙Idx), Δ = $(self.Δ), 𝜙IdxVirtual = $(self.𝜙IdxVirtual), 𝜙Accumulator = $(self.𝜙Accumulator)")
increment!( self )
end


while xCount < 10
xCount += 1
while 𝜙Idx <= N𝜙
yCount += 1

println( "$yCount: 𝜙Idx = $𝜙Idx, Δ = , 𝜙IdxVirtual = $𝜙IdxVirtual, 𝜙Accumulator = $𝜙Accumulator")

𝜙Accumulator +=
𝜙IdxVirtual = 𝜙Accumulator * N𝜙
𝜙Idx = ifloor( 𝜙IdxVirtual ) + 1
Δ = mod( 𝜙Accumulator, 1 )

end

𝜙Accumulator -= 1
𝜙IdxVirtual -= N𝜙
𝜙Idx = ifloor( 𝜙IdxVirtual )

end

0 comments on commit 53f3743

Please sign in to comment.