|
|
@@ -45,7 +45,7 @@ class AudioSegment(object):
|
|
|
duration=0, trim=False, trim_db=60):
|
|
|
"""Create audio segment from samples.
|
|
|
|
|
|
- Samples are convert float32 internally, with int scaled to [-1, 1].
|
|
|
+ Samples are converted to float32 internally, with int scaled to [-1, 1].
|
|
|
Load a file supported by librosa and return as an AudioSegment.
|
|
|
:param filename: path of file to load
|
|
|
:param target_sr: the desired sample rate
|
|
|
@@ -67,10 +67,11 @@ class AudioSegment(object):
|
|
|
|
|
|
samples = self._convert_samples_to_float32(samples)
|
|
|
if target_sr is not None and target_sr != sample_rate:
|
|
|
- samples = librosa.core.resample(samples, sample_rate, target_sr)
|
|
|
+ samples = librosa.resample(samples, orig_sr=sample_rate,
|
|
|
+ target_sr=target_sr)
|
|
|
sample_rate = target_sr
|
|
|
if trim:
|
|
|
- samples, _ = librosa.effects.trim(samples, trim_db)
|
|
|
+ samples, _ = librosa.effects.trim(samples, top_db=trim_db)
|
|
|
self._samples = samples
|
|
|
self._sample_rate = sample_rate
|
|
|
if self._samples.ndim >= 2:
|