extractWave              package:tuneR              R Documentation

_E_x_t_r_a_c_t_o_r _f_o_r _W_a_v_e _o_b_j_e_c_t_s

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

     Extractor function that allows to extract inner parts for 'Wave'
     objects (interactively).

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

     extractWave(object, from = 1, to = length(object@left), 
         interact = interactive(), xunit = c("samples", "time"), ...)

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

  object: Object of class 'Wave'.

    from: Sample number or time in seconds (see 'xunit') at which to
          _start_ extraction.

      to: Sample number or time in seconds (see 'xunit') at which to
          _stop_ extraction. If 'to < from', 'object' will be returned
          as is.

interact: Logical indicating whether to choose the range to be
          extracted interactively (if 'TRUE').  See Section Details.

   xunit: Character indicating which units are used to specify the
          range to be extracted (both in arguments 'from' and 'to', and
          in the plot, if 'interact = TRUE'). If 'xunit = "time"', the
          unit is time in seconds, otherwise the number of samples.

     ...: Parameters to be passed to the underlying plot function
          ('plot-methods'),  if 'interact = TRUE'.

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

     This function allows interactive selection of a range to be
     extracted from an object of class 'Wave'. The default is to use
     interactive selection, if the current R session is 'interactive'.
     In case of interactive selection, 'plot-methods' plot the 'Wave'
     object, and the user may click on the starting and ending points
     of his selection (given neither 'from' nor 'to' have been
     specified, see below).  The cut-points are drawn and the
     corresponding selection will be returned in form of a 'Wave'
     object.

     Setting 'interact = TRUE' in a non-interactive session does not
     work.

     Setting arguments 'from' or 'to' explicitly means that the
     specified one  does not need to be selected interactively, hence
     only the non-specified one will be selected interactively.
     Moreover, setting both 'from' or 'to' implies 'interact = FALSE'.

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

     An object of class 'Wave'.

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

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

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

     'Wave', 'bind', 'channel', 'mono'

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

     x <- seq(0, 2*pi, length = 44100)
     Wobj <- Wave(left = round(32000 * sin(440 * x)))
     # extracting the middle 0.5 seconds of that 1 sec. sound:
     Wobj2 <- extractWave(Wobj, from = 0.25, to = 0.75, xunit = "time")
     Wobj2

     ## Not run: 
     # or interactively:
     Wobj2 <- extractWave(Wobj)
     ## End(Not run)

