/WaveSimulator.jl

Primary LanguageJuliaOtherNOASSERTION

WaveSimulator

Build Status Coverage Status codecov.io

Simple Gauss impulse response to reproduce Fig 3.8 of https://www.era.lib.ed.ac.uk/handle/1842/22940 on page 70 (83 of PDF)

using WaveSimulator, Images

wave = UniformWave{3}(fmax=2e3)
sim = Simulator(wave, resource=CUDALibs(), duration=0.0245)
domain = BoxDomain(6,8,4, gamma=0.0)

res = simulate_gauss(sim, domain)

A = res.current # 71×95×48 CUDAdrv.CuArray{Float64,3}

# visualization of the acoustic field (seen from top-down)
# at around half the room's height
toimage(Array(A), .6)[:,:,24]

acoustic field

Simple signal response. Point speaker plays the sound in the right part of the room while a point microphone listens in the left part of the room. See implementation for details.

using WaveSimulator, Images, ComputationalResources, SampledSignals, LibSndFile
test = load("test.wav");
signal = vec(Float64.(test.data))
SampleBuf(signal, test.samplerate) # can play in notebook

input, output, sim = WaveSimulator.signal_response(
    signal, fps=120, gamma=0.02, duration=1.,
    dt=1/test.samplerate, showvalues=false
)

out = SampleBuf(output, 1/sim.wave.dt)
save("test_out.wav", out)