API ReferenceΒΆ
The signal_builder module implement the SignalBuilder class used in
create to produce an audio sample by additive synthesis. It basically
approximates the analytical signal by summing the Fourier series for each
component given as input (when triangle, sawtooth, or square is
specified as shape parameter), and finally sum together all components. To save
the audio on file, call its export(filename) method.
The signal_plotter module implement the SignalPlotter class used in view
to: plot the signal itself, its Frequency Spectrum and the Spectrogram.
The class takes as input the audio file path as it is a subclass of the base class
Signal, which loads the audio, calculate envelopes and spectra directly in the constructor.
To retrieve the audio information, assuming s is a Signal instance:
s.CHANNELSis adictholding the audio signal as an array accessible via the'ch1'(and'ch2'if stereo) keys.s.ENVELOPESis adictholding the signal envelop calculated via thehilbertmethod inscipy.signalaccessible via the'ch1_envelope'(and'ch2_envelope'if stereo) keys.s.SPECTRAis adictholding the spectral information accessible via the'ch1_fft'(and'ch2_fft'if stereo) keys, which in turn returns anotherdictwith the'freqs'and'pws'(respectively defined as class constantss.FREQUENCIESands.POWERS) keys. So to get the power spectrum information for the first channel:s.SPECTRA['ch1_fft'][s.POWERS]ands.SPECTRA['ch1_fft'][s.FREQUENCIES].