├── .DS_Store ├── CONTRIBUTORS.txt ├── LICENSE ├── README.md ├── main.py └── requirements.txt /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python019/subui-speech-assistant/dddc333ee5a8e232ef70dda74462fb4969f1eacb/.DS_Store -------------------------------------------------------------------------------- /CONTRIBUTORS.txt: -------------------------------------------------------------------------------- 1 | @python019 2 | @guli2103 3 | @shahnozahaydarova 4 | @KhamrayevaUmida 5 | @Behruzbek1212 6 | @firdavs0502 7 | @crimson-dg 8 | @Sevarabonu 9 | @marat756 10 | @oybegim 11 | @GuliXalili 12 | @abduraimov1114 13 | @Kamolov0199 14 | @maruf0108 15 | @muhammadamin38 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2022, Jumayev Ubaydullo 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SUBUI Python Speech Assistant (simple 6 functions) 2 | Python app that uses speech recognition and text-to-speech This app initially used the Google text-to-speech API, but has been updated to use offline text-to-speech with pyttsx3 3 | 4 | ## For work this project 5 | $ pip install speechrecognition 6 | 7 | $ pip install pyttsx3 8 | 9 | $ pip install pipwin 10 | 11 | $ pipwin install pyaudio 12 | 13 | $ pip install playsound 14 | 15 | 16 | ## Voice commands: 17 | -- What is your name? 18 | 19 | -- What time is it 20 | 21 | -- Search 22 | 23 | -- Find Location 24 | 25 | -- Shut Down 26 | 27 | -- Do You Know SUSYS? 28 | 29 | 30 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import webbrowser 3 | import time 4 | import playsound 5 | import os 6 | import random 7 | from gtts import gTTS 8 | from time import ctime 9 | r = sr.Recognizer() 10 | 11 | def record_audio(ask = False): 12 | with sr.Microphone() as source: 13 | if ask: 14 | subux_speak(ask) 15 | audio = r.listen(source) 16 | voice_data = '' 17 | try: 18 | voice_data = r.recognize_google(audio) 19 | except sr.UnknownValueError: 20 | subux_speak('Sorry, I did not get that') 21 | except sr.RequestError: 22 | subux_speak('Sorry, my speech service is down') 23 | return voice_data 24 | 25 | 26 | 27 | def subux_speak(audio_string): 28 | tts = gTTS(text=audio_string, lang='en') 29 | r = random.randint(1, 10000000) 30 | audio_file = 'audio-' + str(r) + '.mp3' 31 | tts.save(audio_file) 32 | playsound.playsound(audio_file) 33 | print(audio_string, [...]) 34 | os.remove(audio_file) 35 | 36 | def respond(voice_data): 37 | if 'what is your name' in voice_data: 38 | subux_speak('My name is SUBUI') 39 | if 'susys' in voice_data: #About SUSYS 40 | subux_speak('Yes of course. They are web development group ') 41 | if 'what time is it' in voice_data: 42 | subux_speak(ctime()) 43 | if 'search' in voice_data: 44 | search = record_audio('What do you want to search for?') 45 | url = 'https://google.com/search?q=' + search 46 | webbrowser.get().open(url) 47 | subux_speak('Here is what I found for ' + search) 48 | if 'find location' in voice_data: 49 | location = record_audio('What is the location?') 50 | url = 'https://google.nl/maps/place/' + location + '&' 51 | webbrowser.get().open(url) 52 | subux_speak('Here is the location of ' + location) 53 | if "shut down" in voice_data: 54 | exit() 55 | 56 | 57 | 58 | time.sleep(1) 59 | subux_speak('How can I help you?') 60 | while 1: 61 | voice_data = record_audio() 62 | respond(voice_data) -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.11.1 2 | certifi==2022.9.24 3 | charset-normalizer==2.1.1 4 | click==8.1.3 5 | docopt==0.6.2 6 | gTTS==2.2.4 7 | idna==3.4 8 | Js2Py==0.71 9 | packaging==21.3 10 | pipwin==0.5.2 11 | playsound==1.3.0 12 | pyjsparser==2.7.1 13 | pyobjc==8.5.1 14 | pyobjc-core==8.5.1 15 | pyobjc-framework-Accessibility==8.5.1 16 | pyobjc-framework-Accounts==8.5.1 17 | pyobjc-framework-AddressBook==8.5.1 18 | pyobjc-framework-AdServices==8.5.1 19 | pyobjc-framework-AdSupport==8.5.1 20 | pyobjc-framework-AppleScriptKit==8.5.1 21 | pyobjc-framework-AppleScriptObjC==8.5.1 22 | pyobjc-framework-ApplicationServices==8.5.1 23 | pyobjc-framework-AppTrackingTransparency==8.5.1 24 | pyobjc-framework-AudioVideoBridging==8.5.1 25 | pyobjc-framework-AuthenticationServices==8.5.1 26 | pyobjc-framework-AutomaticAssessmentConfiguration==8.5.1 27 | pyobjc-framework-Automator==8.5.1 28 | pyobjc-framework-AVFoundation==8.5.1 29 | pyobjc-framework-AVKit==8.5.1 30 | pyobjc-framework-BusinessChat==8.5.1 31 | pyobjc-framework-CalendarStore==8.5.1 32 | pyobjc-framework-CallKit==8.5.1 33 | pyobjc-framework-CFNetwork==8.5.1 34 | pyobjc-framework-ClassKit==8.5.1 35 | pyobjc-framework-CloudKit==8.5.1 36 | pyobjc-framework-Cocoa==8.5.1 37 | pyobjc-framework-Collaboration==8.5.1 38 | pyobjc-framework-ColorSync==8.5.1 39 | pyobjc-framework-Contacts==8.5.1 40 | pyobjc-framework-ContactsUI==8.5.1 41 | pyobjc-framework-CoreAudio==8.5.1 42 | pyobjc-framework-CoreAudioKit==8.5.1 43 | pyobjc-framework-CoreBluetooth==8.5.1 44 | pyobjc-framework-CoreData==8.5.1 45 | pyobjc-framework-CoreHaptics==8.5.1 46 | pyobjc-framework-CoreLocation==8.5.1 47 | pyobjc-framework-CoreMedia==8.5.1 48 | pyobjc-framework-CoreMediaIO==8.5.1 49 | pyobjc-framework-CoreMIDI==8.5.1 50 | pyobjc-framework-CoreML==8.5.1 51 | pyobjc-framework-CoreMotion==8.5.1 52 | pyobjc-framework-CoreServices==8.5.1 53 | pyobjc-framework-CoreSpotlight==8.5.1 54 | pyobjc-framework-CoreText==8.5.1 55 | pyobjc-framework-CoreWLAN==8.5.1 56 | pyobjc-framework-CryptoTokenKit==8.5.1 57 | pyobjc-framework-DataDetection==8.5.1 58 | pyobjc-framework-DeviceCheck==8.5.1 59 | pyobjc-framework-DictionaryServices==8.5.1 60 | pyobjc-framework-DiscRecording==8.5.1 61 | pyobjc-framework-DiscRecordingUI==8.5.1 62 | pyobjc-framework-DiskArbitration==8.5.1 63 | pyobjc-framework-DVDPlayback==8.5.1 64 | pyobjc-framework-EventKit==8.5.1 65 | pyobjc-framework-ExceptionHandling==8.5.1 66 | pyobjc-framework-ExecutionPolicy==8.5.1 67 | pyobjc-framework-ExternalAccessory==8.5.1 68 | pyobjc-framework-FileProvider==8.5.1 69 | pyobjc-framework-FileProviderUI==8.5.1 70 | pyobjc-framework-FinderSync==8.5.1 71 | pyobjc-framework-FSEvents==8.5.1 72 | pyobjc-framework-GameCenter==8.5.1 73 | pyobjc-framework-GameController==8.5.1 74 | pyobjc-framework-GameKit==8.5.1 75 | pyobjc-framework-GameplayKit==8.5.1 76 | pyobjc-framework-ImageCaptureCore==8.5.1 77 | pyobjc-framework-IMServicePlugIn==8.5.1 78 | pyobjc-framework-InputMethodKit==8.5.1 79 | pyobjc-framework-InstallerPlugins==8.5.1 80 | pyobjc-framework-InstantMessage==8.5.1 81 | pyobjc-framework-Intents==8.5.1 82 | pyobjc-framework-IntentsUI==8.5.1 83 | pyobjc-framework-IOSurface==8.5.1 84 | pyobjc-framework-iTunesLibrary==8.5.1 85 | pyobjc-framework-KernelManagement==8.5.1 86 | pyobjc-framework-LatentSemanticMapping==8.5.1 87 | pyobjc-framework-LaunchServices==8.5.1 88 | pyobjc-framework-libdispatch==8.5.1 89 | pyobjc-framework-LinkPresentation==8.5.1 90 | pyobjc-framework-LocalAuthentication==8.5.1 91 | pyobjc-framework-LocalAuthenticationEmbeddedUI==8.5.1 92 | pyobjc-framework-MailKit==8.5.1 93 | pyobjc-framework-MapKit==8.5.1 94 | pyobjc-framework-MediaAccessibility==8.5.1 95 | pyobjc-framework-MediaLibrary==8.5.1 96 | pyobjc-framework-MediaPlayer==8.5.1 97 | pyobjc-framework-MediaToolbox==8.5.1 98 | pyobjc-framework-Metal==8.5.1 99 | pyobjc-framework-MetalKit==8.5.1 100 | pyobjc-framework-MetalPerformanceShaders==8.5.1 101 | pyobjc-framework-MetalPerformanceShadersGraph==8.5.1 102 | pyobjc-framework-MetricKit==8.5.1 103 | pyobjc-framework-MLCompute==8.5.1 104 | pyobjc-framework-ModelIO==8.5.1 105 | pyobjc-framework-MultipeerConnectivity==8.5.1 106 | pyobjc-framework-NaturalLanguage==8.5.1 107 | pyobjc-framework-NetFS==8.5.1 108 | pyobjc-framework-Network==8.5.1 109 | pyobjc-framework-NetworkExtension==8.5.1 110 | pyobjc-framework-NotificationCenter==8.5.1 111 | pyobjc-framework-OpenDirectory==8.5.1 112 | pyobjc-framework-OSAKit==8.5.1 113 | pyobjc-framework-OSLog==8.5.1 114 | pyobjc-framework-PassKit==8.5.1 115 | pyobjc-framework-PencilKit==8.5.1 116 | pyobjc-framework-Photos==8.5.1 117 | pyobjc-framework-PhotosUI==8.5.1 118 | pyobjc-framework-PreferencePanes==8.5.1 119 | pyobjc-framework-PushKit==8.5.1 120 | pyobjc-framework-Quartz==8.5.1 121 | pyobjc-framework-QuickLookThumbnailing==8.5.1 122 | pyobjc-framework-ReplayKit==8.5.1 123 | pyobjc-framework-SafariServices==8.5.1 124 | pyobjc-framework-SceneKit==8.5.1 125 | pyobjc-framework-ScreenCaptureKit==8.5.1 126 | pyobjc-framework-ScreenSaver==8.5.1 127 | pyobjc-framework-ScreenTime==8.5.1 128 | pyobjc-framework-ScriptingBridge==8.5.1 129 | pyobjc-framework-SearchKit==8.5.1 130 | pyobjc-framework-Security==8.5.1 131 | pyobjc-framework-SecurityFoundation==8.5.1 132 | pyobjc-framework-SecurityInterface==8.5.1 133 | pyobjc-framework-ServiceManagement==8.5.1 134 | pyobjc-framework-ShazamKit==8.5.1 135 | pyobjc-framework-Social==8.5.1 136 | pyobjc-framework-SoundAnalysis==8.5.1 137 | pyobjc-framework-Speech==8.5.1 138 | pyobjc-framework-SpriteKit==8.5.1 139 | pyobjc-framework-StoreKit==8.5.1 140 | pyobjc-framework-SyncServices==8.5.1 141 | pyobjc-framework-SystemConfiguration==8.5.1 142 | pyobjc-framework-SystemExtensions==8.5.1 143 | pyobjc-framework-UniformTypeIdentifiers==8.5.1 144 | pyobjc-framework-UserNotifications==8.5.1 145 | pyobjc-framework-UserNotificationsUI==8.5.1 146 | pyobjc-framework-VideoSubscriberAccount==8.5.1 147 | pyobjc-framework-VideoToolbox==8.5.1 148 | pyobjc-framework-Virtualization==8.5.1 149 | pyobjc-framework-Vision==8.5.1 150 | pyobjc-framework-WebKit==8.5.1 151 | pyparsing==3.0.9 152 | PyPrind==2.11.3 153 | pySmartDL==1.3.4 154 | pyttsx3==2.90 155 | pytz-deprecation-shim==0.1.0.post0 156 | requests==2.28.1 157 | six==1.16.0 158 | soupsieve==2.3.2.post1 159 | SpeechRecognition==3.8.1 160 | tzdata==2022.6 161 | tzlocal==4.2 162 | urllib3==1.26.12 163 | --------------------------------------------------------------------------------