SLEEF cos sin
This commit is contained in:
parent
5d6860d9b5
commit
08a67d10ce
3 changed files with 13 additions and 5 deletions
|
@ -1,12 +1,13 @@
|
||||||
name = "RoomAcoustics"
|
name = "RoomAcoustics"
|
||||||
uuid = "9b22aa7e-b0d0-4fe8-9c3b-2b8bf774f735"
|
uuid = "9b22aa7e-b0d0-4fe8-9c3b-2b8bf774f735"
|
||||||
authors = ["Szymon M. Woźniak <s@zymon.org>"]
|
authors = ["Szymon M. Woźniak <s@zymon.org>"]
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
|
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
|
||||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||||
|
SLEEFPirates = "476501e8-09a2-5ece-8869-fb82de89a1fa"
|
||||||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
|
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
|
||||||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
||||||
|
|
||||||
|
|
14
src/ISM.jl
14
src/ISM.jl
|
@ -145,6 +145,11 @@ function ISM_RectangularRoom_core!(
|
||||||
# Transform size of the room from meters to samples
|
# Transform size of the room from meters to samples
|
||||||
Lₛ = L ./ Γ
|
Lₛ = L ./ Γ
|
||||||
|
|
||||||
|
# Impulse parameters
|
||||||
|
Δt = 1 / fs
|
||||||
|
ω = 2π / Wd
|
||||||
|
twid = π * fs
|
||||||
|
|
||||||
# Compute maximal wall reflection
|
# Compute maximal wall reflection
|
||||||
N = ceil.(Int, Nh ./ (2 .* Lₛ))
|
N = ceil.(Int, Nh ./ (2 .* Lₛ))
|
||||||
|
|
||||||
|
@ -216,10 +221,11 @@ function ISM_RectangularRoom_core!(
|
||||||
|
|
||||||
# Insert yet another impulse into transfer function
|
# Insert yet another impulse into transfer function
|
||||||
for i ∈ i_s:i_e
|
for i ∈ i_s:i_e
|
||||||
t = (i - 1) / fs - τ # time signature
|
t = (i - 1) * Δt - τ # time signature
|
||||||
w = 0.5 * (1.0 + cos(2π * t / Wd)) # Hann window
|
w = fma(cos_fast(ω*t), 0.5, 0.5) # Hann window
|
||||||
x = π * fs * t + eps()
|
x = twid * t
|
||||||
h[i] += w * A * sin(x)/x
|
sinc = ifelse(iszero(x), 1.0, sin_fast(x)/x)
|
||||||
|
@inbounds h[i] += w * A * sinc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Statistics
|
||||||
using Random
|
using Random
|
||||||
using Random: GLOBAL_RNG
|
using Random: GLOBAL_RNG
|
||||||
|
|
||||||
|
using SLEEFPirates: cos_fast, sin_fast
|
||||||
using DSP: conv
|
using DSP: conv
|
||||||
|
|
||||||
include("TxRxModels.jl")
|
include("TxRxModels.jl")
|
||||||
|
|
Loading…
Reference in a new issue