简体   繁体   English

如何将Praat脚本合并到网页/数据库中

[英]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. 我正在创建一个网页,该网页具有已经设计和运行的数据库,该网页使用JavaScript记录用户的音频并将其存储路径保存到数据库。 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. 我正在使用praat脚本来分析此语音,到目前为止,它可以脱机工作(与DB无关),并且将结果存储在txt文件中。

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? 我的问题是,是否有人知道如何将praat脚本合并到网页中,从而只需单击一下按钮即可使用该脚本? Without having to download the audio, and run the praat script on the desktop etc. 无需下载音频,也无需在桌面上运行praat脚本等。

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. 第一步是创建一个批处理文件以运行praat脚本。

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) 您需要下载praatcon.exe(并与音频文件一起保存)

Then within your web page (I had php files in use) you call the .bat file: 然后在您的网页(我正在使用php文件)中,您调用.bat文件:

<?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. 这基本上是通过命令提示符运行praat脚本,并在完成时退出。 Within my Praat Script I was able to print out user friendly messages in the cmd window so they wouldn't be put off. 在我的Praat脚本中,我能够在cmd窗口中打印出用户友好的消息,因此不会被推迟。

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! 我愿意寻求更好的解决方案的建议!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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