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
150531d6
Commit
150531d6
authored
11 months ago
by
MARMORET Axel
Browse files
Options
Downloads
Patches
Plain Diff
Removing an old behavior which consisted in artificially adding info to the bars.
parent
b8360315
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
as_seg/data_manipulation.py
+3
-11
3 additions, 11 deletions
as_seg/data_manipulation.py
with
3 additions
and
11 deletions
as_seg/data_manipulation.py
+
3
−
11
View file @
150531d6
...
@@ -49,22 +49,14 @@ def get_bars_from_audio(song_path):
...
@@ -49,22 +49,14 @@ def get_bars_from_audio(song_path):
act
=
dbt
.
RNNDownBeatProcessor
()(
song_path
)
act
=
dbt
.
RNNDownBeatProcessor
()(
song_path
)
proc
=
dbt
.
DBNDownBeatTrackingProcessor
(
beats_per_bar
=
[
3
,
4
],
fps
=
100
)
proc
=
dbt
.
DBNDownBeatTrackingProcessor
(
beats_per_bar
=
[
3
,
4
],
fps
=
100
)
song_beats
=
proc
(
act
)
song_beats
=
proc
(
act
)
downbeats_times
=
[]
downbeats_times
=
[
song_beats
[
0
][
0
]
]
if
song_beats
[
0
][
1
]
!=
1
:
# Adding a first downbeat at the start of the song
for
beat
in
song_beats
[
1
:]:
# The first beat is already added
downbeats_times
.
append
(
0.1
)
for
beat
in
song_beats
:
if
beat
[
1
]
==
1
:
# If the beat is a downbeat
if
beat
[
1
]
==
1
:
# If the beat is a downbeat
downbeats_times
.
append
(
beat
[
0
])
downbeats_times
.
append
(
beat
[
0
])
# The following block of code artificially adds bars to the end of the song, in order to span the total song length.
# It seems like a good idea initially but may be detrimental, and should be debated anyway.
average_bar_length
=
np
.
mean
([
downbeats_times
[
i
+
1
]
-
downbeats_times
[
i
]
for
i
in
range
(
len
(
downbeats_times
)
-
1
)])
# average bar length in the song
song_length
=
act
.
shape
[
0
]
/
100
# Total length of the song
song_length
=
act
.
shape
[
0
]
/
100
# Total length of the song
while
downbeats_times
[
-
1
]
+
1.1
*
average_bar_length
<
song_length
:
# As long as the bar estimation does not cover the entire song
downbeats_times
.
append
(
round
(
downbeats_times
[
-
1
]
+
average_bar_length
,
2
))
# artifically adds bars of the length of the average bar length in the song
downbeats_times
.
append
(
song_length
)
# adding the last downbeat
downbeats_times
.
append
(
song_length
)
# adding the last downbeat
return
frontiers_to_segments
(
downbeats_times
)
return
frontiers_to_segments
(
downbeats_times
)
def
get_beats_from_audio_msaf
(
signal
,
sr
,
hop_length
):
def
get_beats_from_audio_msaf
(
signal
,
sr
,
hop_length
):
...
@@ -91,8 +83,8 @@ def get_beats_from_audio_madmom(song_path):
...
@@ -91,8 +83,8 @@ def get_beats_from_audio_madmom(song_path):
act
=
bt
.
TCNBeatProcessor
()(
song_path
)
act
=
bt
.
TCNBeatProcessor
()(
song_path
)
proc
=
bt
.
BeatTrackingProcessor
(
fps
=
100
)
proc
=
bt
.
BeatTrackingProcessor
(
fps
=
100
)
song_beats
=
proc
(
act
)
song_beats
=
proc
(
act
)
beats_times
=
[]
# beats_times = []
# if song_beats[0][1] != 1: # Adding a first downbeat at the start of the song
# if song_beats[0][1] != 1: # Adding a first downbeat at the start of the song
# beats_times.append(0.1)
# beats_times.append(0.1)
# for beat in song_beats:
# for beat in song_beats:
...
...
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