Spectral Processing

Components for processing frequency-domain blocks.

class tiliqua.dsp.spectral.SpectralCrossSynthesis(*args, src_loc_at=0, **kwargs)

Apply the spectral envelope of ‘modulator’ on a ‘carrier’.

Consume 2 sets of frequency-domain spectra (blocks) representing a ‘carrier’ and ‘modulator’. The (real) envelope of the ‘modulator’ spectra is multiplied by the (complex) ‘carrier’ spectra, creating a classic vocoder effect where the timbre of the ‘carrier’ dominates, but is filtered spectrally by the ‘modulator’

This core computes the spectral envelope of the modulator by filtering the magnitude of each frequency band, see SpectralEnvelope for details. Put simply, this core computes:

out.real = carrier.real * modulator.envelope_magnitude
out.imag = carrier.imag * modulator.envelope_magnitude
Members:
  • i_carrier (In(stream.Signature(Block(CQ(self.shape))))) – Incoming stream of blocks of complex spectra of the ‘carrier’.

  • i_modulator (In(stream.Signature(Block(CQ(self.shape))))) – Incoming stream of blocks of complex spectra of the ‘modulator’.

  • o (Out(stream.Signature(Block(CQ(self.shape))))) – Outgoing stream of cross-synthesized ‘carrier’ and ‘modulator’.

__init__(shape, sz)
shapeShape

Shape of fixed-point number to use for block streams.

szint

Size of each block of complex spectra.

class tiliqua.dsp.spectral.SpectralEnvelope(*args, src_loc_at=0, **kwargs)

Compute a smoothed, real spectral envelope.

Given a block of complex frequency-domain spectra, extract the magnitude from each point and filter each magnitude in the block independently with a one-pole smoother, emitting a corresponding block representing the evolving (smoothed) spectral envelope.

The rect-to-polar CORDIC is run without magnitude correction, which saves another multiplier at the cost of everything being multiplied by a constant factor (may or may not matter depending on the use).

Members:
  • i (In(stream.Signature(Block(CQ(self.shape))))) – Incoming stream of blocks of complex spectra.

  • o (Out(stream.Signature(Block(self.shape)))) – Outgoing stream of blocks of real (smoothed) magnitude spectra.

__init__(shape, sz)
shapeShape

Shape of fixed-point number to use for streams.

szint

The size of each input block and outgoing spectral envelope blocks.