meanspec               package:seewave               R Documentation

_M_e_a_n _f_r_e_q_u_e_n_c_y _s_p_e_c_t_r_u_m _o_f _a _t_i_m_e _w_a_v_e

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

     This function returns the mean frequency spectrum (i.e. the mean
     relative amplitude of the frequency distribution) of a time wave.
     Results can be expressed either in absolute  or dB data.

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

     meanspec(wave, f, wl, ovlp = 0, PSD = FALSE, dB = FALSE,
     from = FALSE, to = FALSE, peaks = FALSE, identify = FALSE,
     col = "black", cex = 1, colpeaks = "red", cexpeaks = 1, 
     fontpeaks = 1, plot = 1, flab = "Frequency (kHz)",
     alab = "Amplitude", flim = c(0,f/2000),alim = NULL,...)

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

    wave: data describing a time wave.

       f: sampling frequency of 'wave'.

      wl: length of the window for the analysis (even number of
          points).

    ovlp: overlap between two successive analysis windows (in %).

     PSD: if 'TRUE' return Power Spectra Density, _i. e._ the square of
          the spectra.

      dB: logical, if 'TRUE' return the spectrum in dB  (by default
          'FALSE').

    from: start mark where to compute the spectrum (in s).

      to: end mark where to compute the spectrum (in s).

   peaks: to return peaks values.

identify: to identify frequency values on the plot with the help of a
          cursor.

     col: colour of the spectrum.

     cex: pitch size.

colpeaks: colour of peaks value plotted on the spectrum.

cexpeaks: character size of peaks value plotted on the spectrum.

fontpeaks: font of peaks value plotted on the spectrum.

    plot: if '1' returns frequency on x-axis, if '2' returns  frequency
          on y-axis, (by default '1').

    flab: title of the frequency axis.

    alab: title of the amplitude axis.

    flim: range of frequency axis.

    alim: range of amplitude axis.

     ...: other 'plot' graphical parameters.

_D_e_t_a_i_l_s:

     A Hanning function is applied to the analysis window.
      If 'from' and 'to' are 'FALSE' then 'spec'  computes the mean
     spectrum of the whole signal.
      'peaks' setting corresponds to 'dimension' of 'embed'.
      When using 'identify', press 'stop' tools bar button to return
     values in the console.

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

     If 'plot' is 'FALSE', 'meanspec' returns  a vector of numeric data
     corresponding to the computed spectrum. If 'peaks' is 'TRUE',
     'spec' returns a list with two elements: 

    spec: the spectrum computed

  peaks : the peaks values (in kHz).

_N_o_t_e:

     See examples of 'spec'. This function is based on 'fft'.

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

     Jrme Sueur jerome.sueur@ibaic.u-psud.fr and  Martin Maechler
     maechler@stat.math.ethz.ch for 'peaks'

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

     'spec', 'corspec', 'fft'.

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

     data(orni)
     # compute the mean spectrum of the whole time wave
     meanspec(orni,f=22050,wl=512,type="l")
     # compute the mean spectrum of a time wave section (from 0.32 s to 0.39 s)
     meanspec(orni,f=22050,wl=512,from=0.32,to=0.39,type="l")
     # different window lengths
     op<-par(mfrow=c(3,1))
     meanspec(orni,f=22050,wl=256,type="l")
     title("wl=256")
     meanspec(orni,f=22050,wl=1024,type="l")
     title("wl=1024")
     meanspec(orni,f=22050,wl=4096,type="l")
     title("wl=4096")
     par(op)
     # different overlap values (almost no effects here...)
     op<-par(mfrow=c(3,1))
     meanspec(orni,f=22050,wl=512,type="l")
     title("ovlp=0")
     meanspec(orni,f=22050,wl=512,ovlp=50,type="l")
     title("ovlp=50")
     meanspec(orni,f=22050,wl=512,ovlp=95,type="l")
     title("ovlp=95")
     par(op)
     # use of flim to zoom in
     op<-par(mfrow=c(2,1))
     meanspec(orni,f=22050,wl=512,type="l")
     title("zoom in")
     meanspec(orni,f=22050,wl=512,type="l",flim=c(4,6))
     par(op)
     # comparaison of spectrum and mean spectrum
     op<-par(mfrow=c(2,1))
     spec(orni,f=22050,type="l")
     title("spec()")
     meanspec(orni,f=22050,wl=512,type="l")
     title("meanspec()")
     par(op)

