Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💻Playsound Missing .Wav + Extra Characters from Text Splitting🤖 #5

Open
sigma7eaven opened this issue Dec 17, 2023 · 2 comments

Comments

@sigma7eaven
Copy link

Hi, after re install of everything, there's still these errors about Cannot specify extra characters after a string enclosed in quotation marks, Text splitted to sentences and strange characters? Then the missing .wav file playsound error. I wonder if you found anything more about it?

TEXT SPLIT AND STRANGE CHARACTERS
Listening...
==> answer: I am an AI language model and do not have the ability to feel emotions or experience physical sensations. However, I am here to assist you with any qu
estions or tasks you may have. How can I help you today?

Text splitted to sentences.
['I am an AI language model and do not have the ability to feel emotions or experience physical sensations.', 'However, I am here to assist you with any questions
or tasks you may have.', 'How can I help you today?']
aɪ æm ən aɪ læŋɡwɪd͡ʒ mɑdəl ænd du nɑt hæv ðə əbɪləti tə fil ɪmoʊʃənz ɔɹ ɪkspɪɹiəns fɪzɪkəl sɛnseɪʃənz. << STRANGE CHARACTERS
[!] Character 'Í¡' not found in the vocabulary. Discarding it.
Processing time: 1.6647748947143555
Real-time factor: 0.10804181312824211

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\talkGPT4All-main> & c:/talkGPT4All-main/.venv/Scripts/Activate.ps1
(.venv) PS C:\talkGPT4All-main> & c:/talkGPT4All-main/.venv/Scripts/python.exe c:/talkGPT4All-main/src/talkgpt4all/chat.py
==> GPT4All model: mistral-7b-instruct-v0.1.Q4_0.gguf, Whisper model: base

tts_models/en/ljspeech/glow-tts is already downloaded.
vocoder_models/en/ljspeech/multiband-melgan is already downloaded.
Using model: glow_tts
Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > log_func:np.log10
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:0
| > fft_size:1024
| > power:1.1
| > preemphasis:0.0
| > griffin_lim_iters:60
| > signal_norm:False
| > symmetric_norm:True
| > mel_fmin:50.0
| > mel_fmax:7600.0
| > pitch_fmin:1.0
| > pitch_fmax:640.0
| > spec_gain:1.0
| > stft_pad_mode:reflect
| > max_norm:1.0
| > clip_norm:True
| > do_trim_silence:True
| > trim_db:60
| > do_sound_norm:False
| > do_amp_to_db_linear:True
| > do_amp_to_db_mel:True
| > do_rms_norm:False
| > db_level:None
| > stats_path:None
| > base:10
| > hop_length:256
| > win_length:1024
Vocoder Model: multiband_melgan
Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > log_func:np.log10
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:0
| > fft_size:1024
| > power:1.5
| > preemphasis:0.0
| > griffin_lim_iters:60
| > signal_norm:True
| > symmetric_norm:True
| > mel_fmin:50.0
| > mel_fmax:7600.0
| > pitch_fmin:0.0
| > pitch_fmax:640.0
| > spec_gain:1.0
| > stft_pad_mode:reflect
| > max_norm:4.0
| > clip_norm:True
| > do_trim_silence:True
| > trim_db:60
| > do_sound_norm:False
| > do_amp_to_db_linear:True
| > do_amp_to_db_mel:True
| > do_rms_norm:False
| > db_level:None
| > stats_path:C:\Users\S373NTH\AppData\Local\tts\vocoder_models--en--ljspeech--multiband-melgan\scale_stats.npy
| > base:10
| > hop_length:256
| > win_length:1024
Generator Model: multiband_melgan_generator
Discriminator Model: melgan_multiscale_discriminator
Listening...
==> answer: I am an AI language model and do not have the ability to feel emotions or experience physical sensations. However, I am here to assist you with any qu
estions or tasks you may have. How can I help you today?
Text splitted to sentences.
['I am an AI language model and do not have the ability to feel emotions or experience physical sensations.', 'However, I am here to assist you with any questions
or tasks you may have.', 'How can I help you today?']
aɪ æm ən aɪ læŋɡwɪd͡ʒ mɑdəl ænd du nɑt hæv ðə əbɪləti tə fil ɪmoʊʃənz ɔɹ ɪkspɪɹiəns fɪzɪkəl sɛnseɪʃənz.
[!] Character 'Í¡' not found in the vocabulary. Discarding it.
Processing time: 1.6647748947143555
Real-time factor: 0.10804181312824211

Error 305 for command:
    open "C:\Users\S373NTH\AppData\Local\Temp\talkgpt4all-73qu1lv2.wav"
Cannot specify extra characters after a string enclosed in quotation marks.

Error 305 for command:
    close "C:\Users\S373NTH\AppData\Local\Temp\talkgpt4all-73qu1lv2.wav"
Cannot specify extra characters after a string enclosed in quotation marks.

Failed to close the file: "C:\Users\S373NTH\AppData\Local\Temp\talkgpt4all-73qu1lv2.wav"
Traceback (most recent call last):
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 126, in
chat_bot.run()
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 38, in run
self._text_to_voice(answer)
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 74, in _text_to_voice
playsound(tmp_file.name)
File "C:\talkGPT4All-main.venv\Lib\site-packages\playsound.py", line 72, in _playsoundWin
winCommand(u'open {}'.format(sound))
File "C:\talkGPT4All-main.venv\Lib\site-packages\playsound.py", line 64, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 305 for command:
open "C:\Users\S373NTH\AppData\Local\Temp\talkgpt4all-73qu1lv2.wav"
Cannot specify extra characters after a string enclosed in quotation marks.
(.venv) PS C:\talkGPT4All-main>

@sigma7eaven
Copy link
Author

The file is being deleted before it's read by playsound?

Downgrade to https://stackoverflow.com/questions/68861878/error-cannot-specify-extra-characters-after-a-string-enclosed-in-quotation-mark

uninstalled playsound-1.3.0
pip install playsound==1.2.2

PS C:\talkGPT4All-main> & c:/talkGPT4All-main/.venv/Scripts/Activate.ps1
(.venv) PS C:\talkGPT4All-main> & c:/talkGPT4All-main/.venv/Scripts/python.exe c:/talkGPT4All-main/src/talkgpt4all/chat.py
==> GPT4All model: mistral-7b-instruct-v0.1.Q4_0.gguf, Whisper model: base

tts_models/en/ljspeech/glow-tts is already downloaded.
vocoder_models/en/ljspeech/multiband-melgan is already downloaded.
Using model: glow_tts
Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > log_func:np.log10
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:0
| > fft_size:1024
| > power:1.1
| > preemphasis:0.0
| > griffin_lim_iters:60
| > signal_norm:False
| > symmetric_norm:True
| > mel_fmin:50.0
| > mel_fmax:7600.0
| > pitch_fmin:1.0
| > pitch_fmax:640.0
| > spec_gain:1.0
| > stft_pad_mode:reflect
| > max_norm:1.0
| > clip_norm:True
| > do_trim_silence:True
| > trim_db:60
| > do_sound_norm:False
| > do_amp_to_db_linear:True
| > do_amp_to_db_mel:True
| > do_rms_norm:False
| > db_level:None
| > stats_path:None
| > base:10
| > hop_length:256
| > win_length:1024
Vocoder Model: multiband_melgan
Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > log_func:np.log10
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:0
| > fft_size:1024
| > power:1.5
| > preemphasis:0.0
| > griffin_lim_iters:60
| > signal_norm:True
| > symmetric_norm:True
| > mel_fmin:50.0
| > mel_fmax:7600.0
| > pitch_fmin:0.0
| > pitch_fmax:640.0
| > spec_gain:1.0
| > stft_pad_mode:reflect
| > max_norm:4.0
| > clip_norm:True
| > do_trim_silence:True
| > trim_db:60
| > do_sound_norm:False
| > do_amp_to_db_linear:True
| > do_amp_to_db_mel:True
| > do_rms_norm:False
| > db_level:None
| > stats_path:C:\Users\S373NTH\AppData\Local\tts\vocoder_models--en--ljspeech--multiband-melgan\scale_stats.npy
| > base:10
| > hop_length:256
| > win_length:1024
Generator Model: multiband_melgan_generator
Discriminator Model: melgan_multiscale_discriminator
Listening...
==> answer: Hello! How can I assist you today?
Text splitted to sentences.
['Hello!', 'How can I assist you today?']
Processing time: 0.6743762493133545
Real-time factor: 0.19353910216263365
Traceback (most recent call last):
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 126, in
chat_bot.run()
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 38, in run
self._text_to_voice(answer)
File "c:\talkGPT4All-main\src\talkgpt4all\chat.py", line 74, in _text_to_voice
playsound(tmp_file.name)
File "C:\talkGPT4All-main.venv\Lib\site-packages\playsound.py", line 35, in _playsoundWin
winCommand('open "' + sound + '" alias', alias)
File "C:\talkGPT4All-main.venv\Lib\site-packages\playsound.py", line 31, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 275 for command:
open "C:\Users\S373NTH\AppData\Local\Temp\talkgpt4all-vek5skcu.wav" alias playsound_0.5306465774055863
Cannot find the specified file. Make sure the path and filename are correct.
(.venv) PS C:\talkGPT4All-main>

@sigma7eaven
Copy link
Author

Notes on Possible Solutions
https://stackoverflow.com/questions/68518657/what-is-problem-in-this-python-code-cannot-specify-extra-characters-after-a-stra

Check if your .wav file is valid (try to test other .wav files). Check whether you use the correct character set, use PlaySoundA ("path\file") or PlaySoundW(L"path\file"), or as comment use PlaySound(TEXT("Path\file")). NOTE to use double backslashes in path. Check if there is a redirected folder in the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant