Skip to content

Commit

Permalink
Merge pull request #282 from alreadytaikeune/librosa_backend
Browse files Browse the repository at this point in the history
Librosa backend
  • Loading branch information
alreadytaikeune authored Mar 20, 2020
2 parents 6b713ed + 6539bf7 commit 243b323
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 99 deletions.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ importlib_resources; python_version<'3.7'
requests
setuptools>=41.0.0
pandas==0.25.1
tensorflow==1.14.0
tensorflow==1.15.0
ffmpeg-python
norbert==0.2.1
norbert==0.2.1
librosa==0.7.2
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

# Default project values.
project_name = 'spleeter'
project_version = '1.4.9'
project_version = '1.5.0'
tensorflow_dependency = 'tensorflow'
tensorflow_version = '1.14.0'
tensorflow_version = '1.15.0'
here = path.abspath(path.dirname(__file__))
readme_path = path.join(here, 'README.md')
with open(readme_path, 'r') as stream:
Expand Down Expand Up @@ -56,6 +56,7 @@
'pandas==0.25.1',
'requests',
'setuptools>=41.0.0',
'librosa==0.7.2',
'{}=={}'.format(tensorflow_dependency, tensorflow_version),
],
extras_require={
Expand Down
16 changes: 15 additions & 1 deletion spleeter/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
""" This modules provides spleeter command as well as CLI parsing methods. """

import json

import logging
from argparse import ArgumentParser
from tempfile import gettempdir
from os.path import exists, join
Expand All @@ -13,6 +13,8 @@
__author__ = 'Deezer Research'
__license__ = 'MIT License'



# -i opt specification (separate).
OPT_INPUT = {
'dest': 'inputs',
Expand Down Expand Up @@ -68,6 +70,17 @@
'the input file)')
}

# -w opt specification (separate)
OPT_STFT_BACKEND = {
'dest': 'stft_backend',
'type': str,
'choices' : ["tensorflow", "librosa", "auto"],
'default': "auto",
'help': 'Who should be in charge of computing the stfts. Librosa is faster than tensorflow on CPU and uses'
' less memory. "auto" will use tensorflow when GPU acceleration is available and librosa when not.'
}


# -c opt specification (separate).
OPT_CODEC = {
'dest': 'codec',
Expand Down Expand Up @@ -176,6 +189,7 @@ def _create_separate_parser(parser_factory):
parser.add_argument('-c', '--codec', **OPT_CODEC)
parser.add_argument('-b', '--birate', **OPT_BITRATE)
parser.add_argument('-m', '--mwf', **OPT_MWF)
parser.add_argument('-B', '--stft-backend', **OPT_STFT_BACKEND)
return parser


Expand Down
4 changes: 3 additions & 1 deletion spleeter/commands/separate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
__license__ = 'MIT License'



def entrypoint(arguments, params):
""" Command entrypoint.
Expand All @@ -29,7 +30,8 @@ def entrypoint(arguments, params):
audio_adapter = get_audio_adapter(arguments.audio_adapter)
separator = Separator(
arguments.configuration,
arguments.MWF)
MWF=arguments.MWF,
stft_backend=arguments.stft_backend)
for filename in arguments.inputs:
separator.separate_to_file(
filename,
Expand Down
Loading

0 comments on commit 243b323

Please sign in to comment.