cyberofficial / Synthalingua

Synthalingua - Real Time Translation
http://synthalingua.site/
GNU General Public License v3.0
188 stars 16 forks source link

Audio source must be entered before adjusting #63

Closed unusualgarment closed 8 months ago

unusualgarment commented 8 months ago

I am trying to run your program and installed everything. I had trouble installing CUDA and only installed the Nsight VSE and runtime components. I disabled nsight systems, nsight compute, visual studio integration, physx, geforce experience, hd audio and display driver.

Anyway This is what I get when launching run.bat

You are already using the latest version. Current version: 1.0.9986

Using device: cuda CUDA device name: NVIDIA GeForce RTX 3060 VRAM available: 12287.375 MB Audio source must be entered before adjusting, see documentation for AudioSource; are you using source outside of a with statement? Traceback (most recent call last): File "transcribe_audio.py", line 643, in File "transcribe_audio.py", line 212, in main File "speech_recognition__init.py", line 189, in exit__ AttributeError: 'NoneType' object has no attribute 'close' [57760] Failed to execute script 'transcribe_audio' due to unhandled exception! Press any key to continue . . .

cyberofficial commented 8 months ago

Hello! What does your run.bat contain?

Currently the program only creates "livetranslation.bat" after installing, or are using the portable build?

unusualgarment commented 8 months ago

I downloaded the latest exe with 4 parts. It only creates run.bat and transcribe_audio.exe. Running the program says portable build.

run.bat contains

@echo off Title Synthalingua - Portable Version (Windows) (Alpha)

:start Echo Synthalingua - Portable Version (Windows) (Alpha) Echo. Starting Synthalingua... Echo. :: Only modify the line below. transcribe_audio.exe --ram 6gb --non_english --translate --language ja set_microphone 3 :: Only modify the line above. Do not touch anything else. pause goto start

Read is at: https://github.com/cyberofficial/Synthalingua

If you set a portnumber, you will switch on the web server, you can access it at: http://localhost:PORTNUMBER

With the command flag --port 4000, you can use query parameters like ?showoriginal, ?showtranslation, and ?showtranscription to show specific elements. If any other query parameter is used or no query parameters are specified, all elements will be shown by default. You can choose another number other than 4000 if you want.

For example:

"http://localhost:4000?showoriginal" will show the original detected text. "http://localhost:4000?showtranslation" will show the translated text. "http://localhost:4000?showtranscription" will show the transcribed text. "http://localhost:4000/?showoriginal&showtranscription" will show the original and transcribed text. "http://localhost:4000" or "http://localhost:4000?otherparam=value" will show all elements by default.

