https://github.com/ymtoo/acousticfeatures.jl
Acoustic features in Julia
https://github.com/ymtoo/acousticfeatures.jl
acoustic-features time-series
Last synced: about 1 month ago
JSON representation
Acoustic features in Julia
- Host: GitHub
- URL: https://github.com/ymtoo/acousticfeatures.jl
- Owner: ymtoo
- License: mit
- Created: 2020-02-21T08:58:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-10T00:59:35.000Z (8 months ago)
- Last Synced: 2025-01-26T02:44:31.649Z (3 months ago)
- Topics: acoustic-features, time-series
- Language: Julia
- Homepage:
- Size: 896 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
# AcousticFeatures

[](https://codecov.io/gh/ymtoo/AcousticFeatures.jl)
[](https://ymtoo.github.io/AcousticFeatures.jl/dev)This package implements a set of methods to compute generic acoustic features in [AxisArrays](https://github.com/JuliaArrays/AxisArrays.jl.git) for time-series acoustic data.
The acoustic features are:
| Acoustic Feature | Constructor |
|--------------------|------------------------------------------------|
| Energy | Energy |
| [Myriad](https://link.springer.com/article/10.1155/S1110865702000483) | Myriad |
| [Frequency Contours](https://asa.scitation.org/doi/10.1121/1.3531926) | FrequencyContours |
| [Sound Pressure Level](https://en.wikipedia.org/wiki/Sound_pressure#Sound_pressure_level) | SoundPressureLevel |
| Impulse Statistics (number of impulses, mean and variance of inter-impulse intervals) | ImpulseStats |
| [Symmetric Alpha Stable Statistics](https://en.wikipedia.org/wiki/Stable_distribution) (α and scale) | SymmetricAlphaStableStats |
| [Entropy](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0004065) (temporal entropy, spectral entropy and entropy index) | Entropy |
| [Zero Crossing Rate](https://en.wikipedia.org/wiki/Zero-crossing_rate) | ZeroCrossingRate |
| [Spectral Centroid](https://en.wikipedia.org/wiki/Spectral_centroid) | SpectralCentroid |
| [Spectral Flatness](https://en.wikipedia.org/wiki/Spectral_flatness) | SpectralFlatness |
| [Permutation Entropy](http://materias.df.uba.ar/mta2019v/files/2019/06/permutation_entropy1.pdf) | PermutationEntropy |
| [PSD](https://en.wikipedia.org/wiki/Spectral_density) | PSD |
| [Acoustic Complexity Index](https://www.sciencedirect.com/science/article/abs/pii/S1470160X10002037) | AcousticComplexityIndex |
| [Statistical Complexity](https://arxiv.org/abs/nlin/0205033) | StatisticalComplexity |
| [Acoustic Diversity Index](https://link.springer.com/article/10.1007/s10980-011-9636-9) | AcousticDiversityIndex |## Installation
```julia
using Pkg; pkg"add https://github.com/ymtoo/AcousticFeatures.jl.git"
```## Usage
```julia
using AcousticFeatures, DSP, SignalAnalysis, Plotsfunction 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
)
endN = 2400
fs = 2400
v = randn(Float64, 3*N)
s = real(chirp(500, 1000, 1.0, fs))
x = copy(v);
x[N:2*N-1] += sspecgram(signal(x,fs); fs=fs,nfft=128)
```

```julia
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)
```

```julia
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] += sspecgram(signal(x,fs); nfft=128, fs=fs)
```

```julia
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)
```
