sound                 package:sound                 R Documentation

_T_h_e _W_a_v_e_f_o_r_m _M_a_t_r_i_x _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 waveform matrix of a Sample object or a wav file.

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

     sound(s)
     sound(s) <- waveform

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

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

waveform: a 'channels(s)' x 'sampleLength(s)' matrix of doubles. 

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

     The replacement form can be used to reset the waveform of a sample
     object. Here, filenames are not accepted for code{s}.

     The matrix can have one (for mono samples) or two rows (for stereo
     samples), where in the latter case the first row corresponds to
     the left and the second row to the right channel.

     It contains the waveform(s) of the Sample object as sequence(s) of
     numbers between -1 and 1. 'waveform' can contain arbitrary real
     numbers, but when the Sample object is played or saved to disk,
     [-1,1] is regarded as the native range of the sample, and any
     values outside this interval will cause cracks in the sound.

     The waveform of a Sample object might exceed this interval during
     calculations. It is the task of the programmer to take care about
     the range of the waveform before saving or playing the sample, for
     example by using the 'normalize' function.

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

     the waveform matrix of the sample.

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

     Matthias Heymann

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

     'as.Sample'

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

     ## Not run: 
     s <- Sine(440,1,channels=2)  # stereo sine wave
     sound(s)[2,] <- sound(s)[2,]*seq(1,0,length=sampleLength(s))
     play(s)  # right channel fades to zero
     ## End(Not run)

