org-arl/UnderwaterAcoustics.jl

Add sampled signal AcousticSource

Closed this issue · 0 comments

Rough outline:

function record(x::SampledSignal, duration, fs; start=0.0)
  fs == framerate(x) || error("Resampling not supported yet")
  t1 = toframe(start, x)
  t2 = toframe(start+duration, x)
  y = padded(x, (max(-t1, 0), min(t2-length(x), 0)); delay=-t1)
  @view y[1:t2-t1+1]
end

but we should make it a subtype of AcousticSource. Might also want to consider auto resampling if necessary.