From 3ad8bbcae89ae4d63465b0875b409ac3a4a0c7d4 Mon Sep 17 00:00:00 2001 From: paso Date: Thu, 2 May 2024 00:25:18 +0200 Subject: [PATCH] bug fixes, added :kdd2 profile --- src/signalDataStructure.jl | 26 ++++++++++++++++++++++++-- test/features_extraction.jl | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/signalDataStructure.jl b/src/signalDataStructure.jl index 9e2e7e3..d53663f 100644 --- a/src/signalDataStructure.jl +++ b/src/signalDataStructure.jl @@ -200,7 +200,7 @@ mutable struct AudioObj get_f0!(self.setup, self.data) end - return self.data.fft + return self.data.f0 end # --------------------------------------------------------------------------- # @@ -429,6 +429,7 @@ mutable struct AudioObj # --------------------------------------------------------------------------- # # Gio Paglia # # --------------------------------------------------------------------------- # + elseif profile == :kdd if isempty(self.data.fft) get_fft!(self.setup, self.data) @@ -447,7 +448,7 @@ mutable struct AudioObj # get_spectrals!(self.setup, self.data) # end if isempty(self.data.f0) - self.setup.f0_range = (200, 700), + self.setup.f0_range = (200, 700) get_f0!(self.setup, self.data) end @@ -471,6 +472,27 @@ mutable struct AudioObj self.data.f0, )..., ) + elseif profile == :kdd2 + if isempty(self.data.fft) + get_fft!(self.setup, self.data) + end + if isempty(self.data.mel_spectrogram) + get_mel_spec!(self.setup, self.data) + end + if isempty(self.data.log_mel) + get_log_mel!(self.setup, self.data) + end + if isempty(self.data.f0) + self.setup.f0_range = (200, 700) + get_f0!(self.setup, self.data) + end + + return hcat( + ( + self.data.log_mel, + self.data.f0, + )..., + ) else @error("Unknown $profile profile.") end diff --git a/test/features_extraction.jl b/test/features_extraction.jl index da560b1..c5cbd26 100644 --- a/test/features_extraction.jl +++ b/test/features_extraction.jl @@ -86,7 +86,7 @@ custom_1 = get_features(x, sr, fft_length = 1024, spectral_spectrum = :mel, freq # usage example 2: object style # # -------------------------------------------------------------------------- # -audio = audio_features_obj(x, sr) +audio = audio_features_obj(x, sr, f0_range = (50,700)) audio.get_fft() audio.get_lin_spec()