{
  "slug": "Using-Restfull-API-of-Farsava-Deep-learning-Automatic-Speech-Recognition-to-convert-Persian-Speech--1ba75d232212",
  "title": "Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech…",
  "subtitle": "In this article,I want to use API Restfull of Farsava ASR in Laravel to convert speech to text.",
  "excerpt": "In this article,I want to use API Restfull of Farsava ASR in Laravel to convert speech to text.",
  "date": "2020-09-29",
  "tags": [
    "Laravel",
    "API",
    "Machine Learning"
  ],
  "readingTime": "2 min",
  "url": "https://medium.com/@mobinshaterian/using-restfull-api-of-farsava-deep-learning-automatic-speech-recognition-to-convert-persian-speech-1ba75d232212",
  "hero": "https://cdn-images-1.medium.com/max/800/1*SPf5-LZAjFnmFbrMKwoQ5Q.png",
  "content": [
    {
      "type": "heading",
      "level": 2,
      "text": "Using Farsava Restful API for Deep learning Automatic Speech Recognition (ASR) used for convert Persian Speech to Text in PHP"
    },
    {
      "type": "paragraph",
      "html": "In this article,I want to useing Farsava API Restfull in PHP to convert Persian speech to text."
    },
    {
      "type": "paragraph",
      "html": "speech to text (also called ASR) with deep Learning is popular today and used for many purposes, such as call center, subtitle making, etc."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*SPf5-LZAjFnmFbrMKwoQ5Q.png",
      "alt": "Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech…",
      "caption": "",
      "width": 315,
      "height": 160
    },
    {
      "type": "paragraph",
      "html": "Farsava is Persian convertor of speech to text (ASR).it’s build and develop by Iranian company and embed in local server without using any online resource."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*AAGCGZcVUcsYZ7IBSKjfxA.png",
      "alt": "Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech…",
      "caption": "",
      "width": 1250,
      "height": 376
    },
    {
      "type": "paragraph",
      "html": "Before implement using Farsava ASR, let’s check ASR performance in the follow link&nbsp;. for using this web application you need to have MTN Irancell or Hamrahaval simcard."
    },
    {
      "type": "paragraph",
      "html": "let’s impeliment API Connection"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Get API Key"
    },
    {
      "type": "paragraph",
      "html": "For getting an API key it’s necessary to visit the below link."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*mA0qUvxEviRCBASzSALV5A.png",
      "alt": "Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech…",
      "caption": "",
      "width": 1836,
      "height": 427
    },
    {
      "type": "paragraph",
      "html": "select your API needed and get token for 30 days. panel gives you a JWT token something like this"
    },
    {
      "type": "paragraph",
      "html": "<em>eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2MDM5NjE4MTAsIm5iZiI6MTYwMTM5OTgxMCwiaeF0IjoxNjAxMzY5ODEwLCJpc3MiOiJodHRwczovL2FjY291bnRzLmFtZXJhbmRpc2guY29tIiwiZXh0Ijp7InNydiI6ImJmNjY1Y2E1LTcyMDUtNGIzMi1hM2azLWVkNzFlNjZiY2FiMiJ9LCJzdWIiOiJtb2JpbnRtdSIsInNjcCI6WyJhc3IiLCJhc3IvcG9zdCIsImFzci9sb25nIiwibG10IiwidHRzIiwiYXNyL2xpdmUiLCJyZWZyZXNoIl19.QvkA6jaCbTOmQ0ZpT-3ALdbjv2Ks-1rW4dPEAWa17YFkM62abxD-WMFP3Rb2s_YszeZWfRgok1Qwz0V6BFb2zegFjoLthegSNc8X0mjSm7DGrJcr_zwjt45oCNZGNoy_lkTWHLBnMFb70yvXXAfb4Ia9Vd9ln96V0mhL6Hz3Wur5y4ZPBomhccnc5KP7skVf9Fe6l58Ejnb6gOXbJCk9XZHTsHbbkMZoze9iPPnWM2aleyZi4tC_-4esGhIroqW0R3ERhH0D4ivOLR60k6E8TaNHrQ6d9-WYu3gjvVY8OaZLqhLR6oVYKVbRVwV7D0v9rD_l7QjWD61dJhFO-uBTykZqcdmQcSo-iQ1kKmONNd8kvxQD4XqHfW9De7ZnF7WYUykioeVFge4at16yfwMEG4HM0hOg-c-THLbUuKMba31fFspw5xGzTCpwFGQ2SE19E2yardpyVvVDXFKTuIIrfnBNAeJDQWMldjwkQJfUnde3fa9PrpKfYAaJQDvzx4RzP0DQwYUpwbGCRqNRD3qGk_pWockoc2bajUX-2A5FYsNCHX1fJzutlg439zYS4Qx_koqQ9FTt47aveHCaVy5XE0eNGppaSHzzxV6BRaflWGmTNL-oNTmu4pyGRnoSgn6P7qy6rD-mUS1rYQoqoRV_Y9H2HIE7x6uv8qAQZlHpdLw</em>"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Document"
    },
    {
      "type": "paragraph",
      "html": "there is document of API in below link. but it’s explain only on api get&nbsp;, post working."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Split speech voice to small part in .WAV format and 16000 Bit Rate"
    },
    {
      "type": "paragraph",
      "html": "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."
    },
    {
      "type": "paragraph",
      "html": "It’s offer that using such as this operation on command line behind the customer."
    },
    {
      "type": "paragraph",
      "html": "installing ffmpeg to convert command and split it to small part."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*ve_PYoHGowRVpJNP4QRKFw.jpeg",
      "alt": "Using Restfull API of Farsava Deep learning Automatic Speech Recognition to convert Persian Speech…",
      "caption": "",
      "width": 322,
      "height": 157
    },
    {
      "type": "code",
      "lang": "text",
      "code": "ffmpeg -i inputfile.mp3 -vn -dn -ar 16000 -ac 1 -ss 0 -t 15 output.wav 2>&1"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "fmpeg -i inputfile.wav -c copy -map 0 -segment_time 15 -f segment output%03d.wav"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Using ASR API Restfull"
    },
    {
      "type": "paragraph",
      "html": "for using API Farsava visit github code."
    },
    {
      "type": "paragraph",
      "html": "one of the annoying thing in this api is not giving complete error explain so i’m extemly emphasize to using Github Amerandish code."
    },
    {
      "type": "paragraph",
      "html": "for connection to the API using below command. it’s neccery to set JWT authentication to connect API."
    },
    {
      "type": "paragraph",
      "html": "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&nbsp;."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Not working on Share host"
    },
    {
      "type": "paragraph",
      "html": "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."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Sending Request One by One"
    },
    {
      "type": "paragraph",
      "html": "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."
    }
  ]
}
