stefanocoretta / speakr

speakr: A Wrapper for the Phonetic Software Praat
https://stefanocoretta.github.io/speakr/
Other
25 stars 3 forks source link

Question about running Praat scripts using speakr #12

Open JackGuo15 opened 1 month ago

JackGuo15 commented 1 month ago

Hi Stefano,

I hope this message finds you well. My name is Ruohan, and I am a second-year PhD student at UCL.

I am using speakr to run Praat scripts and extract data from the outcomes. Your tutorial on passing arguments to Praat forms (https://cran.r-project.org/web/packages/speakr/vignettes/run-praat.html) has been incredibly helpful, and I have successfully set most field types in Praat forms, such as option and boolean.

However, I encountered an issue when trying to run a specific Praat script using speakr. The script (https://sites.google.com/view/uhm-o-meter/scripts/syllablenuclei_v3?authuser=0) measures speech rate and requires 11 arguments. The first argument needs a directory path to the audio files (please see the attached snapshots), and I haven't been able to get this right in R.

Could you please advise me on how to pass this type of argument to Praat scripts from R? I can provide the code I used if that would help with the diagnosis.

Thank you in advance for your assistance.

Best wishes, Ruohan

Praat_script Praat_window
stefanocoretta commented 1 month ago

Hi Ruohan! Glad to hear you find speakr helpful. :)

A file path should be a simple string, which shouldn't create issues. Can I see the R code where you call praat_run() and the error message?

JackGuo15 commented 1 month ago

Hi Ruohan! Glad to hear you find speakr helpful. :)

A file path should be a simple string, which shouldn't create issues. Can I see the R code where you call praat_run() and the error message?

Hi Stefano,

Good afternoon! Thank you so much for your response, and I'm so sorry for my late reply.

Please see attached a snapshot of the code I used and the warning I got from R. It seems that R detected 15 arguments although I only specified 11 (which is the number of arguments required for the script).

Run_Script_Snapshot

Thank you so much!

Best wishes, Ruohan

stefanocoretta commented 1 month ago

Can you post the Praat code of the form in your script?

JackGuo15 commented 1 month ago

Can you post the Praat code of the form in your script?

Hi Stefano,

Hope you had a nice weekend! Thank you so much for your reply.

The Praat code I used can be accessed here (https://sites.google.com/view/uhm-o-meter/scripts/syllablenuclei_v3?authuser=0). I apologize that I could not attach the code to this post because it is soooo long and the markdown is a bit annoying.

Last week, I attempted to debug the script and discovered a major issue. When passing the file directory to R, the audio files in the directory were each treated as individual arguments. For example, the directory I specified (shown in Snapshot 1) contains two audio files. This directory worked fine when I used Praat directly (please see Snapshot 2, which features the arguments I used to run the Praat script). However, when I tried to pass the same arguments to the Praat script via R, I received the warning: "Error: Found 12 arguments but expected only 11." After several test runs where I manipulated the number of audio files in the folder, I realized that R, for some reason, treated each individual file in the directory as an argument.

This issue also occurs with other types of arguments. For example, the argument "Pre processing" requires one of three options: "None," "Reduce noise," or "Band pass (300..3000 Hz)." If I pass the "Reduce noise" argument from R to Praat, it is treated as two arguments instead of one.

I have modified the Praat script (mainly the directory part) so it is now compatible with R. However, I am still curious as to why the issues described above occurred. I look forward to your advice.

Thank you so much for your time and patience.

Best wishes, Ruohan

snapshot1

snapshot2