zc                  package:seewave                  R Documentation

_I_n_s_t_a_n_t_a_n_e_o_u_s _f_r_e_q_u_e_n_c_y _o_f _a _t_i_m_e _w_a_v_e _b_y _z_e_r_o-_c_r_o_s_s_i_n_g

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

     This function measures the period of a full oscillating cycle.

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

     zc(wave, f, plot = TRUE, interpol = 1, threshold = FALSE,
     xlab = "Time (s)", ylab = "Frequency (kHz)", ylim = c(0, f/2000),...)

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

    wave: data describing a time wave.

       f: sampling frequency of 'wave'.

    plot: logical, if 'TRUE' plots the dominant frequency along the
          time wave(by default 'TRUE').

interpol: interpolation factor.

threshold: amplitude threshold for signal detection (in % ).

    xlab: title of the x axis.

    ylab: title of the y axis.

    ylim: the range of y values.

     ...: other 'plot' graphical parameters.

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

     If 'plot' is 'FALSE', 'zc' returns a vector of numeric data with
     the instantaneous frequency.

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

     If 'plot' is 'FALSE', 'zc' functions returns a vector of numeric
     data. Values corresponds to the instantaneous frequency of the
     time wave. 'NA's  correspond either to pause periods (e. g.
     detected applying 'threshold' or sections of the time wave not
     corrsing the zero line. To remove 'NA's with  'na.omit' allows to
     get only instantaneous frequency values but discards information
     about pause sections.

_N_o_t_e:

     'interpol' adds points to the time wave by linear interpolation
     (through 'approx'). This increases measurement precision but as
     well time process. Type argument of 'plot' cannot be set to "l".

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

     Jrme Sueur jerome.sueur@ibaic.u-psud.fr, Caroline Simonis-Sueur
     csimonis@mnhn.fr and  Thierry Aubin thierry.aubin@ibaic.u-psud.fr

_R_e_f_e_r_e_n_c_e_s:

     Hopp, S. L., Owren, M. J. and Evans, C. S. (Eds) 1998. _Animal
     acoustic communication._ Springer, Berlin, Heidelberg.

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

     data(pellucens)
     pellu1<-cutw(pellucens,f=22050,from=0,to=1,plot=FALSE)
     # without interpolation
     zc(pellu1,f=22050,threshold=5,pch=20)
     # with interpolation
     zc(pellu1,f=22050,threshold=5,interpol=20,pch=20)
     # a way to plot with a line and to filter low frequencies
     pellu2<-zc(pellu1,f=22050,threshold=5,interpol=20,plot=FALSE)
     pellu3<-na.omit(pellu2)
     pellu4<-pellu3[pellu3>3]
     plot(x=seq(0,nrow(pellu1)/22050,length.out=length(pellu4)),
         y=pellu4,type="l",xlab="Time(s)",ylab="Frequency(kHz)")

