Skip to content

Commit

Permalink
Enable other types of amplitude resampling besides windowed.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 362970612
  • Loading branch information
jesseengel authored and Magenta Team committed Mar 15, 2021
1 parent 0f35be7 commit 836fe59
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion ddsp/synths.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,28 @@ def __init__(self,
sample_rate=16000,
scale_fn=core.exp_sigmoid,
normalize_below_nyquist=True,
amp_resample_method='window',
name='harmonic'):
"""Constructor.
Args:
n_samples: Fixed length of output audio.
sample_rate: Samples per a second.
scale_fn: Scale function for amplitude and harmonic distribution inputs.
normalize_below_nyquist: Remove harmonics above the nyquist frequency
and normalize the remaining harmonic distribution to sum to 1.0.
amp_resample_method: Mode with which to resample amplitude envelopes.
Must be in ['nearest', 'linear', 'cubic', 'window']. 'window' uses
overlapping windows (only for upsampling) which is smoother
for amplitude envelopes with large frame sizes.
name: Synth name.
"""
super().__init__(name=name)
self.n_samples = n_samples
self.sample_rate = sample_rate
self.scale_fn = scale_fn
self.normalize_below_nyquist = normalize_below_nyquist
self.amp_resample_method = amp_resample_method

def get_controls(self,
amplitudes,
Expand Down Expand Up @@ -128,7 +144,8 @@ def get_signal(self, amplitudes, harmonic_distribution, f0_hz):
amplitudes=amplitudes,
harmonic_distribution=harmonic_distribution,
n_samples=self.n_samples,
sample_rate=self.sample_rate)
sample_rate=self.sample_rate,
amp_resample_method=self.amp_resample_method)
return signal


Expand Down
2 changes: 1 addition & 1 deletion ddsp/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
pulling in all the dependencies in __init__.py.
"""

__version__ = '1.0.2'
__version__ = '1.1.0'

0 comments on commit 836fe59

Please sign in to comment.