chaosparrot / parrot.py

Computer interaction using audio and speechrecognition
MIT License
139 stars 36 forks source link

issues with installation in manjaro #49

Open alan-barzilay opened 7 months ago

alan-barzilay commented 7 months ago

hi! I was following the guide for my installation but upon running python3 settings.py I got the following error:

❯ python3 settings.py
NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python3-tk python3-dev

After searching the error online I found this issue on pyautogui: https://github.com/asweigart/pyautogui/issues/683 It's not very clear to me what's causing this problem. But there was a solution proposed that seems to work for me, which is to simply install TK through pacman.

However now when I run python3 settings.py I get a bunch of warnings:

❯ python3 settings.py
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Welcome to Parrot.PY setup!
----------------------------
Enter one of the buttons below and press enter to start
 - [R] for recording
 - [V] for resegmenting audio files with different thresholds
       and converting files into different formats
 - [L] for learning the data
 - [C] for combining multiple models into one model
 - [A] for analyzing the performance of the models
 - [X] for exiting setup

Is this normal or expected behavior? Not sure what is causing it or if It's anything important at all since I can still use the script normally.

alan-barzilay commented 7 months ago

Actually on further inspection the script seems to be unstable. The first time I tried to make a recording, there were 11 possible microphones for me to pick and it crashed before the recording session started, during the countdown. On following attempts the microphones list was reduced to only 3 and I managed to make some recordings, but it still crashes after some time. I am not sure what are triggering these crashes, am I doing something wrong?

crash:

These sounds already have a folder:
 -  speach                         ( 00:04 )

NOTE: It is recommended to record roughly the same amount for each sound
As it will improve the ability for the machine learning models to learn from the data

Whats the name of the sound are you recording? teste
What microphone do you want to record with? ( Empty is the default system mic, [X] exits the recording menu )
You can put a space in between numbers to record with multiple microphones
[0] - HDA Intel PCH: ALC257 Analog (hw:1,0) ALSA
[5] - pulse ALSA
[6] DEFAULT - default ALSA
0
Using input from HDA Intel PCH: ALC257 Analog (hw:1,0) ALSA

Record keyboard controls:
[SPACE] is used to pause and resume the recording session
[BACKSPACE] or [-] removes the last 3 seconds of the recording
[ESC] stops the current recording

Recording paused!
 Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2050
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2721
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2845
Traceback (most recent call last):
  File "/home/barzilay/git/parrot.py/settings.py", line 47, in <module>
    root_navigation( True )
  File "/home/barzilay/git/parrot.py/settings.py", line 24, in root_navigation
    select_mode()
  File "/home/barzilay/git/parrot.py/settings.py", line 29, in select_mode
    record_sound()
  File "/home/barzilay/git/parrot.py/lib/record_data.py", line 263, in record_sound
    non_blocking_record(labels, FULL_WAVE_OUTPUT_FILENAME, SRT_FILENAME, microphone_index, index==0)
  File "/home/barzilay/git/parrot.py/lib/record_data.py", line 363, in non_blocking_record
    audio.open(format=FORMAT, channels=CHANNELS,
  File "/home/barzilay/git/parrot.py/.venv_parrot/lib/python3.11/site-packages/pyaudio/__init__.py", line 639, in open
    stream = PyAudio.Stream(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/barzilay/git/parrot.py/.venv_parrot/lib/python3.11/site-packages/pyaudio/__init__.py", line 441, in __init__
    self._stream = pa.open(**arguments)
                   ^^^^^^^^^^^^^^^^^^^^
OSError: [Errno -9997] Invalid sample rate
/usr/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
alan-barzilay commented 7 months ago

could the issue be the microphone i chose? I just picked the first one listed, the names meant nothing that I could recognize. Since it seems to be complaining about the sample rate I wonder if its something related to alsa/ the microphone

alan-barzilay commented 7 months ago

now there is 15 microphone options haha I think its the same 11 mics but in a weird reordering.

Am I being stupid? I have only 2 microphones, the laptop built-in one and a razer one

What microphone do you want to record with? ( Empty is the default system mic, [X] exits the recording menu )
You can put a space in between numbers to record with multiple microphones
[0] - Razer Seiren Mini: USB Audio (hw:0,0) ALSA
[1] - HDA Intel PCH: ALC257 Analog (hw:1,0) ALSA
[6] - sysdefault ALSA
[7] - spdif ALSA
[8] - lavrate ALSA
[9] - samplerate ALSA
[10] - speexrate ALSA
[11] - pulse ALSA
[12] - speex ALSA
[13] - upmix ALSA
[14] - vdownmix ALSA
[15] DEFAULT - default ALSA