:: COMMANDS :: Options: -h, --help show this help message and exit --ram {1gb,2gb,4gb,6gb,12gb} Model to use --ramforce Force the model to use the RAM setting provided. Warning: This may cause the model to crash. --non_english Don't use the english model. --energy_threshold ENERGY_THRESHOLD Energy level for mic to detect. --mic_calibration_time MIC_CALIBRATION_TIME How long to calibrate the mic for in seconds. To skip user input type 0 and time will be set to 5 seconds. --record_timeout RECORD_TIMEOUT How real time the recording is in seconds. --phrase_timeout PHRASE_TIMEOUT How much empty space between recordings before we consider it a new line in the transcription. --no_log Only show the last line of the transcription. --translate Translate the transcriptions to English. --transcribe transcribe the text into the desired language. --language {af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,zh,Afrikaans,Albanian,Amharic,Arabic,Armenian,Assamese,Azerbaijani,Bashkir,Basque,Belarusian,Bengali,Bosnian,Breton,Bulgarian,Burmese,Castilian,Catalan,Chinese,Croatian,Czech,Danish,Dutch,English,Estonian,Faroese,Finnish,Flemish,French,Galician,Georgian,German,Greek,Gujarati,Haitian,Haitian Creole,Hausa,Hawaiian,Hebrew,Hindi,Hungarian,Icelandic,Indonesian,Italian,Japanese,Javanese,Kannada,Kazakh,Khmer,Korean,Lao,Latin,Latvian,Letzeburgesch,Lingala,Lithuanian,Luxembourgish,Macedonian,Malagasy,Malay,Malayalam,Maltese,Maori,Marathi,Moldavian,Moldovan,Mongolian,Myanmar,Nepali,Norwegian,Nynorsk,Occitan,Panjabi,Pashto,Persian,Polish,Portuguese,Punjabi,Pushto,Romanian,Russian,Sanskrit,Serbian,Shona,Sindhi,Sinhala,Sinhalese,Slovak,Slovenian,Somali,Spanish,Sundanese,Swahili,Swedish,Tagalog,Tajik,Tamil,Tatar,Telugu,Thai,Tibetan,Turkish,Turkmen,Ukrainian,Urdu,Uzbek,Valencian,Vietnamese,Welsh,Yiddish,Yoruba} Language to translate from. --target_language {af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,zh,Afrikaans,Albanian,Amharic,Arabic,Armenian,Assamese,Azerbaijani,Bashkir,Basque,Belarusian,Bengali,Bosnian,Breton,Bulgarian,Burmese,Castilian,Catalan,Chinese,Croatian,Czech,Danish,Dutch,English,Estonian,Faroese,Finnish,Flemish,French,Galician,Georgian,German,Greek,Gujarati,Haitian,Haitian Creole,Hausa,Hawaiian,Hebrew,Hindi,Hungarian,Icelandic,Indonesian,Italian,Japanese,Javanese,Kannada,Kazakh,Khmer,Korean,Lao,Latin,Latvian,Letzeburgesch,Lingala,Lithuanian,Luxembourgish,Macedonian,Malagasy,Malay,Malayalam,Maltese,Maori,Marathi,Moldavian,Moldovan,Mongolian,Myanmar,Nepali,Norwegian,Nynorsk,Occitan,Panjabi,Pashto,Persian,Polish,Portuguese,Punjabi,Pushto,Romanian,Russian,Sanskrit,Serbian,Shona,Sindhi,Sinhala,Sinhalese,Slovak,Slovenian,Somali,Spanish,Sundanese,Swahili,Swedish,Tagalog,Tajik,Tamil,Tatar,Telugu,Thai,Tibetan,Turkish,Turkmen,Ukrainian,Urdu,Uzbek,Valencian,Vietnamese,Welsh,Yiddish,Yoruba} Language to translate to. --auto_model_swap Automatically swap model based on detected language. --device DEVICE Device to use for model. If not specified, will use CUDA if available. Available options: cpu, cuda --cuda_device CUDA_DEVICE CUDA device to use for model. If not specified, will use CUDA device 0. --discord_webhook DISCORD_WEBHOOK Discord webhook to send transcription to. --list_microphones List available microphones and exit. --set_microphone SET_MICROPHONE Set default microphone to use. --auto_language_lock Automatically locks the language based on the detected language after set ammount of transcriptions. --retry Retries the transcription if it fails. May increase output time. --use_finetune Use finetuned model. --updatebranch {master,dev-testing,disable,bleeding-under-work} Check which branch from the repo to check for updates. Default is master, choices are master and dev-testing and bleeding-under-work. To turn off update checks use disable. bleeding- under-work is basically latest changes and can break at any time. --keep_temp Keep temporary audio files. --portnumber PORTNUMBER Port number to run the web server on. If not specified, the web server will not run. --about About the project.

cyberofficial commented 8 months ago

Thanks. Can you open command prompt or power shell and run the command nvidia-smi

You should see something like this.

C:\Users\cyberofficial>nvidia-smi
Fri Oct 27 09:00:55 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 537.58                 Driver Version: 537.58       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3090 Ti   WDDM  | 00000000:2D:00.0  On |                  Off |
| 35%   62C    P2             228W / 450W |  14967MiB / 24564MiB |     72%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

