<p>
<p>Hello HPR, this is your host Archer72, for another episode of Hacker
Public Radio. <br> My subject today is Piper voice synthesis, continued.
<br></p>
<p>In response to Ken's comment on my show, hpr4172 Re: hpr4072 Piper
voice<br> synthesis, I am responding to his comment with a solution. I'm
glad that Ken <br> commented, because I had put the problem on the back
burner and forgot about it.<br> Both of us had the <code>make</code>
command for the Piper github repo fail at 22%. <br></p>
I ignored it for the time being and compiled Piper for the Raspberry Pi
instead.<br> Now here is the comment that got me to figure out how to
get Piper working on my<br> own Fedora 40 laptop.
</p>
<p>Comment #1 posted on 2024-07-24 14:04:27 by Ken Fallon <br> Fails on
Fedora 40</p>
<pre><code>[ 22%] Linking C shared library libespeak-ng.so /usr/bin/ld:
../ucd-tools/libucd.a(case.c.o): relocation R_X86_64_32S against `.rodata&#39; can
not be used when making a shared object; recompile with -fPIC /usr/bin/ld:
failed to set dynamic section sizes: bad value collect2: error: ld returned 1
exit status [snip] make: *** [Makefile:5: all] Error 2</code></pre>
<p>Comment #2 posted on 2024-07-26 09:38:17 by Archer72 <br> Re:Fails on
Fedora 40</p>
<p>Hi Ken, I get the same failure, and found that there was a release in
2023</p>
<p><a href="github%20com/rhasspy/piper/releases/tag/2023.11.14-2"
title="Github Piper repo">Github Piper repo</a></p>
<p>
I put the downloaded piper directory in <code>/opt</code> , along with
the<br> <code>piper-voices/en</code> directory and have a successful
voice output.
</p>
<pre><code>uname -r

6.9.5-200.fc40.x86_64

[piper] [info] Loaded voice in 0.33 second(s)
[piper] [info] Initialized piper Output directory: /home/mark/./output.wav</code></pre>
<p>End of comments</p>
<p>
<p>In further conversations with Ken, I found that a vital part of Piper
voice<br> synthesis had been forgotten. For example, if you are using
Piper to convert a<br> text file to .wav, the command need to include
the following:<br> input.txt piper executable location, i.e.
<code>/opt/piper/piper</code></p>
<p><code>--model</code>, and the model location, i.e.
<code>/opt/piper-voices/</code></p>
<p>note, the voice used need to include the voice in .onnx format and
also the<br> voice configuration in .json format</p>
<p><code>--output_file output.wav</code></p>
The final script is included in the show notes.
</p>
<pre><code>#!/bin/bash
cat &quot;$1&quot; | /opt/piper/piper --model /opt/piper-voices/en_US/kusal/medium/en_US-kusal-medium.onnx --output_file output.wav</code></pre>
<p>That's it! Now if you had downloaded the voices from hpr4172, there
should be a<br> successful voice to text output.</p>
<p>To put the final touches on 'my' voice, which is the
en_US-kusal-medium voice,<br> processed just a bit with the
<code>sox</code> program.</p>
<pre><code>## ~/bin/make-my-voice.sh
#!/bin/bash
# Add 2 seconds of silence to the beginning of the file
sox $1 output.wav pad 2

## Reduce clipping
sox output.wav output-mid.wav vol 0.99

# Reduce the tempo by 12%
sox output-mid.wav final_output.wav tempo 0.88</code></pre>
<p>
<p>One last thing. It was brought to my attention that the Piper voice,
Bryce 'may'<br> sound like William Shatner in the original Star Trek tv
series.</p>
<p>I will put that clip in here and see what the community thinks. Feel
free to<br> leave a comment saying 'yay' or 'nay' on this opinion.</p>
<p>If this tool works for you, feel free to leave comments on this show.
Better<br> yet, record a show of your own. Looking forward to hearing
from the<br> next host, whether it be by text to speech, or a
microphone.</p>
Remember to support free software and apps in the F-Droid store if you
use Android.
</p>
<p>This has been your host Archer72; Bye</p>
