How to recognize a voice?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
liveCode
Posts: 116
Joined: Sun Oct 17, 2021 5:53 pm

How to recognize a voice?

Post by liveCode » Tue May 10, 2022 5:58 pm

I'm trying to make an app on my phone that recognizes sound
What I want to do is let the user talk and then the app will recognize what he said and do what the user wanted
So how can I detect sound in my app?

Klaus
Posts: 12959
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to recognize a voice?

Post by Klaus » Tue May 10, 2022 6:27 pm

Currently there is no "speech recognition" in LC, only the opposite -> text to speech

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9100
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to recognize a voice?

Post by FourthWorld » Tue May 10, 2022 7:33 pm

Popular answer: you can use LC Builder to tap into OS APIs for things LC doesn't currently provide a scripting interface for.

Unpopular answer: I do not encourage use of any always-on microphone connected to the internet. Few consumers are aware of the implications, and unwittingly have their private conversations listened to by strangers thousands of miles away. I used to use voice navigation until I listened to the recordings the device was collecting on the provider's servers. Turned it off, never looked back.


Background:

Apple Belatedly Confirms Bug Which Collected Audio Recordings From iPhone Users

Excerpt:
“I listened to hundreds of recordings every day, from various Apple devices,” said le Bonniec. “These recordings were often taken outside of any activation of Siri, eg in the context of an actual intention from the user to activate it for a request. These processings were made without users being aware of it, and were gathered into datasets to correct the transcription of the recording made by the device.”
https://www.forbes.com/sites/gordonkell ... 06264193b7


As Voice Recognition Technology Market Surges, Organizations Face Privacy and Cybersecurity Concerns
https://www.natlawreview.com/article/vo ... rivacy-and


Report Reveals How Amazon Uses Alexa Voice Data for Targeted Ads
https://www.pcmag.com/news/a-new-report ... rgeted-ads


How to locate and delete voice commands on Google Assistant, Siri, and Alexa
https://knowtechie.com/how-to-delete-vo ... iri-alexa/


A possible exception may be the open source Mycroft AI project, when self-hosted (though few consumers want to run their own server)
https://mycroft.ai


Bonus: Anything from Cory Doctorow, eg:
https://onezero.medium.com/how-to-destr ... 35e6744d59
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 1201
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to recognize a voice?

Post by stam » Wed May 11, 2022 1:39 am

Richard, thanks for that last link to Cory Doctorow - very long but quite an interesting read...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9100
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to recognize a voice?

Post by FourthWorld » Wed May 11, 2022 2:47 am

stam wrote:
Wed May 11, 2022 1:39 am
Richard, thanks for that last link to Cory Doctorow - very long but quite an interesting read...
Glad you found it helpful. He was a keynote speaker at the SoCal Linux Expo a few years ago. Very eye-opening talk. Been following him ever since. His Twitter feed is worthwhile.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

scott_morrow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 22
Joined: Tue Jun 27, 2006 8:35 pm
Location: Bellingham, WA USA
Contact:

Re: How to recognize a voice?

Post by scott_morrow » Wed May 11, 2022 10:07 am

I don't know your exact use case and this could be quite ugly from a UI standpoint but, might one possible "work around" be to create a native UITextField and use the built-in speech to text feature provided to the field by the OS. Then the app could query the field.
Elementary Software
...now with 20% less chalk dust!

liveCode
Posts: 116
Joined: Sun Oct 17, 2021 5:53 pm

Re: How to recognize a voice?

Post by liveCode » Wed May 11, 2022 2:22 pm

So can anyone direct me more how do I do that?

scott_morrow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 22
Joined: Tue Jun 27, 2006 8:35 pm
Location: Bellingham, WA USA
Contact:

Re: How to recognize a voice?

Post by scott_morrow » Thu May 12, 2022 9:15 am

"How to do it" is a particularly reasonable question in this case since looking up "field" in the dictionary doesn't point to mobileControlCreate, mobileControlSet or mobileControlGet(). While it does show the native field Widget objects, and the Android one does seems pretty comprehensive, neither of them point to mobileControlCreate, mobileControlSet or mobileControlGet() either.

LiveCode has a lesson for creating native mobile text fields:
https://lessons.livecode.com/m/4069/l/2 ... -on-mobile

Below is a brief overview.

To create a native field in iOS or Android use the command: mobileControlCreate. There are two kinds of mobile fields.
mobileControlCreate "input", "YourFieldName" -- this field allows a single line
mobileControlCreate "multiline", "YourFieldName" -- this field allows multiple lines

To set properties of the field look up the command: mobileControlSet
examples:
mobileControlSet "YourFieldName", "visible", true
mobileControlSet "YourFieldName", "rect", "20,20,200,50"

To get the content of the field use the function: mobileControlGet()
put mobileControlGet("YourFieldName", "unicodeText") into tUnicodeText

In order to get the dictation to work the user will need to tap the microphone icon that comes up with the mobile keyboard once the field is active.
This field object is native to iOS and Android, so it cannot be used in the IDE or desktop standalone apps. Sadly, you will also need to keep from triggering code which touches these "mobile only" commands and functions when you are not running on mobile because they will cause a script error outside of a mobile OS. So something like:

if the environment is "mobile" then
mobileControlCreate "input", "YourFieldName"
mobileControlSet "YourFieldName", "rect", "20,20,200,50"
end if
Elementary Software
...now with 20% less chalk dust!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”