PSD calculation

17 views
Skip to first unread message

martin boullhesen

unread,
May 30, 2023, 9:27:21 AM5/30/23
to see...@googlegroups.com
Dear all seewavers,

I'm trying to calculate a mean PSD value from each .wav file inside a folder with many sound files.  I'm using seewave to calculate this but having trouble finding a nice result for my further analysis. This info will be used to characterize an urban soundscape coupled with other acoustic indices.

library(seewave)

audio_files <- list.files("path_of_my_files", full.names = TRUE)

# PSD_function
calculate_psd <- function(file) {

  snd <- readWave(file)

  psd <- spec(snd, plot = FALSE, PSD = TRUE)

  return(psd)
}

# create a list

psd_list <- list()

# calculate PSD for each file

for (file in audio_files) {
  psd <- calculate_psd(file)
  psd_list[[file]] <- psd
}

Here is where I get lost. How do I calculate and save the mean PSD value for each .wav file?

If anyone can help me with this I will be very much appreciated!!

all be best,

--
Dr. Martín Boullhesen
Instituto de Ecorregiones Andinas (INECOA), UNJu-CONICET.
Canónigo Gorriti 237 -CP 4600, San Salvador de Jujuy, Argentina.



Virus-free.www.avast.com
Reply all
Reply to author
Forward
0 new messages