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

The frame period in samples, \(P\).

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

The type of voiced region.

unvoiced_region[‘zeros’, ‘gauss’]

The type of unvoiced region.

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

The polarity.

init_phase[‘zeros’, ‘random’]

The initial phase.

forward(p)[source]#

Generate a simple excitation signal.

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

The pitch in seconds.

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

The 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)]

The pitch in seconds.

frame_periodint >= 1

The frame period in samples, \(P\).

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

The type of voiced region.

unvoiced_region[‘zeros’, ‘gauss’]

The type of unvoiced region.

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

The polarity.

init_phase[‘zeros’, ‘random’]

The initial phase.

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

The excitation signal.

See also

pitch