Also can you edit the run file to have --device cpu and see if that works. If so, you may need a reinstall your nvidia drivers if you are having cuda issues.

You should also grab the https://developer.nvidia.com/cuda-downloads installer for CUDA here and use the exe local version rather exe network.

unusualgarment commented 8 months ago

nvidia-smi

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 536.23                 Driver Version: 536.23       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3060      WDDM  | 00000000:0B:00.0  On |                  N/A |
|  0%   54C    P8              24W / 170W |   1961MiB / 12288MiB |      3%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2432    C+G   ...ys\WinUI3Apps\PowerToys.Peek.UI.exe    N/A      |
|    0   N/A  N/A      5428    C+G   ...rwolf\0.233.2.2\OverwolfBrowser.exe    N/A      |
|    0   N/A  N/A      9352    C+G   C:\Windows\explorer.exe                   N/A      |
|    0   N/A  N/A     10772    C+G   ...les\Microsoft OneDrive\OneDrive.exe    N/A      |
|    0   N/A  N/A     11128    C+G   ...al\Discord\app-1.0.9020\Discord.exe    N/A      |
|    0   N/A  N/A     12164    C+G   ...\PowerToys\PowerToys.FancyZones.exe    N/A      |
|    0   N/A  N/A     12196    C+G   ...nt.CBS_cw5n1h2txyewy\SearchHost.exe    N/A      |
|    0   N/A  N/A     12236    C+G   ...2txyewy\StartMenuExperienceHost.exe    N/A      |
|    0   N/A  N/A     12804    C+G   ...werToys\PowerToys.PowerLauncher.exe    N/A      |
|    0   N/A  N/A     14036    C+G   ...t.LockApp_cw5n1h2txyewy\LockApp.exe    N/A      |
|    0   N/A  N/A     14168    C+G   ...m Files\Mozilla Firefox\firefox.exe    N/A      |
|    0   N/A  N/A     15352    C+G   ...werToys\PowerToys.ColorPickerUI.exe    N/A      |
|    0   N/A  N/A     15644    C+G   ...y Games\current\service\Service.exe    N/A      |
|    0   N/A  N/A     16092    C+G   ...ekyb3d8bbwe\PhoneExperienceHost.exe    N/A      |
|    0   N/A  N/A     16136    C+G   ...5n1h2txyewy\ShellExperienceHost.exe    N/A      |
|    0   N/A  N/A     16792    C+G   ...on\118.0.2088.69\msedgewebview2.exe    N/A      |
|    0   N/A  N/A     17648    C+G   ...CBS_cw5n1h2txyewy\TextInputHost.exe    N/A      |
|    0   N/A  N/A     18036    C+G   ...inaries\Win64\EpicGamesLauncher.exe    N/A      |
|    0   N/A  N/A     19488    C+G   ...ne\Binaries\Win64\EpicWebHelper.exe    N/A      |
|    0   N/A  N/A     21220    C+G   ...Mozilla Thunderbird\thunderbird.exe    N/A      |
|    0   N/A  N/A     21304    C+G   ...\cef\cef.win7x64\steamwebhelper.exe    N/A      |
|    0   N/A  N/A     21660    C+G   ...crosoft\Edge\Application\msedge.exe    N/A      |
|    0   N/A  N/A     21856    C+G   ...ces\Razer Central\Razer Central.exe    N/A      |
|    0   N/A  N/A     23564    C+G   Z:\Overwolf\Overwolf.exe                  N/A      |
|    0   N/A  N/A     24220    C+G   ... Synapse 3 Host\Razer Synapse 3.exe    N/A      |
|    0   N/A  N/A     24392    C+G   ...52.0_x64__8wekyb3d8bbwe\GameBar.exe    N/A      |
|    0   N/A  N/A     24668    C+G   ...\iCloud\WebView2\msedgewebview2.exe    N/A      |
|    0   N/A  N/A     25864    C+G   ...1.0_x64__8wekyb3d8bbwe\Video.UI.exe    N/A      |
|    0   N/A  N/A     25908    C+G   ...siveControlPanel\SystemSettings.exe    N/A      |
|    0   N/A  N/A     26488    C+G   ...m Files\Mozilla Firefox\firefox.exe    N/A      |
|    0   N/A  N/A     29172    C+G   C:\Program Files\NordVPN\NordVPN.exe      N/A      |
|    0   N/A  N/A     29964    C+G   ...on\118.0.2088.69\msedgewebview2.exe    N/A      |
|    0   N/A  N/A     32496    C+G   ...Cloudflare WARP\Cloudflare WARP.exe    N/A      |
|    0   N/A  N/A     32724    C+G   ...on\118.0.2088.69\msedgewebview2.exe    N/A      |
+---------------------------------------------------------------------------------------+

