separateLeadFunctions

separateLeadFunctions.py

Description

This module provides functions that are useful for the SeparateLeadStereo modules, essentially time-frequency transformations (and inverse), as well as generation of dictionary matrices.

Usage

See each function docstring for more information.

TODO: expend this? TODO: move all these functions in different modules, in pyfasst.tools for instance

License

Copyright (C) 2011-2013 Jean-Louis Durrieu

pyfasst.SeparateLeadStereo.separateLeadFunctions.generateHannBasis(numberFrequencyBins, sizeOfFourier, Fs, frequencyScale='linear', numberOfBasis=20, overlap=0.75)[source]

Generates a collection of Hann functions, spaced across the frequency axis, as desired by the user (and if implemented), targetting the given number of basis and adapting the extent (or bandwidth) of each function (over the frequencies) to that number and according to the desired overlap between these windows.

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_ODGD_spec(F0, Fs, lengthOdgd=2048, Nfft=2048, Ot=0.5, t0=0.0, analysisWindowType='sinebell')[source]

generateODGDspec:

generates a waveform ODGD and the corresponding spectrum, using as analysis window the -optional- window given as argument.

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_ODGD_spec_chirped(F1, F2, Fs, lengthOdgd=2048, Nfft=2048, Ot=0.5, t0=0.0, analysisWindowType='sinebell')[source]

generateODGDspecChirped:

generates a waveform ODGD and the corresponding spectrum, using as analysis window the -optional- window given as argument.

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_ODGD_spec_inharmo(F0, Fs, lengthOdgd=2048, Nfft=2048, Ot=0.5, t0=0.0, analysisWindowType='sinebell', inharmonicity=0.5)[source]

generateODGDspec:

generates a waveform ODGD and the corresponding spectrum, using as analysis window the -optional- window given as argument.

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_WF0_MinQT_chirped(minF0, maxF0, cqtfmax, cqtfmin, cqtbins=48.0, Fs=44100.0, Nfft=2048, stepNotes=4, lengthWindow=2048, Ot=0.5, perF0=1, depthChirpInSemiTone=0.5, loadWF0=True, analysisWindow='hanning', atomHopFactor=0.25, cqtWinFunc=<function hanning at 0x102315410>, verbose=False)[source]

Generates a ‘basis’ matrix for the source part WF0, using the source model KLGLOTT88, with the following I/O arguments:

Inputs:

Parameters:
  • minF0 – the minimum value for the fundamental frequency (F0)
  • maxF0 – the maximum value for F0
  • cqtfmax

    ...

  • Fs – the desired sampling rate
  • Nfft – the number of bins to compute the Fourier transform
  • stepNotes – the number of F0 per semitone
  • lengthWindow – the size of the window for the Fourier transform
  • Ot – the glottal opening coefficient for KLGLOTT88
  • perF0 – the number of chirps considered per F0 value
  • depthChirpInSemiTone – the maximum value, in semitone, of the allowed chirp per F0

Outputs:

Returns:
  • F0Table - the vector containing the values of the fundamental frequencies in Hertz (Hz) corresponding to the harmonic combs in WF0, i.e. the columns of WF0
  • WF0 - the basis matrix, where each column is a harmonic comb generated by KLGLOTT88 (with a sinusoidal model, then transformed into the spectral domain)

20120828T2358 Horribly slow...

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_WF0_NSGTMinQT_chirped(minF0, maxF0, cqtfmax, cqtfmin, cqtbins=48.0, Fs=44100.0, Nfft=2048, stepNotes=4, lengthWindow=2048, Ot=0.5, perF0=1, depthChirpInSemiTone=0.5, loadWF0=True, analysisWindow='hanning', atomHopFactor=0.25, cqtWinFunc=<function hanning at 0x102315410>, verbose=False)[source]
F0Table, WF0 = generate_WF0_MinCQT_chirped(minF0, maxF0, Fs, Nfft=2048,
    stepNotes=4, lengthWindow=2048,
    Ot=0.5, perF0=2,
    depthChirpInSemiTone=0.5)

Generates a ‘basis’ matrix for the source part WF0, using the source model KLGLOTT88, with the following I/O arguments:

Inputs:

Parameters:
  • minF0 – the minimum value for the fundamental frequency (F0)
  • maxF0 – the maximum value for F0
  • cqtfmax

    ...

  • Fs – the desired sampling rate
  • Nfft – the number of bins to compute the Fourier transform
  • stepNotes – the number of F0 per semitone
  • lengthWindow – the size of the window for the Fourier transform
  • Ot – the glottal opening coefficient for KLGLOTT88
  • perF0 – the number of chirps considered per F0 value
  • depthChirpInSemiTone – the maximum value, in semitone, of the allowed chirp per F0

