0

How do I take a string such as: K = "Hello User" and use it in the code that says it using festival tts: os.system('echo "Hello user." | festival --tts')? Is there a way to do it some other way (1st way would be better) I tried searching to do this on Google, Youtube and StackOverflow but I guess that there is very less info on festival tts. If anyone can help it would nice. Thank you. The complete code is:

import os        
K = "Hello user."        
os.system('echo "X" | festival --tts') 

I want to enter the text from string K to the Marked 'X' in the last line. Also I use linux-Terminal to run the code.

T3KBAU5
  • 1,861
  • 20
  • 26
ConfidingOz
  • 47
  • 3
  • 9

4 Answers4

0

Use str.format.

import os        
K = "Hello user."        
os.system('echo "{0}" | festival --tts'.format(K)) 
Trevor Merrifield
  • 4,541
  • 2
  • 21
  • 24
0

You should just be able to do something like this:

os.system('echo %s | festival --tts' % K)

That should replace the %s with the string K

batorni
  • 24
  • 2
0

You always shoud use direct func call insead create a new process. Create new process or a series of process take a memory usage and additional loading CPU. When you developing system you should receive API from software provider:.

Let's I show you Festival python binding example:

import festival
festival.initialize(1, 210000)
festival.say("Hello World")

You may receive more detail on festival python binding GitHub project or on official Python PyPi server.

Vitold S.
  • 402
  • 4
  • 13
0

Install festival by typing on your Ubuntu terminal

sudo apt install festival          

and then:

echo 'heyyy'    | festival --tts   
Employee
  • 3,109
  • 5
  • 31
  • 50