platypush/plugins/sound/core.py
def fft(self, t_start=0., t_end=0., samplerate=_DEFAULT_SAMPLERATE,
            freq_range=None, freq_buckets=None):
        """
        Get the real part of the Fourier transform associated to a time-bounded
            sample of this sound

        :param t_start: Start offset for the wave in seconds. Default: 0
        :type t_start: float

        :param t_end: End offset for the wave in seconds. Default: 0
        :type t_end: float

        :param samplerate: Audio sample rate. Default: 44100 Hz
        :type samplerate: int

        :param freq_range: FFT frequency range. Default: ``(0, samplerate/2)``
            (see `Nyquist-Shannon sampling theorem <https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem>`_)
        :type freq_range: list or tuple with 2 int elements (range)

        :param freq_buckets: Number of buckets to subdivide the frequency range.
            Default: None
        :type freq_buckets: int

        :returns: A numpy.ndarray[freq_range,1] with the raw float values
        """

        import numpy as np

        if not freq_range:
            freq_range = (0, int(samplerate / 2))

        wave = self.get_wave(t_start=t_start, t_end=t_end, samplerate=samplerate)
        fft = np.fft.fft(wave.reshape(len(wave)))
        fft = fft.real[freq_range[0]:freq_range[1]]

        if freq_buckets is not None:
            fft = np.histogram(fft, bins=freq_buckets)

        return fft

        Get the real part of the Fourier transform associated to a time-bounded
            sample of this sound

        :param t_start: Start offset for the wave in seconds. Default: 0
        :type t_start: float

        :param t_end: End offset for the wave in seconds. Default: 0
        :type t_end: float

        :param samplerate: Audio sample rate. Default: 44100 Hz
        :type samplerate: int

        :param freq_range: FFT frequency range. Default: ``(0, samplerate/2)``
            (see `Nyquist-Shannon sampling theorem <https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem>`_)
        :type freq_range: list or tuple with 2 int elements (range)

        :param freq_buckets: Number of buckets to subdivide the frequency range.
            Default: None
        :type freq_buckets: int

        :returns: A numpy.ndarray[freq_range,1] with the raw float values
        
Get the real part of the Fourier transform associated to a time-bounded
sample of this sound
Get the real part of the Fourier transform associated to a time - bounded sample of this sound
def fft(self, t_start=0., t_end=0., samplerate=_DEFAULT_SAMPLERATE,
            freq_range=None, freq_buckets=None):
        import numpy as np
        if not freq_range:
            freq_range = (0, int(samplerate / 2))
        wave = self.get_wave(t_start=t_start, t_end=t_end, samplerate=samplerate)
        fft = np.fft.fft(wave.reshape(len(wave)))
        fft = fft.real[freq_range[0]:freq_range[1]]
        if freq_buckets is not None:
            fft = np.histogram(fft, bins=freq_buckets)
        return fft
def fft ( self , t_start = 0. , t_end = 0. , samplerate = _DEFAULT_SAMPLERATE , freq_range = None , freq_buckets = None ) : import numpy as np if not freq_range : freq_range = ( 0 , int ( samplerate / 2 ) ) wave = self . get_wave ( t_start = t_start , t_end = t_end , samplerate = samplerate ) fft = np . fft . fft ( wave . reshape ( len ( wave ) ) ) fft = fft . real [ freq_range [ 0 ] : freq_range [ 1 ] ] if freq_buckets is not None : fft = np . histogram ( fft , bins = freq_buckets ) return fft
Get the real part of the Fourier transform associated to a time-bounded
sample of this sound
Get the real part of the Fourier transform associated to a time - bounded sample of this sound
"""
        Get the real part of the Fourier transform associated to a time-bounded
            sample of this sound

        :param t_start: Start offset for the wave in seconds. Default: 0
        :type t_start: float

        :param t_end: End offset for the wave in seconds. Default: 0
        :type t_end: float

        :param samplerate: Audio sample rate. Default: 44100 Hz
        :type samplerate: int

        :param freq_range: FFT frequency range. Default: ``(0, samplerate/2)``
            (see `Nyquist-Shannon sampling theorem <https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem>`_)
        :type freq_range: list or tuple with 2 int elements (range)

        :param freq_buckets: Number of buckets to subdivide the frequency range.
            Default: None
        :type freq_buckets: int

        :returns: A numpy.ndarray[freq_range,1] with the raw float values
        """
A numpy.ndarray[freq_range,1] with the raw float values
A numpy . ndarray [ freq_range 1 ] with the raw float values
self
t_start
Start offset for the wave in seconds. Default: 0
Start offset for the wave in seconds . Default : 0
t_end
End offset for the wave in seconds. Default: 0
End offset for the wave in seconds . Default : 0
samplerate
Audio sample rate.
Audio sample rate .
freq_range
FFT frequency range.
FFT frequency range .
freq_buckets
Number of buckets to subdivide the frequency range.
Default: None
Number of buckets to subdivide the frequency range . Default : None