Skip to content

Instantly share code, notes, and snippets.

@erzk
erzk / split_continuous_audio.py
Created Feb 24, 2019
Split continuous audio files on occurrence of silence
View split_continuous_audio.py
#!/usr/bin/env python
import glob, os
for file in sorted(glob.glob("*.wav")):
print("#"*40)
print(file)
os.system("python audioAnalysis.py silenceRemoval -i " + file + " --smoothing 0.2 --weight 0.1")
@erzk
erzk / praat_pitch_analysis.R
Created Feb 11, 2019
Extract pitch values, intensity, time, and confidence from Praat pitch files
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)
@erzk
erzk / extract_pitch_script.praat
Created Feb 10, 2019
Extract pitch values, intensity, time, and confidence from all wav files in the working directory
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)
You can’t perform that action at this time.