<p><a href="https://scikit-maad.github.io/" rel="noreferrer">scikit-maad</a> seems to have the ability to extract acoustic indices, in a format that can then be plotted like this. <a href="https://scikit-maad.github.io/_auto_examples/2_advanced/plot_extract_alpha_indices.html#sphx-glr-auto-examples-2-advanced-plot-extract-alpha-indices-py" rel="noreferrer">See the code example on this page</a>, with a false-colour spectrogram plotted at the bottom of the page.</p>
<p>scikit-maad is a Python software package.</p>

CC BY-SA 4.0
2022-10-17T16:06:19.327Z
2022-10-17T16:06:19.327Z
Dan Stowell
<p>@DanStowell - Thanks, thought that might be the issue. Just picking up from our comments, I've only generated false-colour images for acoustic indices across the whole bandwidth, not for frequency bins - resulting in plots as below, which don't show any frequency spectral data</p>
<p><a href="https://i.sstatic.net/c7ypJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c7ypJ.png" alt="Extended Acoustic Summary image" /></a></p>
<p>For anyone interested in this type of plot, R code would be something like:</p>
<pre><code># Rescale acoustic indices to 0-1 for RGB colours    
ai_data &lt;- ai_data %&gt;%
      mutate(
        ACInorm = rescale(ACI),
        BInorm = rescale(BI),
        ADInorm = rescale(ADI),
        NDSInorm = rescale(NDSI)
      )
# Plot false-colour raster
ggplot(ai_data, aes(x = DATE, y = TIME)) +
  geom_raster(alpha = 1, 
             fill = rgb(red = ai_data<span class="math-container">$ACInorm)),
                        green = ai_data$</span>BInorm)),
                        blue = ai_data$NDSInorm)
             )
</code></pre>

CC BY-SA 4.0
2022-10-19T17:38:14.450Z
2022-10-19T17:38:14.450Z
Carlos Abrahams
<p>Long-term spectral averages can be generated in PAMGuard.  We generate LTSA during offline processing of recordings, and then use the output in PAMGuard Viewer mode to search for marine mammal events to look at more closely with a short-term spectrogram.  The longer term perspective is often very interesting, and detector output (e.g. whistle &amp; moan detector contours) can be overlaid on the LTSA.  The Matlab package Triton specialises in LTSA plots, but I have less experience with this.</p>

CC BY-SA 4.0
2022-10-24T11:01:51.847Z
Ah thank you. But I'm wondering whether or not this is the same thing? To make the plots I'm looking for, it's not just the long-term averaged energy, but also some other statistics, resulting in a different visualisation. But based on your answer I find Triton: https://github.com/MarineBioAcousticsRC/Triton/wiki/LabelVis#CT4a plus this stand-alone LTSA code (Py OR Mat): https://github.com/tryan/LTSA plus a code example in Stack Overflow: https://stackoverflow.com/questions/67231827/does-anyone-know-how-to-plot-long-term-spectral-averages-ltsa-and-psd-in-r
Dan Stowell
CC BY-SA 4.0
2022-10-21T17:38:37.443Z
2022-10-21T17:38:37.443Z
ChrisP
<p>I'd like to calculate a set of <strong>false colour spectrograms</strong>, from long-duration audio -- i.e. the type of visualisation <a href="https://research.ecosounds.org/research/eadm-towsey/long-duration-audio-recordings-of-the-environment" rel="noreferrer">introduced by Michael Towsey's research group at QUT</a>, like this:</p>
<p><a href="https://i.sstatic.net/MxtcH.jpg" rel="noreferrer"><img src="https://i.sstatic.net/MxtcH.jpg" alt="false-colour spectrogram" /></a></p>
<p><a href="https://i.sstatic.net/NWAyP.jpg" rel="noreferrer"><img src="https://i.sstatic.net/NWAyP.jpg" alt="false-colour spectrogram" /></a></p>
<p>The QUT Ecoacoustics group have <a href="https://github.com/QutEcoacoustics/audio-analysis" rel="noreferrer">open-sourced their own analysis code</a> which is the &quot;official&quot; implementation. It runs on Windows/Mac/Linux. <em>(But it's implemented using Windows tools (Mono and Powershell) so on my Linux laptop I'd have to install a lot of extra kit to get it running.)</em></p>
<p>I wrote (together with Sarab Sethi) <a href="https://github.com/sarabsethi/false_colour_index_spectrogram" rel="noreferrer">a Python script to calculate them</a>. <em>(It produced the lower image shown above.)</em> It has the advantage of being a simple standalone Python script, but it's not perfect -- it doesn't implement all the same acoustic indices as the QUT original.</p>
<p><strong>Hence my question:</strong> Has this type of long-duration spectrogram been implemented in any other software or scripts?</p>

CC BY-SA 4.0
2022-10-14T15:54:12.240Z
Purpose of these plots? research/discovery or presentation? IMHO, too many colours are hard to digest as customer, but can be instructive for the person that generated them
WMXZ
CC BY-SA 4.0
2022-10-15T11:29:08.463Z
@WMXZ The purpose, for me at least, is visual data mining. There's a nice example published by Znidersic et al about using them to discover cryptic species in long audio recordings. Towsey et al have published quite a lot showing that they're useful. You do need to be experienced with them to "read" them well.
Dan Stowell
CC BY-SA 4.0
2022-10-19T08:55:00.840Z
@DanStowell is it a spectrogram that you are after, showing time vs frequency, or a false colour plot e.g. time vs date, with three acoustic indices represented on the RGB channels? Obvs the latter is much easier to code.
Carlos Abrahams
CC BY-SA 4.0
2022-10-19T12:42:04.703Z
@CarlosAbrahams false-colour spectrogram. BUT as you see in the images I showed, these are still time versus frequency. The acoustic indices are measured separately for each frequency bin, so each pixel represents something like 1 minute for 1 frequency bin. I think I know the other version that you're thinking of, which is even more zoomed-out where 1 pixel is 1 entire day - that's not what I'm looking for.
Dan Stowell
<analysis><soundscape><software><bigdata>
Software for calculating long-duration false-colour spectrogram?
# Software for calculating long-duration false-colour spectrogram?

