CRAN Version Downloads

Parametric source-filter synthesis of harmonic-noise signals, such as animal vocalizations and human voice, with control over pitch, formants, noise, amplitude modulation, nonlinear phenomena, and morphing. General signal processing tools for audio analysis and manipulation: pitch tracking, formant and vocal tract length estimation, reassigned and auditory spectrograms, modulation spectra and psychoacoustic roughness, self-similarity and surprisal, audio segmentation, pitch and formant shifting, etc. Includes four interactive web apps for audio synthesis, annotation, formant analysis, and manually correcting pitch contours.

Key functions

Visualization

Acoustic analysis

Interactive acoustic analysis

Sound synthesis

Sound modification

Vignettes

References

Example of sound synthesis

Use the soundgen() function to create a breathy moan:

s = soundgen(
  sylLen = 230,               # duration of voiced part, ms
  pitch = c(305, 280),        # pitch, Hz (goes down from 305 to 380 Hz)
  ampl = c(0, -20),           # amplitude, dB (gradual fade-out by 20 dB)
  rolloff = -30,              # strong f0, weak harmonics
  temperature = 0.05,         # some stochasticity in generation
  formants = c(260, 960, 1500, 2200,  # F1-F8 formant frequencies, Hz
               2600, 3600, 4200, 4500),
  noise = data.frame(
    time = c(-50, 120, 700),  # time of noise anchors
    value = c(-25, -15, -40)   # noise amplitude, dB
  ),
  rolloffNoise = 0,           # flat noise spectrum before adding formants
  addSilence = 0, samplingRate = 44100, pitchSamplingRate = 44100,
  plot = TRUE, osc = TRUE, ylim = c(0, 6)
)

Example of acoustic analysis

Use the analyze() function to detect pitch and obtain other spectral descriptives of the sound we have just synthesized:

a = analyze(s, 44100, plot = TRUE, ylim = c(0, 6))
#> The sound is too short to be analyzed with amRes = 1 Hz. Actual amRes ~=  1.31

a$detailed[1:5, c('time', 'pitch', 'HNR', 'ampl', 'loudness')]
#>        time    pitch       HNR       ampl  loudness
#> 1  25.00000       NA        NA 0.03313867  6.039053
#> 2  49.98866 298.2525  5.656488 0.18586389 14.131545
#> 3  74.97732 304.5555 15.080634 0.41149933 23.273527
#> 4  99.96599 300.9743 17.070995 0.53578982 27.618641
#> 5 124.95465 296.9162 14.551249 0.49568060 26.568438
colnames(a$detailed)
#>  [1] "duration"           "duration_noSilence" "time"               "amEnvDep"          
#>  [5] "amEnvDepVoiced"     "amEnvFreq"          "amEnvFreqVoiced"    "amEnvPurity"       
#>  [9] "amEnvPurityVoiced"  "amMsFreq"           "amMsFreqVoiced"     "amMsPurity"        
#> [13] "amMsPurityVoiced"   "ampl"               "ampl_noSilence"     "amplVoiced"        
#> [17] "CPP"                "dom"                "domVoiced"          "entropySh"         
#> [21] "entropyShVoiced"    "entropyW"           "entropyWVoiced"     "epoch"             
#> [25] "f1_freq"            "f1_width"           "f2_freq"            "f2_width"          
#> [29] "f3_freq"            "f3_width"           "fluctuation"        "fluctuationVoiced" 
#> [33] "flux"               "fmDep"              "fmFreq"             "fmPurity"          
#> [37] "harmEnergy"         "harmHeight"         "HNR"                "HNRVoiced"         
#> [41] "loudness"           "loudnessVoiced"     "novelty"            "noveltyVoiced"     
#> [45] "peakFreq"           "peakFreqVoiced"     "pitch"              "quartile25"        
#> [49] "quartile25Voiced"   "quartile50"         "quartile50Voiced"   "quartile75"        
#> [53] "quartile75Voiced"   "roughness"          "roughnessVoiced"    "sharpness"         
#> [57] "sharpnessVoiced"    "specCentroid"       "specCentroidVoiced" "specSlope"         
#> [61] "specSlopeVoiced"    "subDep"             "subRatio"           "voiced"