Instantly share code, notes, and snippets.

View praat_pitch_analysis.R
#!/usr/bin/env r
## load pitch files extracted from Praat and pull key information
# take input from the command line
f <- argv
# load packages and hide messages
library(dplyr)
library(rPraat)
View extract_pitch_script.praat
clearinfo
# uncomment for a point-and-click version (then the next two lines should be commented out)
#inDir$ = chooseDirectory$: "Choose the folder containing your wav files"
wd$ = "./"
inDir$ = wd$
# create a list of all wav files in the chosen directory
inDirWild$ = inDir$ + "*.wav"
View standalone_spectrogram.R
library(RCurl)
# download the R code
script <- getURL("https://raw.githubusercontent.com/usagi5886/dsp/master/Spectrogram().r",
ssl.verifypeer = FALSE)
# load it as a function
eval(parse(text = script))
library(audio)
# download the wav file
View hht_spectrogram.R
library(hht)
data(PortFosterEvent)
dt <- mean(diff(tt))
ft <- list()
ft$nfft <- 4096
ft$ns <- 30
ft$nov <- 29
View warbleR_spectrogram.R
library(warbleR)
# load and save data
data(list = c("Phae.long1", "Phae.long2","selec.table"))
writeWave(Phae.long1, "Phae.long1.wav")
# make spectrograms (saves the files in the working directory)
specreator(X = selec.table, flim = c(0, 11), res = 300, mar = 0.05, wl = 300)
View soundgen_spectrogram.R
library(soundgen)
# synthesize a sound 1 s long, with gradually increasing hissing noise
sound = soundgen(sylLen = 1000,
temperature = 0.001,
noiseAnchors = list(
time = c(0, 1300),
value = c(-120, 0)),
formantsNoise = list(
f1 = list(
View signal_spectrogram.R
library(signal)
specgram(chirp(seq(-2, 15, by = 0.001), 400, 10, 100, 'quadratic'))
View seewave_ggplot2_spectrogram.R
library(ggplot2)
## first layer
v <- ggspectro(tico, ovlp = 50)
## using geom_tile ##
v + geom_tile(aes(fill = amplitude)) + stat_contour()
View seewave_spectrogram.R
library(seewave)
data(tico)
spectro(tico)
View phonTools_spectrogram.R
library(phonTools)
data(sound)
spectrogram(sound)