import pyttsx3 import concurrent.futures import concurrent.futures def Threads1(curr_section, index1, engine): rec_audiofile = 'output' + str(index1) + '.mp3' voices = engine.getProperty('voices') engine.setProperty('rate', 160) engine.setProperty('voice', voices[1].id) engine.save_to_file(curr_section, rec_audiofile) engine.runAndWait() return curr_section all_sections = ['The quick brown fox jumps over the lazy dog', 'the boy jumped over the moon', 'Little Miss Muffet sat on a tuffet, Eating some curds and whey', 'Hickory, dickory, dock The mouse ran up the clock.', 'One, two Buckle my shoe, Three, four Open on the door,', 'Little Bo-Peep has lost her sheep, And cant tell where to find them', 'This Little Piggy, went to market This Little Piggy, stayed home This Little Piggy, had roast beef', 'do your ears hang low? Do they wobble to and fro? Can you tie them in a knot Can you tie them in a bow', 'Hush, little baby, dont say a word, Mamas going to buy you a mockingbird', 'This old man, he played one, He played knickknack on my thumb With a knickknack patty whack, give a dog a bone'] engine = pyttsx3.init() threads_num = 4 with concurrent.futures.ThreadPoolExecutor(max_workers=threads_num) as executor: working_threads = {executor.submit(Threads1, curr_section, index1, engine): curr_section for index1, curr_section in enumerate(all_sections)} for future in concurrent.futures.as_completed(working_threads): current_result = future.result() Hi, when I run the following code. The voice synthasizer starts speaking the words of 1 random paragraph all_section[3] for example ... It still saves all the threads to .mp3 data as the code has requested. But the speaking of 1 paragraph is completely random and uncoded. What could be the reason for this? If anyone has a solution, I would like to change the following code as little as possible. Before, I had kept the code engine = pyttsx3.init() inside the thread function with the other engine ... (instead of how it is now - being piped in) ... but when I kept the engine = pyttsx3.init() inside the thread function ... it threw the following error. OSError: [WinError -2147221008] CoInitialize has not been called Edit In further attempts to solve this problem ... result in the same random voice synthesis. import concurrent.futures import threading import pyttsx3 class TTSThread(threading.Thread): def __init__(self, curr_section, index1): threading.Thread.__init__(self) self.curr_section = curr_section self.index1 = index1 self.engine = pyttsx3.init() def run(self): self.engine.save_to_file(self.curr_section, 'file1' + str(self.index1) + '.mp3') self.engine.runAndWait() def Threads1(curr_section, index1): tts_thread = TTSThread(curr_section, index1) tts_thread.start() all_sections = ['The quick brown fox jumps over the lazy dog', 'the boy jumped over the moon', 'Little Miss Muffet sat on a tuffet, Eating some curds and whey', 'Hickory, dickory, dock The mouse ran up the clock.', 'One, two Buckle my shoe, Three, four Open on the door,', 'Little Bo-Peep has lost her sheep, And cant tell where to find them', 'This Little Piggy, went to market This Little Piggy, stayed home This Little Piggy, had roast beef', 'do your ears hang low? Do they wobble to and fro? Can you tie them in a knot Can you tie them in a bow', 'Hush, little baby, dont say a word, Mamas going to buy you a mockingbird', 'This old man, he played one, He played knickknack on my thumb With a knickknack patty whack, give a dog a bone'] threads_num = 4 with concurrent.futures.ThreadPoolExecutor(max_workers=threads_num) as executor: working_threads = {executor.submit(Threads1, curr_section, index1): curr_section for index1, curr_section in enumerate(all_sections)} for future in concurrent.futures.as_completed(working_threads): current_result = future.result() Even when modifying the following google example code, google code example from engine.speak() into engine.save_to_file() import pyttsx3 import threading def speak_in_thread(text, index1): engine = pyttsx3.init() engine.save_to_file(text, 'file1' + str(index1) + '.mp3') engine.runAndWait() if __name__ == "__main__": thread1 = threading.Thread(target=speak_in_thread, args=("Hello from thread one!", 1)) thread2 = threading.Thread(target=speak_in_thread, args=("Greetings from thread two!", 2)) thread1.start() thread2.start() thread1.join() thread2.join() returns the following error. OSError: [WinError -2147221008] CoInitialize has not been called Continue reading...