Analyzing WAV files using the soundecology R package

Load required R packages


In [1]:
library('tuneR')
library('seewave')
library('soundecology')


tuneR >= 1.0 has changed its Wave class definition.
Use updateWave(object) to convert Wave objects saved with previous versions of tuneR.

Read WAV file into R as an object


In [2]:
sound1 <- readWave("~/Desktop/test/160224150000.wav")

In [3]:
sound2 <- readWave("~/Desktop/test/160309150500.wav")

Draw a spectrogram of the WAV file

-- spectrogram --

Compute acoustic diversity


In [6]:
acoustic_diversity(sound1)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Diversity Index: 
   Left channel: 1.246873
   Right channel: 1.106268

In [10]:
acoustic_diversity(sound2)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Diversity Index: 
   Left channel: 1.247621
   Right channel: 1.107211

Compute acoustic evenness


In [7]:
acoustic_evenness(sound1)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Evenness Index: 
   Left channel: 0.726491
   Right channel: 0.760851


In [11]:
acoustic_evenness(sound2)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Evenness Index: 
   Left channel: 0.726379
   Right channel: 0.760694

Compute acoustic complexity


In [8]:
acoustic_complexity(sound1)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Complexity Index (total):
   Left channel: 911.6882
   Right channel: 913.0544


In [12]:
acoustic_complexity(sound2)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 

  Acoustic Complexity Index (total):
   Left channel: 907.043
   Right channel: 908.6633

Compute the normalized difference soundscape index


In [4]:
ndsi(sound1, fft_w = 1024, anthro_min = 1000, anthro_max = 2000, bio_min = 2000, bio_max = 11000)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 
  Normalized Difference Soundscape Index:

   Left channel: 0.1517927
   Right channel: 0.02293733


In [5]:
ndsi(sound2, fft_w = 1024, anthro_min = 1000, anthro_max = 2000, bio_min = 2000, bio_max = 11000)


 This is a stereo file. Results will be given for each channel.

 Calculating index. Please wait... 
  Normalized Difference Soundscape Index:

   Left channel: -0.4693702
   Right channel: -0.5330735