| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| README.html | 2020-09-18 16:20 | 13K | ||
| man/ | 2020-09-18 16:20 | - | ||
R package for sound synthesis and acoustic analysis.
Homepage with help, demos, etc: http://cogsci.se/soundgen.html
Source code on github: https://github.com/tatters/soundgen
Performs parametric synthesis of sounds with harmonic and noise components such as animal vocalizations or human voice. Also includes tools for spectral analysis, pitch tracking, audio segmentation, self-similarity matrices, morphing, etc.
soundgen()soundgen_app()analyze() / analyzeFolder()pitch_app()formant_app()segment() / segmentFolderFor more information, please see the vignettes on sound synthesis and acoustic analysis:
vignette("sound_generation", package="soundgen")
vignette("acoustic_analysis", package="soundgen")
Or, to open the vignettes in a browser:
RShowDoc('sound_generation', package = 'soundgen')
RShowDoc('acoustic_analysis', package = 'soundgen')
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(-15, -5, -50) # noise amplitude, dB
),
rolloffNoise = 0, # flat noise spectrum before adding formants
addSilence = 0, samplingRate = 44100, pitchSamplingRate = 44100,
play = TRUE, plot = TRUE, osc = TRUE, ylim = c(0, 6)
)
Use the analyze() function to detect pitch and obtain other spectral descriptives of the sound we have just synthesized:

a[1:5, c('pitch', 'peakFreq', 'harmHeight', 'HNR', 'ampl', 'loudness')]
#> pitch peakFreq harmHeight HNR ampl loudness
#> 1 NA NA NA NA 0.0305833 NA
#> 2 NA 305.2747 NA 1.083205 0.1442435 9.636858
#> 3 300.0882 305.2747 1197.802 12.934929 0.3642711 17.808124
#> 4 299.4505 305.2747 1197.802 14.042033 0.5131389 22.289716
#> 5 296.0563 305.2747 1110.114 13.450248 0.4959925 22.193244
colnames(a)
#> [1] "duration" "duration_noSilence" "time" "ampl"
#> [5] "amplVoiced" "dom" "entropy" "f1_freq"
#> [9] "f1_width" "f2_freq" "f2_width" "f3_freq"
#> [13] "f3_width" "harmEnergy" "harmHeight" "HNR"
#> [17] "loudness" "peakFreq" "pitch" "quartile25"
#> [21] "quartile50" "quartile75" "specCentroid" "specSlope"
#> [25] "voiced"To install the current release from CRAN: install.packages("soundgen")
NB: Make sure all dependencies have been installed correctly! For problems with seewave, see http://rug.mnhn.fr/seewave/
On Macs, you may need to do the following:
brew install libsndfilebrew install fftwinstall.packages("soundgen")