Outputs:

Returns:
  • F0Table - the vector containing the values of the fundamental frequencies in Hertz (Hz) corresponding to the harmonic combs in WF0, i.e. the columns of WF0
  • WF0 - the basis matrix, where each column is a harmonic comb generated by KLGLOTT88 (with a sinusoidal model, then transformed into the spectral domain)

20120828T2358 Horribly slow...

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_WF0_TR_chirped(transform, minF0, maxF0, stepNotes=4, Ot=0.5, perF0=1, depthChirpInSemiTone=0.5, loadWF0=True, verbose=False)[source]

Generates a ‘basis’ matrix for the source part WF0, using the source model KLGLOTT88, with the following I/O arguments:

Inputs:

Parameters:
  • minF0 – the minimum value for the fundamental frequency (F0)
  • maxF0 – the maximum value for F0
  • cqtfmax

    ...

  • Fs – the desired sampling rate
  • Nfft – the number of bins to compute the Fourier transform
  • stepNotes – the number of F0 per semitone
  • lengthWindow – the size of the window for the Fourier transform
  • Ot – the glottal opening coefficient for KLGLOTT88
  • perF0 – the number of chirps considered per F0 value
  • depthChirpInSemiTone – the maximum value, in semitone, of the allowed chirp per F0

Outputs:

Returns:
  • F0Table - the vector containing the values of the fundamental frequencies in Hertz (Hz) corresponding to the harmonic combs in WF0, i.e. the columns of WF0
  • WF0 - the basis matrix, where each column is a harmonic comb generated by KLGLOTT88 (with a sinusoidal model, then transformed into the spectral domain)

Notes: 20120828T2358 Horribly slow...

pyfasst.SeparateLeadStereo.separateLeadFunctions.generate_WF0_chirped(minF0, maxF0, Fs, Nfft=2048, stepNotes=4, lengthWindow=2048, Ot=0.5, perF0=1, depthChirpInSemiTone=0.5, loadWF0=True, analysisWindow='hanning')[source]

Generates a ‘basis’ matrix for the source part WF0, using the source model KLGLOTT88, with the following I/O arguments:

Inputs:

Parameters:
  • minF0 – the minimum value for the fundamental frequency (F0)
  • maxF0 – the maximum value for F0
  • Fs – the desired sampling rate
  • Nfft – the number of bins to compute the Fourier transform
  • stepNotes – the number of F0 per semitone
  • lengthWindow – the size of the window for the Fourier transform
  • Ot – the glottal opening coefficient for KLGLOTT88
  • perF0 – the number of chirps considered per F0 value
  • depthChirpInSemiTone – the maximum value, in semitone, of the allowed chirp per F0

Outputs:

Returns:
  • F0Table - the vector containing the values of the fundamental frequencies in Hertz (Hz) corresponding to the harmonic combs in WF0, i.e. the columns of WF0
  • WF0 - the basis matrix, where each column is a harmonic comb generated by KLGLOTT88 (with a sinusoidal model, then transformed into the spectral domain)
istft(X, analysisWindow=None, window=array([ 0. , 0.00153398, 0.00306796, ..., 0.00460193,
0.00306796, 0.00153398]), hopsize=256.0, nfft=2048.0, originalDataLen=None, start=-1, stop=None)

Computes an inverse of the short time Fourier transform (STFT), here, the overlap-add procedure is implemented.

Inputs:

Parameters:
  • X – STFT of the signal, to be “inverted”
  • window – synthesis window (should be the “complementary” window for the analysis window)
  • hopsize – hopsize for the analysis
  • nfft – number of points for the Fourier computation (the user has to provide an even number)

Outputs:

Returns:
  • data - time series corresponding to the given STFT the first half-window is removed, complying with the STFT computation given in the function ‘stft’
stft(data, window=array([ 0. , 0.00153398, 0.00306796, ..., 0.00460193,
0.00306796, 0.00153398]), hopsize=256.0, nfft=2048.0, fs=44100.0, start=0, stop=None)

Computes the short time Fourier transform (STFT) of data.

Inputs:

Parameters:
  • data – one-dimensional time-series to be analyzed
  • window – analysis window
  • hopsize – hopsize for the analysis
  • nfft – number of points for the Fourier computation (the user has to provide an even number)
  • fs – sampling rate of the signal

Outputs:

Returns:
  • X
    STFT of data
  • F
    values of frequencies at each Fourier bins
  • N
    central time at the middle of each analysis window

Table Of Contents

Previous topic

SeparateLeadStereo

Next topic

Spatial Signal Models

This Page