fitSampleParameters          package:sound          R Documentation

_A_d_j_u_s_t _P_a_r_a_m_e_t_e_r_s _o_f _T_w_o _S_a_m_p_l_e _O_b_j_e_c_t_s.

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

     Adjust the parameters sampling rate, channels and bits/sample of
     two Sample objects.

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

     fitSampleParameters(s1, s2)

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

   s1,s2: a Sample object, or strings giving the name of a wav file. 

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

     The commands 'rate', 'channels' and 'bits' are used to transform
     copies of 's1' and 's2' to samples with the same parameters rate,
     channels and bits. Always the parameter with the better quality is
     chosen for the returned samples, that is the higher sampling rate,
     the larger number of channels and the larger number of bits per
     sample.

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

     a list containing the two transformed Samples as components.

_N_o_t_e:

     This routine is called before certain commands such as
     'sum.Sample' or 'appendSample' are applied to Sample objects with
     different parameters.

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

     Matthias Heymann

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

     'rate', 'channels', 'bits'

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

     ## Not run: 
     s1 <- Sine(440,1,rate=22050,channels=1,bits=16)
     s2 <- Sawtooth(440,1,rate=44100,channels=2,bits=8)
     play(s1)
     play(s2)
     l  <- fitSampleParameters(s1,s2)
     t1 <- l[[1]]
     t2 <- l[[2]]
     print(t1)
     print(t2)  # both samples have the same parameters now
     play(t1)
     play(t2)   # none of the samples sounds different now,
                # since only parameters with higher quality were chosen
     ## End(Not run)

