Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autosimilarity_segmentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MARMORET Axel
autosimilarity_segmentation
Commits
a2d4f102
Commit
a2d4f102
authored
11 months ago
by
MARMORET Axel
Browse files
Options
Downloads
Patches
Plain Diff
Forgot to add the script in the modified files. Updating accordingly the setup for pypi
parent
6ecd9f05
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
as_seg/scripts/overall_scripts.py
+15
-15
15 additions, 15 deletions
as_seg/scripts/overall_scripts.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
16 additions
and
16 deletions
as_seg/scripts/overall_scripts.py
+
15
−
15
View file @
a2d4f102
...
...
@@ -16,7 +16,7 @@ import numpy as np
import
as_seg.data_manipulation
as
dm
import
as_seg.barwise_input
as
bi
import
as_seg.model.
features
as
features
import
as_seg.model.
signal_to_spectrogram
as
signal_to_spectrogram
import
as_seg.model.errors
as
err
import
as_seg.scripts.default_path
as
paths
...
...
@@ -302,32 +302,32 @@ def load_or_save_spectrogram(dataset, song_path, feature, hop_length, fmin = 98,
except
FileNotFoundError
:
if
"
log_mel_grill
"
in
feature
:
mel
=
load_or_save_spectrogram
(
dataset
,
song_path
,
"
mel_grill
"
,
hop_length
,
fmin
=
fmin
,
n_fft
=
n_fft
,
n_mfcc
=
n_mfcc
)
return
features
.
get_log_mel_from_mel
(
mel
,
feature
)
return
signal_to_spectrogram
.
get_log_mel_from_mel
(
mel
,
feature
)
elif
feature
==
"
mel
"
or
feature
==
"
log_mel
"
or
feature
==
"
logmel
"
:
raise
err
.
InvalidArgumentValueException
(
f
"
Invalid mel parameter (
{
feature
}
), are
'
t you looking for mel_grill?
"
)
else
:
the_signal
,
_
=
librosa
.
load
(
song_path
,
sr
=
44100
)
if
"
stft
"
in
feature
:
if
"
nfft
"
not
in
feature
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft
)
else
:
n_fft_arg
=
int
(
feature
.
split
(
"
nfft
"
)[
1
])
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft_arg
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft_arg
)
elif
"
mfcc
"
in
feature
:
if
"
nmfcc
"
not
in
feature
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc
)
else
:
n_mfcc_arg
=
int
(
feature
.
split
(
"
nmfcc
"
)[
1
])
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc_arg
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc_arg
)
elif
feature
==
"
pcp_tonnetz
"
:
# If chromas are already computed, try to load them instead of recomputing them.
chromas
=
load_or_save_spectrogram
(
dataset
,
song_path
,
"
pcp
"
,
hop_length
,
fmin
=
fmin
)
spectrogram
=
librosa
.
feature
.
tonnetz
(
y
=
None
,
sr
=
None
,
chroma
=
chromas
)
elif
feature
==
"
pcp
"
:
# If it wasn't pcp_tonnetz, compute the spectrogram, and then save it.
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
,
fmin
=
fmin
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
,
fmin
=
fmin
)
else
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
)
name_spectrogram
=
format_name_spectrogram_params
(
song_name
,
feature
,
hop_length
,
fmin
,
n_fft
,
n_mfcc
)
np
.
save
(
f
"
{
paths
.
path_data_persisted
}
/
{
dataset
}
/spectrograms/
{
name_spectrogram
}
"
,
spectrogram
)
...
...
@@ -535,7 +535,7 @@ def load_mirex10_annot_song_RWC(song_number):
Loads the MIREX10 annotations for this song.
"""
annotations_mirex
=
f
"
{
paths
.
path_annotation_rwcpop
}
/MIREX10
"
annot_path_mirex
=
"
{
}/{}
"
.
format
(
annotations_mirex
,
dm
.
get_annotation_name_from_song
(
song_number
,
"
MIREX10
"
))
annot_path_mirex
=
f
"
{
annotations_mirex
}
/
{
dm
.
get_annotation_name_from_song
(
song_number
,
'
MIREX10
'
)
}
"
annotations
=
dm
.
get_segmentation_from_txt
(
annot_path_mirex
,
"
MIREX10
"
)
references_segments
=
np
.
array
(
annotations
)[:,
0
:
2
]
return
references_segments
...
...
@@ -622,18 +622,18 @@ def load_or_save_tensor_spectrogram(dataset, song_path, feature, hop_length, sub
raise
NotImplementedError
(
"
Do not compute please
"
)
if
"
stft
"
in
feature
and
"
nfft
"
in
feature
:
if
"
nfft
"
not
in
feature
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft
)
else
:
n_fft_arg
=
int
(
feature
.
split
(
"
nfft
"
)[
1
])
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft_arg
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
stft
"
,
hop_length
,
n_fft
=
n_fft_arg
)
elif
"
mfcc
"
in
feature
:
if
"
nmfcc
"
not
in
feature
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc
)
else
:
n_mfcc_arg
=
int
(
feature
.
split
(
"
nmfcc
"
)[
1
])
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc_arg
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
"
mfcc
"
,
hop_length
,
n_mfcc
=
n_mfcc_arg
)
else
:
spectrogram
=
features
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
,
fmin
=
fmin
)
spectrogram
=
signal_to_spectrogram
.
get_spectrogram
(
the_signal
,
44100
,
feature
,
hop_length
,
fmin
=
fmin
)
hop_length_seconds
=
hop_length
/
44100
bars
=
load_or_save_bars
(
persisted_path
,
song_path
)
...
...
@@ -650,7 +650,7 @@ def load_or_save_pcp_msaf(dataset, song_path, hop_length):
except
FileNotFoundError
:
signal
,
sr
=
librosa
.
load
(
song_path
,
sr
=
44100
)
duration
=
len
(
signal
)
/
float
(
sr
)
pcp
,
frame_times
=
features
.
get_pcp_as_msaf
(
signal
,
sr
,
hop_length
)
pcp
,
frame_times
=
signal_to_spectrogram
.
get_pcp_as_msaf
(
signal
,
sr
,
hop_length
)
np
.
save
(
f
"
{
paths
.
path_data_persisted
}
/
{
dataset
}
/pcp_msaf/
{
song_name
}
_hop
{
hop_length
}
"
,
(
pcp
,
frame_times
,
duration
))
return
pcp
,
frame_times
,
duration
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
a2d4f102
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"
as_seg
"
,
version
=
"
0.1.
6
"
,
version
=
"
0.1.
7
"
,
author
=
"
Marmoret Axel
"
,
author_email
=
"
axel.marmoret@imt-atlantique.fr
"
,
description
=
"
Package for the segmentation of autosimilarity matrices. This version is related to a stable vesion on PyPi, for installation in MSAF.
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment