简体   繁体   中英

how to incorporate praat script into webpage/database

I'm creating a web page, with a database already designed and functioning, that uses JavaScript to record users' audio and save it's storage path to the database. I'm using praat scripts to analyse this speech and so far it works offline (individually without interraction with the DB) and am storing the results in a txt file.

My question is, does anyone know how to incorporate the praat script into the webpage so that it will work with the click of a button? Without having to download the audio, and run the praat script on the desktop etc.

Any help would be greatly appreciated!

I figured out how to somewhat achieve this. It doesn't work with the DB at the moment but it works locally. The first step was to create a batch file to run the praat script from.

praatcon.exe myscript2.praat -25 2 0.3 yes         
c:\xampp\htdocs\focaleile\recordings\ .wav newresults.txt 
exit

You need to have praatcon.exe downloaded (and saved along with your audio files)

Then within your web page (I had php files in use) you call the .bat file:

<?php>
ini_set('max_execution_time', 60); //300 seconds = 5 minutes
#runs praat script via .bat file
exec('START C:\xampp\htdocs\focaleile\analyse.bat'); 
</?>

I set the max execution time as I found it was timing out.

This basically runs the praat script via the command prompt and exits when complete. Within my Praat Script I was able to print out user friendly messages in the cmd window so they wouldn't be put off.

I know this isn't the safest and probably not the best solution but it is what I have come up with. I'm open to suggestions for better solutions!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM