espnet2.gan_svs.uhifigan.sine_generator.SineGen
espnet2.gan_svs.uhifigan.sine_generator.SineGen
class espnet2.gan_svs.uhifigan.sine_generator.SineGen(sample_rate, harmonic_num=0, sine_amp=0.1, noise_std=0.003, voiced_threshold=0, flag_for_pulse=False)
Bases: Module
Definition of sine generator
SineGen(samp_rate, harmonic_num = 0, : sine_amp = 0.1, noise_std = 0.003, voiced_threshold = 0, flag_for_pulse=False)
sample_rate: sampling rate in Hz harmonic_num: number of harmonic overtones (default 0) sine_amp: amplitude of sine-wavefrom (default 0.1) noise_std: std of Gaussian noise (default 0.003) voiced_thoreshold: F0 threshold for U/V classification (default 0) flag_for_pulse: this SinGen is used inside PulseGen (default False)
Note: when flag_for_pulse is True, the first time step of a voiced : segment is always sin(np.pi) or cos(0)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(f0)
Forward SineGen.
sine_tensor, uv = forward(f0) input F0: tensor(batchsize=1, length, dim=1)
f0 for unvoiced steps should be 0
output sine_tensor: tensor(batchsize=1, length, dim) output uv: tensor(batchsize=1, length, 1)