parselmouth features extraction

2,236 views
Skip to first unread message

nedjena...@gmail.com

unread,
Apr 3, 2020, 7:39:33 AM4/3/20
to Parselmouth
Good morning,

 I work on audios and try to extract with your library characteristics such as the shimmer, the jitter, and the hnr, 
except that in the d?ocumentation, I do not find exactly the functions;
I helped myself with this script: https://osf.io/qe9k4/

but I don't understand the different parameters and would like to use the library directly.

Can you help me please?

Yannick Jadoul

unread,
Apr 3, 2020, 7:59:26 AM4/3/20
to Parselmouth
Hello

As Parselmouth is a wrapper around Praat software, the parameters correspond to the ones in Praat. For example, the parameters to "To PointProcess (periodic, cc)" (and further explanation) can be found here, in the Praat documentation: http://www.fon.hum.uva.nl/praat/manual/Sound__To_PointProcess__periodic__cc____.html, or by clicking "Help" in the interactive Praat user interface.
The Praat documentation often explains things quite well, and since I'm not an expert on each and every piece of functionality in Praat, I try to refrain from trying to do a better job. But yes, the links from Parselmouth to Praat should be better (there are some plans, unfortunately there's not always time to actually do it).

What exactly do you mean with "using the library directly"? The code you link to is slightly overwhelming at first, but it does use Parselmouth directly. Some things (like "To Pitch") do have a direct object-oriented Python interface (https://parselmouth.readthedocs.io/en/latest/api_reference.html#parselmouth.Sound.to_pitch), but since creating this interface takes time and is still a work in progress, some functionality needs to be accessed through `parselmouth.praat.call`, as demonstrated by the Jupyter notebook you refer to (though it sometimes also uses `parselmouth.praat.call` when there is a more pythonic alternative available; the result is exactly the same, however).

Apart from that, you might find these two StackOverflow answers interesting/relevant: https://stackoverflow.com/a/55209266/2043407 and https://stackoverflow.com/a/51657044/2043407.


Does this clarify things a little bit? If not, do let me know about further issues or questions!


Kind regards
Yannick

Yannick Jadoul

unread,
Apr 3, 2020, 2:45:29 PM4/3/20
to BARRY Nene Djenaba, Parselmouth
Hi Barry

Good to hear that helped. To answer your further questions:

1) I don't know all about the algorithms and trade-offs behind the parameter values. I'd suggest to play around with the parameters in the interactive Praat UI and see how it affects the analysis and results. Maybe reading the relevant part of the Praat documentation would give some further insight, and if these two things don't solve the problem, you could get help in the Praat user group (mentioned here: http://www.fon.hum.uva.nl/praat/: https://groups.io/g/Praat-Users-List)

Of course, I think you can assume that the default values set by Praat make a reasonably decent default setting, so you could just try with those. But I don't feel entirely confident to be able to tell you what to use. It will also depend on your actual use case.

2) Same here, I am not an expert in emotion classification, so I will not make any assertions about this, since they might be wrong. After all, Parselmouth's goal is to provide a Python interface to Praat, and by no means I claim to be an expert outside my domain of research (or even within ;-) ). I would suggest to read up in the literature on what standard features are used, and look at the Praat documentation again to see what the differences are between the different forms. My hunch is that these measures will most of the time more or less agree, except in corner cases. But again, I might be wrong, as I have no background in emotion classification and the use of shimmer and jitter for this purpose!

3) The error there is that Praat's action names are case-sensitive (just like Python, actually!). So it is either `sound.to_intensity(minimum_pitch=75, time_step=None)` or `parselmouth.praat.call(sound, "To Intensity", 75, 0.0)` (Mind the order of the arguments as well; your arguments are the wrong way around! In case of doubt, when using parselmouth.praat.call, open Praat, click the corresponding action, and check the order of the form's fields.).


Kind regards
Yannick


On 3/04/2020 17:55, BARRY Nene Djenaba wrote:
Thank you for your help, i read the documentationand now i have the idea of how it works:
 to extract my features, i use this code after import usefull libraries:

sound = parselmouth.Sound(audio_path)
    pitch = call(sound, "To Pitch", 0.0, 75, 600)
    harmonicity = call(sound, "To Harmonicity (cc)", 0.01, 75, 0.1, 1.0)
    hnr = call(harmonicity, "Get mean", 0, 0)
    pointProcess = call(sound, "To PointProcess (periodic, cc)", 75, 500)
    localJitter = call(pointProcess, "Get jitter (local)", 0, 0, 0.0001, 0.02, 1.3)
    localabsoluteJitter = call(pointProcess, "Get jitter (local, absolute)", 0, 0, 0.0001, 0.02, 1.3)
    rapJitter = call(pointProcess, "Get jitter (rap)", 0, 0, 0.0001, 0.02, 1.3)
    ppq5Jitter = call(pointProcess, "Get jitter (ppq5)", 0, 0, 0.0001, 0.02, 1.3)
    ddpJitter = call(pointProcess, "Get jitter (ddp)", 0, 0, 0.0001, 0.02, 1.3)
    localShimmer =  call([sound, pointProcess], "Get shimmer (local)", 0, 0, 0.0001, 0.02, 1.3, 1.6)
    localdbShimmer = call([sound, pointProcess], "Get shimmer (local_dB)", 0, 0, 0.0001, 0.02, 1.3, 1.6)
    apq3Shimmer = call([sound, pointProcess], "Get shimmer (apq3)", 0, 0, 0.0001, 0.02, 1.3, 1.6)
    aqpq5Shimmer = call([sound, pointProcess], "Get shimmer (apq5)", 0, 0, 0.0001, 0.02, 1.3, 1.6)
    apq11Shimmer =  call([sound, pointProcess], "Get shimmer (apq11)", 0, 0, 0.0001, 0.02, 1.3, 1.6)
    ddaShimmer = call([sound, pointProcess], "Get shimmer (dda)", 0, 0, 0.0001, 0.02, 1.3, 1.6)

and my questions are:
1) for all features have i take standard parameters ?
2) for shimmer and jitter should i take all the differents types or there are  among them importants features that i can take? my gool is to do emotion classification with my features after?
3) I try to use sound to intensity object with this code :  intensity = call(sound, "to intensity", 0.0, 75), it doesn't work , i have this error:
PraatError: Command "to intensity" not available for given objects. 
i think that it due to the parameters ( 0.0 , 0.75).

Thank you for your help and excuse my english :)



--
You received this message because you are subscribed to a topic in the Google Groups "Parselmouth" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/parselmouth/-c_5qsn8zTw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to parselmouth...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/parselmouth/2e706b7c-7f8f-43c9-b5ad-ccca40854415%40googlegroups.com.

Yannick Jadoul

unread,
Apr 3, 2020, 2:48:43 PM4/3/20
to BARRY Nene Djenaba, Parselmouth
(Apologies. Looking at your email address and name signature, I assumed your first name was Barry, but I'm now realizing it is probably Nene?)
Reply all
Reply to author
Forward
0 new messages