« MBS Xojo Plugins, ver… | Home | xDev Magazine 23.3 Is… »

From speech to text with FileMaker and MBS

I wanted to transcribe a few voice messages from WhatsApp. Doing this by hand takes a long time for longer voice messages, but maybe I can solve this with a script?

With FileMaker and the MBS FileMaker Plugin, you can quickly build a supporting tool for this.

I used the functions from the Speech component for Mac and iOS. First, a new script was created in the project. In this script, we first check whether Speech recognition has been initialized. If the SpeechRecognition.IsInitialized function returns something that is not equal to 1, we must first initialize the whole thing with SpeechRecognition.Initialize

Next, we want to use the SpeechRecognition.Recognize function to recognize the text. But it does not accept a container value, only a file path. Since we want to load our file from a container via the database, we have to use a trick. We save the container value in the temporary folder from which we can then obtain our file path. In addition, we specify the language of our text in the SpeechRecognition.Recognize function to simplify the recognition of the words. Finally, we can then write the text that is returned in the corresponding field.

If [ MBS("SpeechRecognition.IsInitialized") ≠ 1 ]
	Set Variable [ $r ; Value: MBS("SpeechRecognition.Initialize") ]
End If

Set Variable [ $Ending ; Value: MBS("Container.GetName"; Whatsapp::File) ]
Set Variable [ $FileName ; Value: Whatsapp::Primarykey & "_" & $Ending ]
Set Variable [ $Temp ; Value: MBS("Folders.UserTemporary") ]
Set Variable [ $FilePath ; Value: MBS("Path.AddPathComponent"; $Temp; $FileName) ]
Set Variable [ $r ; Value: MBS("Files.WriteFile"; Whatsapp::File; $FilePath) ]

Set Variable [ $text ; Value: MBS( "SpeechRecognition.Recognize"; $FilePath; "en-US") ]
Set Field [ Whatsapp::Text ; $text ]

The result is not perfect, sometimes words are not recognized correctly and punctuation marks are ignored, but it makes transcribing long voice messages much easier. Incidentally, this method works not only for voice messages but also for film clips and voice recoding.

Whether you want to transcribe your voice messages or add subtitles to your movies, we hope we can help you and wish you lots of fun with this little trick.

01 05 25 - 08:34