rate                  package:sound                  R Documentation

_T_h_e _S_a_m_p_l_i_n_g _R_a_t_e

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

     Get or set the sampling rate (number of samples per second) of a
     Sample object or a wav file.

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

     rate(s)
     rate(s) <- r
     setRate(s,r)

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

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

       r: an integer between 1000 and 48000 giving the sampling rate. 

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

     The replacement form can be used to reset the sampling rate. Here,
     filenames are not accepted.

     Note that changing the sampling rate of a Sample object affects
     the waveform of the sample.

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

     For 'rate', the sampling rate (number of samples per second) of
     the sample.

     For 'setRate', a Sample object with the new sampling rate.

_N_o_t_e:

     Common sampling rates are between 8000 and 44100 (CD quality). The
     sampling rate of DAT recorders is 48000. Not every rate is
     guaranteed to be supported by every wav file player.

     Future versions may use a different algorithm for sampling rate
     conversion to achieve a better sound quality for the returned
     sample.

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

     Matthias Heymann

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

     'fitSampleParameters', 'pitch'

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

     ## Not run: 
     s <- Sine(440,1,rate=44100)
     rate(s)  # 44100
     play(s)
     print(s)
     rate(s) <- 8000
     play(s)  # s has worse quality now (noise and additional high frequencies)
     print(s) # but uses less memory
     ## End(Not run)

