I am working on text to speech algorithm, i finally made it, what this algorithm do is turn an html file
into speech, like that : python record.py file.html
and all good on here, but i want to run the same command on multiple files using this command :
python record.py file1.html & python record.py file2.html & python record.py file3.html
but instead of recording every audio separately i get an overlap on the output .
PS1: i am using ubuntu server, and i want to run my command on over 6000 file, the approximate time needed per file is around 20 mins bc they are a big files.
PS2: I am using pyaudio to record the voices, and here is the recording part in my code:
from seleniumwire import webdriver
import sys
from webdriver_manager.chrome import ChromeDriverManager
import time
import pyaudio
import wave
from selenium.webdriver.chrome.options import Options
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
chrome_options = Options()
chrome_options.add_argument("--headless")
browser = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)
#selenium part
browser.get('website')
search = browser.find_element_by_id("text-area")
search.clear()
data="this is a simple test"
search.send_keys(data)
time.sleep(2)
browser.find_element_by_id("btn").click()
print("waiting for audio")
size = len(data)/200
time.sleep(size*2)
print("audio detected")
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
#number = len(data)
RECORD_SECONDS = size*17
WAVE_OUTPUT_FILENAME = 'first.mp3'
open(WAVE_OUTPUT_FILENAME, "wb+")
frames = []
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE,input=True, frames_per_buffer=CHUNK)
print("started recording")
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
audio = stream.read(CHUNK)
frames.append(audio)
print("end of recording")
stream.stop_stream()
stream.close()
p.terminate()
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(CHANNELS)
wf.setsampwidth(p.get_sample_size(FORMAT))
wf.setframerate(RATE)
wf.writeframes(b''.join(frames))
wf.close()
Is there any way to record audio coming from a certain PID.
I've heard about docker containers, but i dont know if it gonna help in this situation.
the way i did solve it was to download the audio files from the website instead of
recording them, this link helped a lot.