sampleLength              package:sound              R Documentation

_L_e_n_g_t_h _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 length (number of columns in the waveform matrix)
     of a Sample object or a wav file.

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

     sampleLength(s)
     sampleLength(s) <- l
     setSampleLength(s,l)

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

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

       l: an integer giving the sample length (number of columns in the
          waveform matrix). 

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

     The replacement form can be used to reset the sample length (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 'sampleLength', the number of columns in the waveform matrix
     of the sample.

     For 'setSampleLength', a Sample object with the new length.

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

     Matthias Heymann

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

     'duration'

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

     ## Not run: 
     s <- Sine(440,3,rate=44100,bits=16,channels=2)
     sampleLength(s)  # 132300 samples ( = 3 sec * 44100 samples/sec )
     sampleLength(s) <- 22050  # sample is now .5 sec long
     play(setSampleLength(s,44100)) # plays a .5 sec sine wave and then .5 sec silence
     ## End(Not run)

