## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
• Jun 10 13:44
• Jun 10 13:44
• Jun 10 13:29
• Jun 10 13:20
• Jun 10 13:03
• Jun 04 13:44
• Jun 04 13:44
• Jun 02 03:33
ananas-hebo commented #54
• Jun 01 15:30
• Jun 01 15:10
• Jun 01 03:50
ananas-hebo closed #54
• Jun 01 03:50
ananas-hebo commented #54
• May 31 21:10
• May 31 16:46
ananas-hebo opened #54
• May 25 14:40

• May 25 14:40

Bump ncipollo/release-action fr… Merge pull request #53 from Yan… (compare)

• May 25 14:40
• May 25 14:40
dependabot[bot] edited #53
• May 25 14:40
• May 25 06:07
dependabot[bot] labeled #53
(See Praat for the different parameters)
I don't think there is a version of this in the Python API already
Rebeca
@R-Araripe
Hello, everyone! This is more of a signal processing theory question... At this manual page, it's written that they use Gaussian window by default because it "gives no side lobes". But it does, right? They use a limited length Gaussian (twice as many samples as Hamming or other shapes, but still), so the implicit multiplication by a rectangular window should give side lobes anyway, right?
Kesh Ikuma
@hokiedsp
@R-Araripe - You are correct. There is no finite-length window function which has no side lobes. It's inevitable finite-length effect. I usually look up Wikipedia for the windows' spectra (https://en.wikipedia.org/wiki/Window_function). Note that Gaussian function is a variable window function so we need to dive into the source to see what Praat exactly uses. Hope this helps.
@R-Araripe, @hokiedsp Not a signal processing expert myself, either, actually, but yes, that is quite weird
Here's Praat filling the window
for (integer i = 1; i <= nsamp_window; i ++) {
// ...
case kSound_to_Spectrogram_windowShape::GAUSSIAN: {
const double imid = 0.5 * (double) (nsamp_window + 1), edge = exp (-12.0);
const double phase = ((double) i - imid) / nSamplesPerWindow_f;   // -0.5 .. +0.5
window [i] = (exp (-48.0 * phase * phase) - edge) / (1.0 - edge);
break;
}
// ...
}
I once translated this (or something similar) to Python/NumPy
window = (np.exp(-48 * ((np.arange(nsamp_window) - (nsamp_window - 1) / 2) / (nsamp_window + 1))**2) - np.exp(-12)) / (1 - np.exp(-12))
So, if I recall correctly, it's a Gaussian window that's
1. $e^{-12}$ on each end, left and right
2. Lowered by $e^{-12}$ such that these ends would be at amplitude 0, then scaled to have the top at 1 again
Maybe the Gaussian window's side lobes are just so much lower that you don't see them in the default dynamic range (70 dB, I think) of Praat's spectrogram?
Kesh Ikuma
@hokiedsp
@YannickJadoul - Thanks for the Python version of the window. Did a quick test, and yes, it has really really low sidelobes compared to Hamming but it majorly sacrifices the mainlobe width (expected tradeoff). Compared to Hamming window of a same length, it's mainlobe is 80% wider while max sidelobe is -124 dB compared to -42 dB of Hamming window. To me, the Praat Gaussian window has a bit excessive sidelobe rejection for the loss of spectral resolution. That being said, I can see why this window is chosen to analyze normal voice (harmonic series) in Praat.

the default dynamic range (70 dB, I think)

I think you are spot on, except they went well-over that spec.

taubaaron
@taubaaron

The issue I am still struggling with is filtering a matrix with a sound. Basically I have done sound->to_lpc->down_to_matrix->to_np_array and I would like to do the opposite direction. Is there such a way to do so? (to be honest, I am not sure how to do that in praat, specifically move from lpc_matrix to lpc object). If any of you are familiar with other methods to do so that we be amazing.

The bottom line is to do the "filter.." action in praat (where you choose 2 objects, in my case an lpc_object and a pitch_object) and filter the np_matrix/lpc_matrix.
TIA!!

@hokiedsp Great, that indeed explains stuff! And explains the tradeoff they make. For a spectrogram, maybe more blurry is better than having weird lines, indeed, though? Could that be the reason why?
Kesh Ikuma
@hokiedsp

For a spectrogram, maybe more blurry is better than having weird lines, indeed, though? Could that be the reason why?

What it comes down to is what you want to see in the spectrogram. If you are interested in formants, for example, then you don't need fine spectral resolution (100's of Hz wide mainlobe is sufficient to resolve F1 and F2) and you also want to see the noise floor (in quiet room, let's say 100 dB below the most prominent tone). Then this Gaussian window is a perfect choice. On the other hand, if you are conducting dysphonia research (like me) and you want to see the presence of subharmonics or modulation, which are only 10's of Hertz away from the "main" harmonic tone, then you'd use Hamming window for its ability to separate peaks given the same observation window. You'd sacrifice the ability to see the noise floor in the process of doing so. The boxcar window (or no windowing) gives you the best spectral resolution but has very high sidelobes, causing spectrogram to show "phantom lines". Hope this makes sense.

@hokiedsp That's a very clear and interesting explanation, yes! Thank you for that!! :-)
Kesh Ikuma
@hokiedsp
@taubaaron - I have a pending PR (actually not sure if I filed it yet or not) to interface Praat LPC with Python but @YannickJadoul is lagging a bit 😅 Meanwhile, maybe @YannickJadoul can help you whether there is a way to restore Praat LPC object from numpy array
@hokiedsp A bit
Kesh Ikuma
@hokiedsp
yes, a bit
Quite a bit 😳
Did you encounter something, doing this? Going back from a Matrix to LPC?
Kesh Ikuma
@hokiedsp
I suppose that's a question for @taubaaron , no?
No, I meant for you, @hokiedsp
I thought that maybe while diving into the data structure and functions of LPC, you might have encountered something
Kesh Ikuma
@hokiedsp
I have never used it, so no
Of maybe have a better idea of what's possible
Okay, no problem
Kesh Ikuma
@hokiedsp
Wait, did I started LPC interface or did I build on top of yours? (I thought it wasn't there before)
Is there a Praat function @taubaaron can call to restore LPC object from numpy array? (I really have no idea)
I don't think it was there before
So I think you know more about LPC in Praat/Parselmouth than I do
Kesh Ikuma
@hokiedsp
ok. In my PR (or my branch, to be PR) I implemented LPC constructor to load coefficients from Python
Oh, right
Yes. But you implemented that yourself? There was no Praat function for that? :-(
Kesh Ikuma
@hokiedsp
Remember, I have zero interest to learn Praat script 😅
I don't recall seeing any "from matrix" type of definitions in praat_lpc.h (or whatever it is)
Right, right :-D
Damng, OK :-(
Kesh Ikuma
@hokiedsp
Just checked the matrix generated from LPC object in Praat, and there is no "To LPC" cast button
I did the same a while ago, yes
And there's no way of changing the contents of an existing LPC object, it seems
Kesh Ikuma
@hokiedsp
agree
or use scipy.signal.filter()...