mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
2
setup.py
2
setup.py
@@ -14,7 +14,7 @@ __license__ = 'MIT License'
|
|||||||
|
|
||||||
# Default project values.
|
# Default project values.
|
||||||
project_name = 'spleeter'
|
project_name = 'spleeter'
|
||||||
project_version = '1.5.0'
|
project_version = '1.5.1'
|
||||||
tensorflow_dependency = 'tensorflow'
|
tensorflow_dependency = 'tensorflow'
|
||||||
tensorflow_version = '1.15.2'
|
tensorflow_version = '1.15.2'
|
||||||
here = path.abspath(path.dirname(__file__))
|
here = path.abspath(path.dirname(__file__))
|
||||||
|
|||||||
@@ -201,10 +201,9 @@ class Separator(object):
|
|||||||
descriptor would be a file path.
|
descriptor would be a file path.
|
||||||
:param destination: Target directory to write output to.
|
:param destination: Target directory to write output to.
|
||||||
:param audio_adapter: (Optional) Audio adapter to use for I/O.
|
:param audio_adapter: (Optional) Audio adapter to use for I/O.
|
||||||
:param chunk_duration: (Optional) Maximum signal duration that is processed
|
|
||||||
in one pass. Default: all signal.
|
|
||||||
:param offset: (Optional) Offset of loaded song.
|
:param offset: (Optional) Offset of loaded song.
|
||||||
:param duration: (Optional) Duration of loaded song.
|
:param duration: (Optional) Duration of loaded song (default:
|
||||||
|
600s).
|
||||||
:param codec: (Optional) Export codec.
|
:param codec: (Optional) Export codec.
|
||||||
:param bitrate: (Optional) Export bitrate.
|
:param bitrate: (Optional) Export bitrate.
|
||||||
:param filename_format: (Optional) Filename format.
|
:param filename_format: (Optional) Filename format.
|
||||||
@@ -216,11 +215,36 @@ class Separator(object):
|
|||||||
duration=duration,
|
duration=duration,
|
||||||
sample_rate=self._sample_rate)
|
sample_rate=self._sample_rate)
|
||||||
sources = self.separate(waveform, audio_descriptor)
|
sources = self.separate(waveform, audio_descriptor)
|
||||||
self._save_to_file(sources, audio_descriptor, destination, filename_format, codec,
|
self.save_to_file( sources, audio_descriptor, destination,
|
||||||
audio_adapter, bitrate, synchronous)
|
filename_format, codec, audio_adapter,
|
||||||
|
bitrate, synchronous)
|
||||||
|
|
||||||
|
def save_to_file(
|
||||||
|
self, sources, audio_descriptor, destination,
|
||||||
|
filename_format='{filename}/{instrument}.{codec}',
|
||||||
|
codec='wav', audio_adapter=get_default_audio_adapter(),
|
||||||
|
bitrate='128k', synchronous=True):
|
||||||
|
""" export dictionary of sources to files.
|
||||||
|
|
||||||
|
:param sources: Dictionary of sources to be exported. The
|
||||||
|
keys are the name of the instruments, and
|
||||||
|
the values are Nx2 numpy arrays containing
|
||||||
|
the corresponding intrument waveform, as
|
||||||
|
returned by the separate method
|
||||||
|
:param audio_descriptor: Describe song to separate, used by audio
|
||||||
|
adapter to retrieve and load audio data,
|
||||||
|
in case of file based audio adapter, such
|
||||||
|
descriptor would be a file path.
|
||||||
|
:param destination: Target directory to write output to.
|
||||||
|
:param filename_format: (Optional) Filename format.
|
||||||
|
:param codec: (Optional) Export codec.
|
||||||
|
:param audio_adapter: (Optional) Audio adapter to use for I/O.
|
||||||
|
:param bitrate: (Optional) Export bitrate.
|
||||||
|
:param synchronous: (Optional) True is should by synchronous.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def _save_to_file(self, sources, audio_descriptor, destination, filename_format, codec,
|
|
||||||
audio_adapter, bitrate, synchronous):
|
|
||||||
filename = splitext(basename(audio_descriptor))[0]
|
filename = splitext(basename(audio_descriptor))[0]
|
||||||
generated = []
|
generated = []
|
||||||
for instrument, data in sources.items():
|
for instrument, data in sources.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user