(Asked by: username_0 on 2022-10-14)

I'd like to calculate a set of **false colour spectrograms**, from long-duration audio -- i.e. the type of visualisation [introduced by Michael Towsey's research group at QUT](https://research.ecosounds.org/research/eadm-towsey/long-duration-audio-recordings-of-the-environment), like this:

[![false-colour spectrogram](https://i.sstatic.net/MxtcH.jpg)](https://i.sstatic.net/MxtcH.jpg)

[![false-colour spectrogram](https://i.sstatic.net/NWAyP.jpg)](https://i.sstatic.net/NWAyP.jpg)

The QUT Ecoacoustics group have [open-sourced their own analysis code](https://github.com/QutEcoacoustics/audio-analysis) which is the "official" implementation. It runs on Windows/Mac/Linux. *(But it's implemented using Windows tools (Mono and Powershell) so on my Linux laptop I'd have to install a lot of extra kit to get it running.)*

I wrote (together with Sarab Sethi) [a Python script to calculate them](https://github.com/sarabsethi/false_colour_index_spectrogram). *(It produced the lower image shown above.)* It has the advantage of being a simple standalone Python script, but it's not perfect -- it doesn't implement all the same acoustic indices as the QUT original.

**Hence my question:** Has this type of long-duration spectrogram been implemented in any other software or scripts?

**Tags:** analysis, soundscape, software, bigdata

> **Comments:**
> **username_1**: Purpose of these plots? research/discovery or presentation? IMHO, too many colours are hard to digest as customer, but can be instructive for the person that generated them  
> **username_0**: @username_1 The purpose, for me at least, is visual data mining. There's a nice example published by Znidersic et al about using them to discover cryptic species in long audio recordings. Towsey et al have published quite a lot showing that they're useful. You do need to be experienced with them to "read" them well.  
> **username_2**: @username_0 is it a spectrogram that you are after, showing time vs frequency, or a false colour plot e.g. time vs date, with three acoustic indices represented on the RGB channels? Obvs the latter is much easier to code.  
> **username_0**: @username_2 false-colour spectrogram. BUT as you see in the images I showed, these are still time versus frequency. The acoustic indices are measured separately for each frequency bin, so each pixel represents something like 1 minute for 1 frequency bin. I think I know the other version that you're thinking of, which is even more zoomed-out where 1 pixel is 1 entire day - that's not what I'm looking for.  

---

## 3 answers

### Answer by username_0 on 2022-10-17. Score: 5

[scikit-maad](https://scikit-maad.github.io/) seems to have the ability to extract acoustic indices, in a format that can then be plotted like this. [See the code example on this page](https://scikit-maad.github.io/_auto_examples/2_advanced/plot_extract_alpha_indices.html#sphx-glr-auto-examples-2-advanced-plot-extract-alpha-indices-py), with a false-colour spectrogram plotted at the bottom of the page.

scikit-maad is a Python software package.


---

### Answer by username_2 on 2022-10-19. Score: 2

@username_0 - Thanks, thought that might be the issue. Just picking up from our comments, I've only generated false-colour images for acoustic indices across the whole bandwidth, not for frequency bins - resulting in plots as below, which don't show any frequency spectral data

[![Extended Acoustic Summary image](https://i.sstatic.net/c7ypJ.png)](https://i.sstatic.net/c7ypJ.png)

For anyone interested in this type of plot, R code would be something like:

```
# Rescale acoustic indices to 0-1 for RGB colours    
ai_data <- ai_data %>%
      mutate(
        ACInorm = rescale(ACI),
        BInorm = rescale(BI),
        ADInorm = rescale(ADI),
        NDSInorm = rescale(NDSI)
      )
# Plot false-colour raster
ggplot(ai_data, aes(x = DATE, y = TIME)) +
  geom_raster(alpha = 1, 
             fill = rgb(red = ai_data$ACInorm)),
                        green = ai_data$BInorm)),
                        blue = ai_data$NDSInorm)
             )

```


---

### Answer by username_3 on 2022-10-21. Score: 1

Long-term spectral averages can be generated in PAMGuard. We generate LTSA during offline processing of recordings, and then use the output in PAMGuard Viewer mode to search for marine mammal events to look at more closely with a short-term spectrogram. The longer term perspective is often very interesting, and detector output (e.g. whistle & moan detector contours) can be overlaid on the LTSA. The Matlab package Triton specialises in LTSA plots, but I have less experience with this.

> **Comments:**
> **username_0**: Ah thank you. But I'm wondering whether or not this is the same thing? To make the plots I'm looking for, it's not just the long-term averaged energy, but also some other statistics, resulting in a different visualisation. But based on your answer I find Triton: https://github.com/MarineBioAcousticsRC/Triton/wiki/LabelVis#CT4a plus this stand-alone LTSA code (Py OR Mat): https://github.com/tryan/LTSA plus a code example in Stack Overflow: https://stackoverflow.com/questions/67231827/does-anyone-know-how-to-plot-long-term-spectral-averages-ltsa-and-psd-in-r  

---

