excite#

class diffsptk.ExcitationGeneration(frame_period, *, voiced_region='pulse', unvoiced_region='gauss', polarity='auto', init_phase='zeros')[source]#

See this page for details.

Parameters:
frame_periodint >= 1

Frame period in samples, \(P\).

voiced_region[‘pulse’, ‘sinusoidal’, ‘sawtooth’, ‘inverted-sawtooth’, ‘triangle’, ‘square’]

Value on voiced region.

unvoiced_region[‘zeros’, ‘gauss’]

Value on unvoiced region.

polarity[‘auto’, ‘unipolar’, ‘bipolar’]

Polarity.

init_phase[‘zeros’, ‘random’]

Initial phase.

forward(p)[source]#

Generate a simple excitation signal.

Parameters:
pTensor [shape=(…, N)]

Pitch in seconds.

Returns:
outTensor [shape=(…, NxP)]

Excitation signal.

Examples

>>> p = torch.tensor([2.0, 3.0])
>>> excite = diffsptk.ExcitationGeneration(3)
>>> e = excite(p)
>>> e
tensor([1.4142, 0.0000, 1.6330, 0.0000, 0.0000, 1.7321])
diffsptk.functional.excite(p, frame_period=80, *, voiced_region='pulse', unvoiced_region='gauss', polarity='auto', init_phase='zeros')[source]#

Generate a simple excitation signal.

Parameters:
pTensor [shape=(…, N)]

Pitch in seconds.

frame_periodint >= 1

Frame period in samples, \(P\).

voiced_region[‘pulse’, ‘sinusoidal’, ‘sawtooth’, ‘inverted-sawtooth’, ‘triangle’, ‘square’]

Value on voiced region.

unvoiced_region[‘gauss’, ‘zeros’]

Value on unvoiced region.

polarity[‘auto’, ‘unipolar’, ‘bipolar’]

Polarity.

init_phase[‘zeros’, ‘random’]

Initial phase.

Returns:
outTensor [shape=(…, NxP)]

Excitation signal.

See also

pitch