synth                package:seewave                R Documentation

_S_y_n_t_h_e_s_i_s _o_f _t_i_m_e _w_a_v_e

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

     This functions synthesize pure tone sound with amplitude
     modulation (am) and/or frequency modulation (fm).

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

     synth(f, d, cf, a = 1, p = 0, am = c(0, 0), fm = c(0, 0, 0),
     plot = TRUE, wl = 512, ovlp = 50, ...)

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

       f: sampling frequency (in Hz).

       d: duration (in s).

      cf: carrier frequency (in Hz).

       a: amplitude (linear scale, relative when adding different
          waves).

       p: phase (in radians).

      am: a vector of length 2 describing amplitude modulation
          parameters, see 'details'.

      fm: a vector of length 3 describing frequency modulation
          parameters, see 'details'.

    plot: if 'TRUE' returns the spectrogram of the synthezised sound
          (by default 'TRUE').

      wl: if 'plot' is 'TRUE', length of the window for the
          spectrographic analysis (even number of points).

    ovlp: if 'plot' is 'TRUE', overlap between two successive windows
          of the spectrographic analysis (in %).

     ...: other 'spectro' graphical parameters.

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

     'am' is a vector of length 2 including: (1) the amplitude
     modulation depth (in %), (2) the frequency of the amplitude
     modulation.

     'fm' is a vector of length 3 including:
       (1) the maximum excursion of a sinusoidal frequency modulation
     (in Hz),
      (2) the frequency of a sinusoidal frequency modulation,
      (3) the maximum excursion of a linear frequency modulation (in
     Hz).

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

     If 'plot' is 'FALSE', 'synth' returns a one-column matrix
     describing the sound synthesized.

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

     Jrme Sueur jerome.sueur@ibaic.u-psud.fr, Thierry Aubin
     thierry.aubin@ibaic.u-psud.fr and  Caroline Simonis-Sueur
     csimonis@mnhn.fr.

_R_e_f_e_r_e_n_c_e_s:

     Hartmann, W. M. 1998 _Signals, sound and sensation_. New York:
     Springer.

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

     'spectro'

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

     # pure tone
     synth(f=22050,d=1,cf=4000)
     # pure tones with am
     synth(f=22050,d=1,cf=4000,am=c(50,10),osc=TRUE)
     # pure tone with +2000 Hz linear fm 
     synth(f=22050,d=1,cf=4000,fm=c(0,0,2000))
     # pure tone with sinusoidal fm
     # (maximum excursion of 1000 Hz, frequency of 10 Hz)
     synth(f=22050,d=1,cf=4000,fm=c(1000,10,0),wl=256,ovlp=75)
     # pure tone with sinusoidal am
     # (maximum excursion of 1000 Hz, frequency of 10 Hz)
     # and linear fm (maximum excurion of 1000 Hz
     synth(f=22050,d=1,cf=4000,fm=c(1000,10,1000),wl=256,ovlp=75)
     # the same with am
     synth(f=22050,d=1,cf=4000,am=c(50,10),
         fm=c(1000,10,1000),wl=256,ovlp=75,osc=TRUE)
     # more complex sound
     F1<-synth(f=22050,cf=2000,d=1,fm=c(500,5,0),plot=FALSE)
     F2<-synth(f=22050,a=0.8,cf=4000,d=1,fm=c(500,5,0),plot=FALSE)
     F3<-synth(f=22050,a=0.6,cf=6000,d=1,fm=c(500,5,0),plot=FALSE)
     F4<-synth(f=22050,a=0.4,cf=8000,d=1,fm=c(500,5,0),plot=FALSE)
     final1<-F1+F2+F3+F4
     spectro(final1,f=22050,wl=512,ovlp=75,scale=FALSE)
     # insert 0.25 s silence
     final1.1<-as.matrix(final1[1:(nrow(final1)/2),])
     final1.2<-as.matrix(rep(0,0.25*22050))
     final1.3<-as.matrix(final1[(nrow(final1)/2):nrow(final1),])
     final2<-rbind(final1.1,final1.2,final1.3)
     spectro(final2,f=22050,wl=512,ovlp=75,scale=FALSE)

