Original article was published by mobin shaterian on Deep Learning on Medium
Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech to Text in PHP
In this article,I want to use API Restfull of Farsava ASR in Laravel to convert speech to text.
Speech to text with deep Learning is popular today and used for many purposes, such as call center, subtitle making.
Farsava is Persian convertor of Persian Speech to Text.
Before implement using Farsava asr, let’s check asr performance in the link below. for using this web application you need to have MTN Irancell or Hamrahaval Simcard.
let’s impeliment API Connection
Get API Key
For getting an API key it’s necessary to visit the below link.
select your api needed and get token for 30 days. panel gives you a JWT token something like this
there is document of API in below link. but it’s explain only on api get , post working.
Split speech voice to small part in .WAV format and 16000 Bit Rate
Farsava API only working on 15 sec on wav file that have 16000 bitRate. so before using API must to split it to small part.
It’s offer that using such as this operation on command line behind the customer.
installing ffmpeg to convert command and split it to small part.
ffmpeg -i inputfile.mp3 -vn -dn -ar 16000 -ac 1 -ss 0 -t 15 output.wav 2>&1
ffmpeg -i inputfile.wav -c copy -map 0 -segment_time 15 -f segment output%03d.wav
Using ASR API Restfull
for using API Farsava visit github code.
one of the annoying thing in this api is not giving complete error explain so i’m extemly emphasize to using Github Amerandish code.
for connection to the API using below command. it’s neccery to set JWT authentication to connect API.
if your code have any bug it’s only send back you false error and it’s so difficult to understand the issuse. recommending using template code at first .
Not working on Share host
if you want run this command on share host probebly you can’t convert and split sound easy beacuse offten share host did’nt have permmition to run command in background.
Sending Request One by One
another problem is you can’t send lot of request in same time and need queue processing. ASR need very resource to process these operation.