This package implements a set of methods to compute generic acoustic features in AxisArrays for time-series acoustic data.
The acoustic features are:
Acoustic Feature | Constructor |
---|---|
Energy | Energy |
Myriad | Myriad |
Frequency Contours | FrequencyContours |
Sound Pressure Level | SoundPressureLevel |
Impulse Statistics (number of impulses, mean and variance of inter-impulse intervals) | ImpulseStats |
Symmetric Alpha Stable Statistics (α and scale) | SymmetricAlphaStableStats |
Entropy (temporal entropy, spectral entropy and entropy index) | Entropy |
Zero Crossing Rate | ZeroCrossingRate |
Spectral Centroid | SpectralCentroid |
Spectral Flatness | SpectralFlatness |
Permutation Entropy | PermutationEntropy |
PSD | PSD |
Acoustic Complexity Index | AcousticComplexityIndex |
Statistical Complexity | StatisticalComplexity |
Acoustic Diversity Index | AcousticDiversityIndex |
using Pkg; pkg"add https://github.com/ymtoo/AcousticFeatures.jl.git"
using AcousticFeatures, DSP, SignalAnalysis, Plots
function compare(sc1, sc2)
plot(sc1.axes[1] ./ fs, vec(sc1.data),
xlabel = "Time (sec)",
ylabel = "Permutation Entropy",
label = "without chirp",
color = :blue,
dpi = 150,
thickness_scaling = 1.0,
legend=:bottomleft
)
plot!(sc2.axes[1] ./ fs, vec(sc2.data),
xlabel = "Time (sec)",
ylabel = "Permutation Entropy",
label = "with chirp",
color = :red,
dpi = 150,
thickness_scaling = 1.0,
legend=:bottomleft
)
end
N = 2400
fs = 2400
v = randn(Float64, 3*N)
s = real(chirp(500, 1000, 1.0, fs))
x = copy(v);
x[N:2*N-1] += s
specgram(signal(x,fs); fs=fs,nfft=128)
winlen = 2400
noverlap = 1200
pe = PermutationEntropy(5, 1, true, true)
sc1 = Score(
pe,
v;
winlen = winlen,
noverlap = noverlap
)
sc2 = Score(
pe,
x;
winlen = winlen,
noverlap = noverlap
)
compare(sc1, sc2)
N = 2400
fs = 2400
v = randn(Float64, 3*N)
Ns = fs ÷ 100
bpf = fir(13, 500, 1000; fs=fs)
s = 10 .* filtfilt(bpf, randn(Float64, Ns)) #real(chirp(500, 1100, 0.1, fs))
x = copy(v);
Ngap = fs ÷ 10
x[N:N+Ns-1] += s
x[N+5Ngap:N+5Ngap+Ns-1] += s
x[N+9Ngap:N+9Ngap+Ns-1] += s
specgram(signal(x,fs); nfft=128, fs=fs)
winlen = 2400
noverlap = 1200
pe = PermutationEntropy(5, 1, true, true)
sc1 = Score(
pe,
v;
winlen = winlen,
noverlap = noverlap,
)
sc2 = Score(
pe,
x;
winlen = winlen,
noverlap = noverlap,
)
compare(sc1, sc2)