From 3cf0a168f62f735a1131941eb6c8f31bae8137f2 Mon Sep 17 00:00:00 2001 From: "Matthew C. Kelley" Date: Thu, 28 Dec 2023 23:20:26 -0700 Subject: [PATCH] Change `style` to `specstyle`; update docs --- docs/src/phon_spectrogram.md | 8 ++++---- src/phon_spectrogram.jl | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/phon_spectrogram.md b/docs/src/phon_spectrogram.md index 8080e20..eccdd23 100644 --- a/docs/src/phon_spectrogram.md +++ b/docs/src/phon_spectrogram.md @@ -15,7 +15,7 @@ s = vec(s) phonspec(s, fs) ``` -A color scheme more similar to the Praat grayscale can be achieved using the `col` argument and the `:gist_yarg` color scheme. These spectrograms are created using the `heatmap` function from `Plots.jl`, so [any color scheme available in the Plots package](https://docs.juliaplots.org/stable/generated/colorschemes/) can be used, though not all of them produce legible spectrograms. +A color scheme more similar to the Praat grayscale can be achieved using the `color` argument from `Plots.jl` and the `:binary` color scheme. These spectrograms are created using the `heatmap` function from `Plots.jl`, so [any color scheme available in the Plots package](https://docs.juliaplots.org/stable/generated/colorschemes/) can be used, though not all of them produce legible spectrograms. ```@example using Phonetics # hide @@ -23,10 +23,10 @@ using WAV # hide s, fs = wavread("assets/iwantaspectrogram.wav") # hide s = vec(s) # hide using Plots # hide -phonspec(s, fs, col=:binary) +phonspec(s, fs, color=:binary) ``` -A narrowband style spectrogram can be plotted using the `style` argument: +A narrowband style spectrogram can be plotted using the `specstyle` argument: ```@example using Phonetics # hide @@ -34,7 +34,7 @@ using WAV # hide s, fs = wavread("assets/iwantaspectrogram.wav") # hide s = vec(s) # hide using Plots # hide -phonspec(s, fs, style=:narrowband) +phonspec(s, fs, specstyle=:narrowband) ``` And, the pre-emphasis can be disabled by passing in a value of 0 for the `pre_emph` argument. Pre-emphasis will boost the prevalence of the higher frequencies in comparison to the lower frequencies. diff --git a/src/phon_spectrogram.jl b/src/phon_spectrogram.jl index 4a00f6e..3436b35 100644 --- a/src/phon_spectrogram.jl +++ b/src/phon_spectrogram.jl @@ -26,7 +26,7 @@ Args phonspec @userplot PhonSpec -@recipe function f(p::PhonSpec; pre_emph=0.97, style=:broadband, dbr=55) +@recipe function f(p::PhonSpec; pre_emph=0.97, specstyle=:broadband, dbr=55) if length(p.args) != 2 error("Must pass 2 arguments for spectrogram, `s` the samples and `fs` the sampling frequency") @@ -35,9 +35,9 @@ phonspec pre_emph_filt = PolynomialRatio([1, -pre_emph], [1]) s = filt(pre_emph_filt, s) - if style == :broadband + if specstyle == :broadband winlen = 0.005 - elseif style == :narrowband + elseif specstyle == :narrowband winlen = 0.05 else error("Unsupported `style` value. Value must be either `:broadband` or `:narrowband`")