center                 package:sound                 R Documentation

_C_e_n_t_e_r _a _S_a_m_p_l_e _O_b_j_e_c_t.

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

     This function adds a constant to a Sample object's waveform, so
     that its mean gets zero. This makes sense especially for
     sonification purposes, when (in general non-centered) data is
     transformed into sound.

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

     center(s)

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

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

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

     For a stereo Sample object, both channels are treated separately.

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

     a Sample object with zero as the mean of each channel's waveform.

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

     Matthias Heymann

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

     'normalize'

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

     ## Not run: 
     x <- seq(0,50*pi,length=10000)
     waveform <- (sin(x))^2 + .6*cos(x/2)^2
     s <- as.Sample(waveform,44100,16)
     plot(s) # nice idea, but wrong range for a sample
     play(s) # sounds ugly, too
     s <- center(s)
     plot(s)  # now zero is the mean
     play(s)  # sounds good, but too quiet
     s <- normalize(s)
     plot(s)  # this looks like a perfect sample!
     play(s)  # e voila!
     ## End(Not run)

