duration                package:sound                R Documentation

_D_u_r_a_t_i_o_n _o_f _a _S_a_m_p_l_e _O_b_j_e_c_t

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

     Get or set the duration (in seconds) of a Sample object or a wav
     file.

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

     duration(s)
     duration(s) <- d
     setDuration(s,d)

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

       s: a Sample object, or a string giving the name of a wav file. 

       d: a double giving the duration in seconds. 

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

     The replacement form can be used to reset the duration of the
     Sample object (here, filenames are not accepted).

     If a Sample object is shortened, extra values are discarded. When
     a Sample object is lengthened, it is padded out to its new length
     with zeros (silence).

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

     For 'duration', the duration of the sample in seconds.

     For 'setDuration', a Sample object with the new duration.

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

     Matthias Heymann

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

     'sampleLength'

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

     ## Not run: 
     s <- Sine(440,3)
     duration(s)  # 3
     duration(s) <-.5  # sample is now .5 sec long
     play(setDuration(s,1)) # plays a .5 sec sine wave and then .5 sec silence
     ## End(Not run)

