Instantly share code, notes, and snippets.

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)
View cp_all.sh
#!/bin/bash
cp **/*MES.csv All
View removing_triggers_function.R
# define a function
replace_nth_ETG4000 <- function(x, mark) {
x <- x %>% group_by(Mark) %>% mutate(Count = row_number()) %>% data.frame()
double_marks <- which(x$Mark == mark & x$Count %% 2 == 0)
x$Mark[double_marks] <- 0
x <- subset(x, select = -Count)
return(x)
}
# remove second occurrence of Mark 2