Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Quentin Aristote
Soundscapes
Commits
ef0981f9
Commit
ef0981f9
authored
Dec 13, 2019
by
Quentin Aristote
Browse files
added option to ignore files
parent
4ea9f847
Changes
1
Hide whitespace changes
Inline
Side-by-side
data/get_spectrograms.py
View file @
ef0981f9
...
...
@@ -41,7 +41,8 @@ def soundToSpectrogram(path, sample_rate = 16000, duration = 30) :
def
getSpectrograms
(
dir_source
,
dir_target
,
sample_rate
=
16000
,
overwrite
=
False
,
duration
=
30
)
:
duration
=
30
,
to_ignore
=
set
())
:
r
"""Compute the Mel spectrograms of all the sound files and write them to memory.
Args :
...
...
@@ -49,7 +50,8 @@ def getSpectrograms(dir_source, dir_target,
dir_target (str) : the directory to save the the spectrograms to.
sample_rate (int, optional) : the sample rate in Hz to use when getting the spectrogram. Default : 16000 Hz
overwrite (bool, optional) : whether to compute all spectrograms again. Default : False
duration (int, optional) : the number of seconds the recording should last. Default : 30s"""
duration (int, optional) : the number of seconds the recording should last. Default : 30s
to_ignore (set, optional) : the set of titles of recordings that should not be downloaded."""
for
filename
in
os
.
listdir
(
dir_source
)
:
title
,
_
=
os
.
path
.
splitext
(
filename
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment