channels                package:sound                R Documentation

_N_u_m_b_e_r _o_f _C_h_a_n_n_e_l_s _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 number of channels of a Sample object or a wav
     file.

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

     channels(s)
     channels(s) <- c
     setChannels(s,c)

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

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

       c: 1 for mono, or 2 for stereo. 

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

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

     If a mono sample is transformed into a stereo sample, each channel
     of the stereo sample equals the waveform of the mono sample. If a
     stereo Sample is transformed to a mono sample,
     '(left(s)+right(s))/2' is returned.

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

     For 'channels', the number of channels of the sample (1 for mono,
     2 for stereo).

     For 'setChannels', a Sample object with the new 'channels'
     parameter.

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

     Matthias Heymann

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

     'fitSampleParameters'

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

     ## Not run: 
     s <- stereo(Sine(440,1),Sine(220,1))
     channels(s)  # 2
     play(s)
     channels(s) <- 1  # now a mono sample
     play(s)
     ## End(Not run)

