bits                  package:sound                  R Documentation

_B_i_t_s _p_e_r _S_a_m_p_l_e

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

     Get or set the 'bits' parameter (the sampling quality) of a Sample
     object or a wav file.

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

     bits(s)
     bits(s) <- b
     setBits(s,b)

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

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

       b: the number of bits per sample, 8 or 16. 

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

     The replacement form can be used to reset the sampling quality of
     a Sample object, that is the number of bits per sample (8 or 16).
     Here, filenames are not accepted.

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

     For 'bits', the bits parameter (number of bits per sample) of the
     Sample object, 8 or 16.

     For 'setBits', a Sample object with the new 'bits' parameter.

_N_o_t_e:

     Changing the sampling quality of a Sample object does not affect
     its actual data but only its '$bits' flag. The sampling quality is
     only used when a Sample object is played or saved to disk.
     Internally, R always uses doubles for the waveform.

     An 8 bit sample needs only half the disk space but has less
     quality.

_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 <- Sine(20000,1,rate=44100,bits=16)
     play(s)
     print(s)
     bits(s) <- 8
     play(s)  # now worse quality
     print(s) # but less disk space
     play(setBits(s,16)) # now better quality again, since waveform data was not changed.
     ## End(Not run)

