Sample PHP/Laravel web app that transcribes an audio file into text using the IBM Watson Speech to Text service.
This service service uses IBM's speech recognition capabilities to convert speech in multiple languages into text. The transcription of incoming audio is continuously sent back to the client upon completion. The service is accessed via a REST HTTP interface.
Demo URL: https://audio-to-text.ndolestudio.com
-
The Frontend of the comes with tailwindcss and Vue.js.
-
The backend is done with PHP using the Laravel Framework
-
PHPUnit is used for both unit tests and integration tests.
It's advisable to run the tests using docker
- Sign up for an IBM Cloud account.
- Create an instance of the Speech to Text service and get your credentials:
- Go to the Speech to Text page in the IBM Cloud Catalog.
- Log in to your IBM Cloud account.
- Click Create.
- Click Show to view the service credentials.
- Copy the
apikey
value, or copy theusername
andpassword
values if your service instance doesn't provide anapikey
. - Copy the
url
value.
- Sign up for a Pusher Aaccount
- Create a new app on pusher and get your credentials:
- Log in to your Pusher account.
- Click Create new app.
- Set the name of your app and click on the Create my app button
- Click App Keys to view the app credentials.
- Copy the
app_id
,key
,secret
andcluster
values.
-
In the application folder, copy the
.env.example
file and create a file called.env
cp .env.example .env
-
Open the
.env
file and add the service credentials that you obtained in the previous step.Example
.env
file that configures theapikey
andurl
for a Speech to Text service instance:SPEECH_TO_TEXT_USERNAME= SPEECH_TO_TEXT_PASSWORD= SPEECH_TO_TEXT_URL=https://stream.watsonplatform.net/speech-to-text/api/v1/recognize
-
Open the
.env
file and add the service credentials that you obtained in the previous step.PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=
Follow the steps below to run this application locally
-
Clone this git repository and
cd
into itgit clone https://github.com/NdoleStudio/speech-to-text-php.git cd speech-to-text-php
-
Run the docker container
docker-compose up --build -d
-
Open your browser and visit localhost: http://0.0.0.0:8888.
To run tests, setup the application using the setup process shown above and run phpunit
inside the workspace container
$ docker exec -it project-workspace /bin/bash
$ phpunit
- Guzzle - The extensible PHP HTTP client
- IBM Speech to Text - IBM's Transcription service
- Pusher - Powers the real time events
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details