This function performs the short-term Fourier transform externally, i. e. outside R, on an audio .wav file

1 2 |

`file` |
a character string vector of length 1, corresponding to
the audio file name. Only |

`wl` |
a numeric vector of length 1, window length for the analysis (even number of points) (by default = 512). |

`ovlp` |
a numeric vector of length 1, overlap between two successive windows (in %). |

`mean` |
logical, if |

`norm` |
logical, if |

`dB` |
logical, if |

`verbose` |
logical, if |

If `mean`

is `FALSE`

, the function returns a two-column
matrix corresponding to the amplitude values of the spectrogram. Each
column is a discrete Fourier transform of length `wl`

.

If `mean`

is `TRUE`

, the function returns a list with
two elements:

`mean` |
a vector of length |

`amp` |
the spectrogram matrix. |

This function was developped to speed up the process of computing
a spectrogram or a mean spectrum. The function should be faster than
`spectro`

and `meanspec`

respectively as it does not import
the `.wav`

file into `R`

and uses `C`

fftw3 (http://www.fftw.org/) and libsndfile
(http://www.mega-nerd.com/libsndfile/) libraries. The function
is typically made for batch processing or long files. Gain in process
time is significant for files > 10 minutes and for more thant 1000
files lasting one second.

A Hanning window shape is used by default.

Alicia Stotz

`spectro`

, `meanspec`

, `fft`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# tico data
data(tico)
# write a local .wav file
savewav(tico, file="tico.wav")
# spectrogram - not normalised - linear scale - meta-information returned
res <- stft.ext(file="tico.wav", verbose=TRUE)
# spectrogram - normalised - linear scale - no meta-information
res <- stft.ext(file="tico.wav", norm=TRUE)
# spectrogram - dB scale - no meta-information
res <- stft.ext(file="tico.wav", dB=TRUE)
# see how it looks like (no scale)
filled.contour(t(res))
# spectrogram and mean spectrum - normalised - linear scale
res <- stft.ext(file="tico.wav", norm = TRUE, mean = TRUE)
# remove .wav file
unlink("tico.wav")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.