periodogram              package:tuneR              R Documentation

_P_e_r_i_o_d_o_g_r_a_m (_S_p_e_c_t_r_a_l _D_e_n_s_i_t_y) _E_s_t_i_m_a_t_i_o_n _o_n _W_a_v_e _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function estimates one or more periodograms (spectral
     densities)  of the time series contained in an object of class
     'Wave' using a window running through the time series (possibly
     with overlapping). It returns an object of class 'Wspec'.

_U_s_a_g_e:

     periodogram(object, width = length(object@left), overlap = 0, 
         starts = NULL, ends = NULL, taper = 0, normalize = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

  object: An object of class 'Wave'.

   width: A window of width ''width'' running through the time series
          selects the samples  from which the periodograms are to be
          calculated.

 overlap: The window can be applied by each overlapping 'overlap'
          samples.

  starts: Start number (in samples) for a window. If not given, this
          value is derived from argument 'ends', or will be derived
          'width' and 'overlap'.

    ends: End number (in samples) for a window. If not given, this
          value is derived from argument 'starts', or will be derived
          from 'width' and 'overlap'.

   taper: proportion of data to taper. See 'spec.pgram' for details.

normalize: Logical; if 'TRUE' (default), two steps will be applied: (i)
          the input signal will be normalized to amplitude
          'max(abs(amplitude)) == 1', (ii) the resulting 'spec' values
          will be normalized to sum up to one for each periodogram.

     ...: Further arguments to be passed to the underlying function
          'spec.pgram'.

_V_a_l_u_e:

     An object of class 'Wspec' is returned containing the following
     slots. 

    freq: Vector of frequencies at which the spectral density is
          estimated.  See 'spectrum' for details. (1)

    spec: List of vectors or matrices of the 'spec' values returned by
          'spec.pgram' at frequencies corresponding to 'freq'. Each
          element of the list corresponds to one periodogram estimated
          from samples of the window beginning at 'start' of the 'Wave'
          object.

  kernel: The kernel argument, or the kernel constructed from spans
          returned by 'spec.pgram'. (1)

      df: The distribution of the spectral density estimate can be
          approximated by a chi square distribution with  'df' degrees
          of freedom. (1)

   taper: The value of the 'taper' argument. (1)

   width: The value of the 'width' argument. (1)

 overlap: The value of the 'overlap' argument. (1)

normalize: The value of the 'normalize' argument. (1)

  starts: If the argument 'starts' was given in the call, its value. If
          the argument 'ends' was given in the call, ''ends - width''.
          If neither 'starts' nor 'ends' was given, the start points of
          all periodograms. In the latter case the start points are
          calculated from the arguments 'width' and 'overlap'.

  stereo: Whether the underlying 'Wave' 'object' was stereo ot not. (1)

samp.rate: Sampling rate of the underlying 'Wave' 'object'. (1)

variance: The variance of samples in each window, corresponding to
          amplitude / loudness of sound.

  energy: The "energy" E, also an indicator for the amplitude /
          loudness of sound:

             E(x_I) := 20 * log_{10} sum_{j in I} |x_j|,

          where I indicates the interval I:= 'start[i]:end[i]' for all 
          1:=1,..., 'length(starts)'. 

     Those slots marked with "(1)" contain the information once, 
     because it is unique for all periodograms of estimated by the
     function call.

_N_o_t_e:

     This function is still in development.  Support for processing of
     stereo 'Wave' objects has not yet been implemented.

_A_u_t_h_o_r(_s):

     Uwe Ligges, ligges@statistik.uni-dortmund.de

_S_e_e _A_l_s_o:

        *  for the resulting objects' class: 'Wspec',

        *  for plotting: 'plot-Wspec',  

        *  for the underlying periodogram calculations: 'spec.pgram',

        *  for the input data class: 'Wave'.

_E_x_a_m_p_l_e_s:

     # constructing a Wave object (1 sec.) containing sinus sound with 440Hz:
     x <- seq(0, 2*pi, length = 44100)
     channel <- round(32000 * sin(440 * x))
     Wobj <- Wave(left = channel)
     Wobj

     # Calculate periodograms in windows of 4096 samples each - without
     #   any overlap - resulting in an Wspec object that is printed:
     Wspecobj <- periodogram(Wobj, width = 4096)
     Wspecobj

     # Plot the first periodogram from Wspecobj:
     plot(Wspecobj)
     # Plot the third one and choose a reasonable xlim:
     plot(Wspecobj, which = 3, xlim = c(0, 1000))
     # Mark frequency that has been generated before:
     abline(v = 440, col="red")

     FF(Wspecobj)              # all ~ 440 Hertz
     noteFromFF(FF(Wspecobj))  # all diapason a

