add_specs

ketos.audio.spectrogram.add_specs(a, b, offset=0, scale=1, make_copy=False)[source]

Place two spectrograms on top of one another by adding their pixel values.

The spectrograms must be of the same type, and share the same time resolution.

The spectrograms must have consistent frequency axes. For linear frequency axes, this implies having the same resolution; for logarithmic axes with base 2, this implies having the same number of bins per octave minimum values that differ by a factor of 2^{n/m} where m is the number of bins per octave and n is any integer. No check is made for the consistency of the frequency axes.

Note that the attributes filename, offset, and label of spectrogram b is being added are lost.

The sum spectrogram has the same dimensions (time x frequency) as spectrogram a.

Args:
a: Spectrogram

Spectrogram

b: Spectrogram

Spectrogram to be added

offset: float

Shift spectrogram b by this many seconds relative to spectrogram a.

scale: float

Scaling factor applied to signal that is added

make_copy: bool

Make copies of both spectrograms, leaving the orignal instances unchanged by the addition operation.

Returns:
ab: Spectrogram

Sum spectrogram