run.bat


> Check ENV Module Loaded
> Checking if you are in a virtual environment...
> 
> 
> Checking if portable version is being used...
> Portable version detected, continuing with script...
> 
> 
> Loading Primary Imports
> Loading Extensions
> Version Checker Module Loaded
> Model Downloader Module Loaded
> Discord Module Loaded
> Console Settings Module Loaded
> Warnings Module Loaded
> Languages Module Loaded
> Args Module Loaded
> Web Server Module Loaded
> Extensions Loaded
> 
> 
> 
> 
> Checking for updates...
> You are already using the latest version.
> Current version: 1.0.9986
> 
> 
> 
> Using device: cpu
> Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?
> Traceback (most recent call last):
>   File "transcribe_audio.py", line 643, in <module>
>   File "transcribe_audio.py", line 212, in main
>   File "speech_recognition\__init__.py", line 189, in __exit__
> AttributeError: 'NoneType' object has no attribute 'close'
> [25156] Failed to execute script 'transcribe_audio' due to unhandled exception!
> Press any key to continue . . .

I'm gonna leave CUDA alone for now because I think it's gonna take a lot to troubleshoot why it fails to install the other parts. Unless you think the Nsight systems, Nsight compute, and Visual studio integration is necessary.

cyberofficial commented 8 months ago

Hmmmm one last thing to try, can you see if adding --mic_calibration_time 1 to the flag list?

As for the cuda thing, generally everything should be installed as most of the time they piggy back off each other.

unusualgarment commented 8 months ago
Checking for updates...
You are already using the latest version.
Current version: 1.0.9986

Mic calibration flag detected.

Press [enter] when ready to start mic calibration.
Make sure there is no one speaking during this time.
Waiting for user input...

When i press ENTER


Starting mic calibration...
Traceback (most recent call last):
  File "transcribe_audio.py", line 111, in mic_calibration
  File "speech_recognition\__init__.py", line 383, in adjust_for_ambient_noise
AssertionError: Audio source must be entered before adjusting, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "transcribe_audio.py", line 643, in <module>
  File "transcribe_audio.py", line 136, in main
  File "transcribe_audio.py", line 110, in mic_calibration
  File "speech_recognition\__init__.py", line 189, in __exit__
AttributeError: 'NoneType' object has no attribute 'close'
[24236] Failed to execute script 'transcribe_audio' due to unhandled exception!
Press any key to continue . . .
cyberofficial commented 8 months ago

Okay, narrows stuff down a whole lot.

Do you have any microphone sources or loop back devices? The error that is occurring means you do not have default microphones set that are capable of recording through software.

Make sure you have microphone access enabled like so. ApplicationFrameHost_4fy7411wD8

in sound settings, make sure have chosen a default micrphone ApplicationFrameHost_JjvfhLgrIe

unusualgarment commented 8 months ago

Thanks, my microphone was off. It worked after turning it on. I installed Voicemeeter as well to pick up my desktop audio. I believe these two things should prob in some faq somewhere for those with no experience like me with this stuff.

cyberofficial commented 8 months ago

Thanks for the replies and being patient with me. if you have any more errors, feel free to create a new issue.

I will implement a warning system for users with out microphones in the next update soon to be released.