This library provides functions to generate
- pink noise (
rand
) - ship noise (
rand
)
using Pkg; pkg"add https://github.com/ymtoo/ShipNoiseGenerators.jl.git"
julia> using DSP, ShipNoiseGenerators, Plots
julia> n = 96000
julia> fs = 96000
julia> g1 = PinkNoiseGenerator(n)
julia> x = rand(g1)
julia> p = welch_pgram(x, 1024; fs=fs)
julia> plot(freq(p)./1000, 10*log10.(power(p)), xscale=:log10, xlims=(10, 48000)./1000, ylims=(-60, 0), xlabel="Frequency (kHz)", ylabel="Power spectral density (dB/Hz)", label="Estimated PSD")
julia> plot!(freq(p)./1000, 10*log10.(1 ./ (freq(p))), xscale=:log10, xlims=(10, 48000)./1000, ylims=(-60, 0), xlabel="Frequency (kHz)", ylabel="Power spectral density (dB/Hz)", label="Expected roll-off")
julia> n = 96000
julia> fs = 96000
julia> As = [0.8]
julia> frequencies = [200.0]
julia> ϕs = [0.1]
julia> g2 = ShipNoiseGenerator(n=n, fs=fs, As=As, frequencies=frequencies, ϕs=ϕs)
julia> x = rand(g2)
julia> plot([1:length(x)]./fs, x, xlabel="Time (sec)", ylabel="Pressure (uncalibrated)", legend=false)
julia> p = welch_pgram(x, 1024; fs=fs)
julia> plot(freq(p)./1000, 10*log10.(power(p)), xlabel="Frequency (kHz)", ylabel="Power spectral density (dB/Hz)", legend=false)