smst.models.sine module

Functions that implement analysis and synthesis of sounds using the Sinusoidal Model.

smst.models.sine.clean_sinusoid_tracks(track_freqs, min_frames=3)

Deletes short fragments of a collection of sinusoidal tracks.

Parameters:
  • track_freqs – frequencies of sinusoidal tracks
  • min_frames – minimum duration of a track (in number of frames)
Returns:

cleaned frequencies of tracks

smst.models.sine.create_synth_window(N, H)
smst.models.sine.from_audio(x, fs, w, N, H, t, maxnSines=100, minSineDur=0.01, freqDevOffset=20, freqDevSlope=0.01)

Analyzes a sound using the sinusoidal model with sine tracking.

Parameters:
  • x – input array sound
  • w – analysis window
  • N – size of complex spectrum
  • H – hop-size
  • t – threshold in negative dB
  • maxnSines – maximum number of sines per frame
  • minSineDur – minimum duration of sines in seconds
  • freqDevOffset – minimum frequency deviation at 0Hz
  • freqDevSlope – slope increase of minimum frequency deviation
Returns:

xtfreq, xtmag, xtphase: frequencies, magnitudes and phases of sinusoidal tracks

smst.models.sine.scale_frequencies(sfreq, freqScaling)

Scales sinusoidal tracks in frequency.

Parameters:
  • sfreq – frequencies of input sinusoidal tracks
  • freqScaling – scaling factors, in time-value pairs (value of 1 is no scaling)
Returns:

ysfreq: frequencies of output sinusoidal tracks

smst.models.sine.scale_time(sfreq, smag, timeScaling)

Scales sinusoidal tracks in time.

Parameters:
  • sfreq – frequencies of input sinusoidal tracks
  • smag – magnitudes of input sinusoidal tracks
  • timeScaling – scaling factors, in time-value pairs
Returns:

ysfreq, ysmag: frequencies and magnitudes of output sinusoidal tracks

smst.models.sine.to_audio(tfreq, tmag, tphase, N, H, fs)

Synthesizes a sound using the sinusoidal model.

Parameters:
  • tfreq – frequencies of sinusoids
  • tmag – magnitudes of sinusoids
  • tphase – phases of sinusoids
  • N – synthesis FFT size
  • H – hop size
  • fs – sampling rate
Returns:

y: output array sound

smst.models.sine.track_sinusoids(pfreq, pmag, pphase, tfreq, freqDevOffset=20, freqDevSlope=0.01)

Tracks sinusoids from one frame to the next.

Parameters:
  • pfreq – frequencies of current frame
  • pmag – magnitude of current frame
  • pphase – phases of current frame
  • tfreq – frequencies of incoming tracks from previous frame
  • freqDevOffset – minimum frequency deviation at 0Hz
  • freqDevSlope – slope increase of minimum frequency deviation
Returns:

tfreqn, tmagn, tphasen: frequency, magnitude and phase of tracks