Skip to content

Commit

Permalink
bug fixes, added :kdd2 profile
Browse files Browse the repository at this point in the history
  • Loading branch information
PasoStudio73 committed May 1, 2024
1 parent 2115c90 commit 3ad8bbc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
26 changes: 24 additions & 2 deletions src/signalDataStructure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ mutable struct AudioObj
get_f0!(self.setup, self.data)
end

return self.data.fft
return self.data.f0
end

# --------------------------------------------------------------------------- #
Expand Down Expand Up @@ -429,6 +429,7 @@ mutable struct AudioObj
# --------------------------------------------------------------------------- #
# Gio Paglia #
# --------------------------------------------------------------------------- #

elseif profile == :kdd
if isempty(self.data.fft)
get_fft!(self.setup, self.data)
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/features_extraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3ad8bbc

Please sign in to comment.