Commit Graph

706 Commits (refactor/python-detect)

Author SHA1 Message Date
katridi 6e197d0138
Bugfix/issue 2563 (#2692)
* Issue-2563 Added fallback to english model
* Added test case for checking config set up
* Added more descriptive log message
2020-09-22 15:01:01 +09:30
JarbasAI 4d3cd33d4a
Feat/self.gui.connected (#2682)
* expose gui connection status

* gui.status.request.response

Co-authored-by: jarbasal <jarbasai@mailfence.com>
2020-09-16 17:02:46 +09:30
Åke Forslund 1202417f86 Handle ntp syncs during precise Startup
Use MonotonicEvent instead of the builtin Event class
2020-09-10 13:27:21 +02:00
Kris Gesling d1ea9088fb
Merge pull request #2670 from MycroftAI/remove/startListening
remove deprecated startListening signal
2020-08-21 00:31:30 +00:00
Kris Gesling d4d7d09e40 remove hardcoded timeouts; already moved to conf 2020-08-19 20:35:23 +09:30
Kris Gesling 23d1d35ea9 remove deprecated startListening signal 2020-08-18 22:21:38 +09:30
Kris Gesling 5dac7fe54c disable wakeword uploads before deprecating API 2020-08-13 16:49:54 +09:30
Kris Gesling 7aa80e2b7d remove duplicate and unused method 2020-08-13 16:46:08 +09:30
Åke Forslund 236a2ed594 Add hook for stopping 2020-07-22 11:06:47 +02:00
Åke Forslund a1fdae3415 Add support for watchdog in skills and speech client
If no watchdog is provided a dummy function will be called
2020-07-22 10:52:32 +02:00
Åke Forslund 09b1deb511 Add possibility for notification hooks for services
- skills
- audio
- speech client
- messagebus service
- enclosure

The main functions now accepts the arguments ready_hook and error_hook
allowing a service or runner script to catch these states and perform
actions accordingly.

This is useful for things like systemd or a desktop launcher.

Fix audio service startup
2020-07-22 10:52:27 +02:00
Åke Forslund 0fc1ba325a Update pyee to v7.0.1
pyee has added ThreadExecutor variant of the EventEmitter which can
replace the home-spun threadpool based emitter
2020-07-07 08:21:42 +02:00
Kris Gesling 83ece0e663
Merge pull request #2591 from forslund/bugfix/mint-skill-listing
Workaround issue with get_wch on older ncurses
2020-06-23 20:01:49 +09:30
Åke Forslund 926d3ff1c1 Extract noise-tracking from _record_phrase
_record_phrase now uses a helper class to track the noise in a sentence
to determine when the user has stopped speaking.

The logic should be the same but the same but allow for easier testing
and manipulation.
2020-05-26 12:12:12 +02:00
Åke Forslund 9e73180206 Make sec_to_bytes a member of MutableMic
The function is based on the parameters of the Mic and is much more a
method of the mic than a static function
2020-05-26 12:12:12 +02:00
Åke Forslund 225f22fe82 Remove unused member variables
Move wakeword duration to the wakeword engine since all wakeword engines
doesn't really use phonemes
2020-05-26 12:12:12 +02:00
Åke Forslund dbf2bf45b1 Return status from wakeword as tuple
- Return the data from the wakeword as a tuple.
- Extract post wakeword actions from wait for wakeword method
2020-05-26 12:12:12 +02:00
Åke Forslund 567e08809a Refactor _wait_for_wakeword
- Add RollingMean data structure
- Add simple CyclicBuffer data structure
- Move out post find actions into separate method
2020-05-26 12:12:12 +02:00
Åke Forslund a783da2e03 Workaround issue with get_wch on older ncurses
get_wch can at times throw errors, this creates a function wait_for_any_key()
handling the error and retrying.
2020-05-20 10:54:37 +02:00
Bart Ribbers 531f78c499
Move requirements.txt to a new requirements folder and add optional deps
Some dependencies aren't actually required but can be optionally
installed for extra functionality.

The Chromecast is an optional audio backend
VLC is an optional audio backend
pyalsaaudio is only used by the mark1 enclosure
google-api-python-client is an optional STT backend, by default Mycroft
uses the Mycroft servers
2020-05-11 15:31:10 +02:00
Åke Forslund 7586de86d9 Fix MutableStream __init__ with mute=True
If the stream is restarted while muted this would cause an Exception
leading to an unresponsive voice client due to the read_lock being
called before creation.
2020-04-20 09:26:31 +02:00
Åke caa77b33f7
Merge pull request #2538 from forslund/bugfix/enclosure-shutdown
Fix enclosure shutdown
2020-04-18 08:00:07 +02:00
Aditya Mehra c5c0881d94 Add configuration option to set microphone timeout
listener->recording_timeout: Maximum length of recording
listener->recording_timeout: Maximum length of silence before stopping
recording
2020-04-17 11:23:25 +02:00
Åke Forslund 6d13872638 Cleanup of the enclosure entrypoint
- split out enclosure determination code
- Add docstrings
- Increase logging
2020-04-16 10:58:07 +02:00
Åke Forslund 290d950424 Fix shutdown of enclosure process
Previously it would always be killed, now it exits smoothly.
2020-04-16 09:47:53 +02:00
Åke Forslund b7cf8e755e Remove origin check from gui websocket
This allows simple websocket clients to connect as well.
2020-04-04 09:15:47 +02:00
Åke Forslund 4f65591c21 Simplify the GUI websocket code
Use a single websocket but don't send data from clients to other
clients.
2020-04-04 09:13:51 +02:00
jarbasal 9d712a898f Update docstrings 2020-03-30 12:05:58 +02:00
jarbasal efc9af558a Read mark1 eye color 2020-03-30 12:05:49 +02:00
dalgwen 003f2920a3 Enable snowboy to use several wakeword models
Snowboy could use several wakeword models, not only the first one.
2020-03-11 08:34:50 +01:00
Åke 05cae9d319
Merge pull request #2429 from MycroftAI/bug/mark1_faceplate
mark1/fix display big images
2020-03-06 18:10:40 +01:00
Åke Forslund 2070e9aac9 Bump enclosure version 2020-03-02 15:25:22 +01:00
ludwhe 49c6b298f1 Add path checks 2020-02-27 08:33:11 +01:00
ludwhe af6b7353e6 Added a "save_path" configuration for saved wake words and utterances. 2020-02-27 08:33:06 +01:00
jarbasal 0de7f11c6e execute TTS from debug_cli 2020-02-15 15:35:43 +01:00
jarbasal 75c796a29d add context to all listener messages 2020-02-15 15:35:38 +01:00
jarbasal e57671ebeb capture all in cli 2020-02-15 12:52:23 +01:00
Jarbas-Core d16964c580 bus message targetting 2020-02-15 12:37:25 +01:00
JarbasAI 46af6fcff2
mark1/fix display big images
https://github.com/MycroftAI/enclosure-mark1/blob/master/protocols.txt#L141

according to the spec there is a bug
2019-12-17 01:34:08 +00:00
Åke Forslund 308b0c5111 Fix incorrect porcupine shutdown and Exception
Flagged by flake8 after merge
2019-12-12 17:51:47 +01:00
Åke 3315d98582
Merge pull request #2139 from alumae/feature/issue-1491
Add support for the Porcupine wakeword engine.
2019-12-12 16:59:12 +01:00
Åke 2263fab0b6
Merge pull request #2418 from forslund/bugfix/missing-hotword-parts
Make sure hotword entry has phonemes and threshold
2019-12-09 20:24:58 +01:00
Åke Forslund 2fa81aac52 Disregard DEBUG entry in filter
The DEBUG, has been filtered by default. This will disregard the DEBUG
filter completely since the same effect can be achieved by setting the
debug level using ":log level debug".
2019-12-09 08:27:27 +01:00
Åke Forslund f9585e47ba Clean up of create_wake_word_recognizer
- Proper docstring
- " -> '
2019-12-07 20:22:20 +01:00
Åke Forslund 2c2c933832 Make sure hotword entry has phonemes and threshold
If hotword entry is missing either add from old listener location
2019-12-07 20:18:47 +01:00
Åke 24071cdea0
Merge pull request #2416 from MycroftAI/feature/gui-server-modern-tornado
Workaround for gui connection
2019-12-07 15:08:08 +01:00
Steve Penrod 2f4b2ccf48 Remove signal.SIGINT handler from simple CLI
At some point during refactoring the ability to hit Ctrl+C to exit the basic CLI was lost.

The signal.SIGINT handler is needed by the graphical GUI, but it
interfered with the use of sys.stdin.readline() in the simple CLI.
Rearrange the installation of the handler for only the GUI.

To test, run:
   mycroft-cli-client --simple
Then hit Ctrl+C.  Before this change nothing happens (you just see the "^C" printed out).  After the change it exits as expected.
2019-12-03 20:07:19 +01:00
Åke Forslund 04e9812992 Asyncio updates for gui connections
- Workaround, ensure asyncio event loop is launched on each thread.
2019-11-26 14:21:49 +01:00
Åke Forslund 026f769028 Fix using of hotword structure for custom wakeword
Fixes overriding settings from listener config
2019-11-26 09:07:15 +01:00
Christian Clauss a1ff3fb355 Upgrade from pycodestyle to flake8 2019-11-19 23:07:52 +01:00
Daniel Morse 3751add193 Move emission of recognizer_loop:wakeword
The message is now emitted directly after a wakeword is detected.
2019-11-11 15:13:56 +01:00
Kris Gesling 0197a7ee39 frames to read must be greater than 0 2019-11-01 08:13:26 +01:00
Åke Forslund 8d4413db9c Update account id fetching
Account ID will now be refetched if invalid the first time.

This also adds some general exception handling to avoid client crashing due
to the servers invalid 204 response.
2019-10-26 09:35:03 +02:00
Åke Forslund 8bdeddb965 Catch and log errors starting up the speech client 2019-10-26 09:34:28 +02:00
Åke f234354783
Merge pull request #2365 from forslund/bugfix/lock-mic-mute-unmute
Lock mic mute unmute
2019-10-20 14:12:53 +02:00
Åke Forslund bc2bfb6c77 Ignore overflow errors as before 2019-10-20 09:48:52 +02:00
Åke Forslund 3da5dece0c Stop restarting mic after 20 attempts 2019-10-20 09:47:12 +02:00
Åke Forslund 149a236e30 Attemt to restart the mic if there's an IOError
If mic produces an IOError try to restart the microphone's input stream
to recover.
2019-10-20 09:01:17 +02:00
Åke Forslund 5d8c3c6c92 Minor cleanup of mic docstrings, etc 2019-10-18 12:19:45 +02:00
Åke Forslund 9f555015e7 Add lock to mute unmute of mic stream
This should alleviate a potential (or possibly an existing) problem if
mute is triggered while reading of the mic occurs.
2019-10-18 12:12:48 +02:00
Åke Forslund b480dda90f Clean up docstrings
Minor cleanup of docstrings in the files affected by the previous commit
2019-10-03 19:13:02 +02:00
Åke Forslund 46b0b94631 Don't go through FS when triggering listener.
This adds a separate handler for triggering listening on the
"mycroft.mic.listen" message
2019-10-03 19:12:56 +02:00
David Wagner 86b6ef16e5 Log IOErrors 2019-09-27 22:25:54 +00:00
David Wagner 4536de7a06 Add Exception logging 2019-09-27 21:50:24 +00:00
David Wagner b0c7d3072c Update text client parsing of mic_level file 2019-09-25 12:23:11 +02:00
David Wagner a66ec9388d Write mic level with mute 2019-09-25 11:54:22 +02:00
Åke Forslund e2d5b92bfe Remove deprecated methods and checks 2019-09-02 11:45:32 +02:00
Chris Veilleux c5058a5117 Merge remote-tracking branch 'remotes/origin/dev' into feature/log-merger 2019-08-29 13:57:08 -05:00
Åke Forslund 4ae290d5b1 Send recording message after playing recording sound
This allows the sound to play before any ducking starts
2019-08-26 15:09:01 +02:00
David Wagner f96a69227d W503 2019-08-22 20:48:07 +02:00
David Wagner 60c43ff3a6 close() on already closed file 2019-08-22 20:48:07 +02:00
David Wagner 4bc1e6dcc6 Keep audio frames immediately after wake word and send them to STT 2019-08-22 20:48:07 +02:00
David Wagner e5f71cf12a
Merge pull request #2245 from forslund/bugfix/download-precise
Bugfix/download precise
2019-08-20 11:27:35 -05:00
Chris Veilleux cc3ef9b4b0 changed to handle new log message format 2019-08-02 11:16:55 -05:00
Åke Forslund f727c00430 Move pairing check to the relevant stt backends
The pairing trigger should only be triggered by the 401 status for the
Mycroft hosted STT backends. Doing it for other STT's is only confusing.

This creates the decorator 'requires_pairing' that can be applied to the STT modules where it's relevant.

This adds the decorator to the MycroftSTT and the MycroftDeepSpeechSTT
2019-08-02 18:16:29 +02:00
Åke Forslund 6a2451bcbc Retry failed download of precise or use existing
Will retry the download of precise once per minute
2019-08-02 08:06:28 +02:00
Åke Forslund ad49c51ffc Minor cleanup of hotword_factory.py
- Reorder includes
- Add basic docstrings for the available engines
- simplify super()
- remove unneccessary "/" chars
2019-07-26 15:54:37 +02:00
Åke Forslund 9fda4e0670 Check if mic returned data before putting on queue
Mic may return None when aborted due to a reload of wake-word engine
2019-07-26 15:34:16 +02:00
Chris Veilleux 0bde1bc9df Refactor skill service (#2220)
Major refactoring of the skills startup sequence
- Restructure to a less nested structure
- Remove usage of globals by wrapping a lot of state variables into a class this allows for things like caching a negative pairing status throughout the startup process
2019-07-26 08:53:27 +02:00
Chris Veilleux d8f3095d40 Rename the message bus client and abstract config loading
Message bus config loading is now shared by service and client.

messagebus.client.ws file is still available in case skills are using it. It is a backport that inherits from the new MessageBusClient class. Adds depreciation warning.
2019-07-19 08:16:54 +02:00
Åke fc0a253c28 Fetch CLI log path from config if available (#2192)
* Fetch CLI log path from config if available

* Remove the old log locations
2019-07-11 17:40:40 -05:00
Åke Forslund b79bd0e317 Remove unused import of sys 2019-07-09 22:54:24 +02:00
Åke Forslund b0ddb9a74a Only report STT timing if transcription exists
To clean up the metrics log empty transcriptions from false activation
are no longer reported.
2019-07-09 22:54:06 +02:00
Åke Forslund f0e397b32e Do not change process conf when preparing hotwords
A backwards compatibility piece of code creates a hotword from the
listener settings if the listener referes to a non-existing hotword.

This makes sure the generated config doesn't affect the loaded
configuration to avoid extra reloads of precise.
2019-07-01 20:58:22 +02:00
Åke Forslund 3a478c4a4d Update listener reload check
The reload check is now using a more reliable method and only a subset
of the configuration. Currently set to "listener", "hotwords", "opt_in"
and "stt".
2019-07-01 20:58:12 +02:00
Åke Forslund 04c0ebf820 Clean up handling of STT returning None 2019-06-25 11:37:01 +02:00
Åke 2b6c7132b1 Allow setting loglevel for speech / voice service (#2169)
Add create_echo_function line to activate the standard logging options
2019-06-21 13:42:32 -05:00
Åke 3b697519d0 Make sure help section shows everything (#2151)
- Use entire screen height
- Correct page number calculation
- Add constants to improve code readability
2019-06-20 17:04:08 -05:00
David Wagner a5526410c0
audio -> message rename 2019-06-10 20:59:10 -05:00
Joshua Watt 601eeb6bdc Implement streaming STT framework
The initial framework for live streaming Speech to Text. STT derived
classes now can report that they support live streaming via their
"can_stream" property. If True, the following member functions will be
called on the object:

stream_start() - Called when a stream is starting. Should setup any
persistent state required to process speech to text.

stream_data(chunk) - Called when a chunk of audio data has been
captured.

stream_stop() - Called when a stream should be stopped. Should tear down
any state setup with stream_start(). Note that this may be called at
anytime (even if stream_start() has not been called).

Note that the execute() API is still used to get the text utterance from
the class.

A typical sequence of calls would be:

 stream_start()
 stream_data(...)
 stream_data(...)
 stream_data(...)
 stream_data(...)
 ...
 execute(...)
 stream_stop()
2019-06-09 22:28:09 -05:00
Åke 72ceed4377 Fix usage of mtd before assignment (#2145)
When opt in is set and local saving of the file no mtd would be generated and the cause a undefined variable exception. This generates metadata if it's missing
2019-06-05 18:43:45 -05:00
Steve Penrod 115bf77763 Restored ability to store wakewords locally (#2141)
* Restored ability to store wakewords locally

The code that handles the local save of wake words configuration -
"record_wake_words" - was removed some time ago.  This restores that
capability.


Add the following to mycroft.conf
  {
    "listener": {
       "record_wake_words": true
    }
  }

Then restart Mycroft.  It should begin saving .wav files under the
/tmp/mycroft_wake_words directory.

The filename, will be  filename structure is: 

<accountId>_<engine>_<model>_<name>_<sessionId>_<time>.wav


* Add documentation for 'record_wake_words' and improve the doc for
'save_utterances'.
2019-05-31 16:07:50 +02:00
Åke 6357513970 GUI updates (#2114)
* Catch the new system.gui.user.interaction

This will in turn trigger the gui.page_interaction similar to the page flip but page_number will be None

* Fix issue when adding pages

Seems like appending would fail at times

* Add lock around namespace modifications

* Improve argument description for override_idle
2019-05-31 03:44:09 -05:00
Tanel.Alumae 3fd0092120 Issue-1491 -- PEP8 issue 2019-05-24 23:45:36 +03:00
Tanel.Alumae 1265f9f0d4 Issue-1491 -- Added support for the Porcupine wakeword engine 2019-05-24 23:18:47 +03:00
Åke bf6e363812
Revert "Support chopping old audio via precise upgrade" 2019-05-22 12:52:57 +02:00
Matthew D. Scholefield dd71f24f29 Support chopping old audio via precise upgrade
This supports dropping audio buffers when the cpu falls behind so that the latency doesn't infinitely increase.
2019-05-15 02:38:33 -05:00
Åke 3841d5c13c
Merge pull request #2096 from MycroftAI/commonIoT/acknowledge
CommonIOT/acknowledge
2019-04-16 11:14:27 +02:00
Chris Rogers b975f2f9cf file -> audio_file 2019-04-14 18:36:07 -04:00
Åke 566630d9e3 Fix infinily adding pages to existing namespace (#2093)
Update the local representation with the new pages when appending pages to an existing namespace.
2019-04-11 13:24:43 -05:00