Jump to content
IGNORED

Audio to speech with ConvertWavToLpc


Eric Lafortune

Recommended Posts

We already have a few options to convert audio files to speech coefficients, suitable for our beloved speech synthesizer: QBox Pro, BlueWizard, python_wizard, and Praat with ConvertPraatToLpc.

 

It's my pleasure to add yet another option: ConvertWavToLpc.

 

ConvertWavToLpc uniquely applies an accurate simulation of the TMS5200/5220 speech processors, including their approximations/quirks/bugs. The approach is intended to return the best possible speech coefficients for all input audio. It has helped me to improve the vocals in version 2 of my Bad Apple demo.

 

The tool comes with a companion tool ConvertLpcToWav to replay the speech file to an audio file, based on the same simulation of the speech processors. It for example allows you to check how the 8-bit accuracy of the output of the TI speech synthesizer accounts for a great deal of white noise.

 

The development turned out to be a deep rabbit hole with months of research in academic papers and practical implementations. I've explored and included/rejected a range of different techniques, discussed in the documentation.

 

The simulation of the the TMS5200/5220 speech processors is derived from the canonical code by Lord Nightmare and others in Mame. I've converted the code from C++ to Java, refactored it for my purpose, cleaned it up, and documented it. I'm happy with the resulting code. The speech processors have the usual random seeds and stateful lattice filters, but they also interleave interpolation of LPC coefficients between speech frames. As a result, optimizing the LPC coefficients of individual frames remains challenging. The quality of the output still depends on a few settings, for which I've tried to provide sane defaults.

 

ConvertWavToLpc and ConvertLpcToWav are part of my Video Tools for the TI-99/4A. You can find the tools, documentation, and source code on Github. Notably, you can find compiled binaries (for Java 14) in the release section. Enjoy! I'm interested to hear about your experiences.
 

  • Like 13
Link to comment
Share on other sites

I'm having trouble getting it to run though. I am not familiar with java, so I tried a few things.

 

I'm working from the binary download on Windows. My Windows log:

 

D:\tools\VideoToolsByEric>java -jar videotools.jar ConvertWavToLpc
no main manifest attribute, in videotools.jar

D:\tools\VideoToolsByEric>set CLASSPATH=d:\tools\VideoToolsByEric

D:\tools\VideoToolsByEric>java ConvertWavToLpc
Error: Could not find or load main class ConvertWavToLpc
Caused by: java.lang.ClassNotFoundException: ConvertWavToLpc

D:\tools\VideoToolsByEric>java --version
java 18.0.2 2022-07-19
Java(TM) SE Runtime Environment (build 18.0.2+9-61)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing)

 

So then I popped over to Ubuntu:

 

tursilion@Ripper:/mnt/d/tools/VideoToolsByEric$ java -jar videotools.jar ConvertWavToLpc
no main manifest attribute, in videotools.jar
tursilion@Ripper:/mnt/d/tools/VideoToolsByEric$ export CLASSPATH=/mnt/d/tools/VideoToolsByEric/
tursilion@Ripper:/mnt/d/tools/VideoToolsByEric$ java ConvertWavToLpc
Error: Could not find or load main class ConvertWavToLpc
Caused by: java.lang.ClassNotFoundException: ConvertWavToLpc
tursilion@Ripper:/mnt/d/tools/VideoToolsByEric$ java --version
openjdk 11.0.19 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1)
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1, mixed mode, sharing)

 

It's definitely pebkac, can you give some from from-scratch steps to get it going?

 

 

Link to comment
Share on other sites

Java needs slightly different settings to specify the class files. Assuming you have downloaded or built the jar archive, on Windows:

set CLASSPATH=d:\tools\VideoToolsByEric\videotools.jar
java ConvertWavToLpc .....

On Linux:

export CLASSPATH=/mnt/d/tools/VideoToolsByEric/videotools.jar
java ConvertWavToLpc .....

(the path contains the jar/zip file name videotools.jar. If it's just a directory, java looks for loose .class files; mostly useful during development)

 

You can also specify the archive with each invocation. On Windows

java -cp d:\tools\VideoToolsByEric\videotools.jar ConvertWavToLpc .....

On Linux:

java -cp /mnt/d/tools/VideoToolsByEric/videotools.jar ConvertWavToLpc .....

(the option -cp specifies the archive in which to look for ConvertWavToLpc. The alternative option -jar looks for a manifest file inside the archive, in which the name of the executable class is specified. This videotools.jar doesn't have such a manifest, mostly because it contains multiple executable classes to choose from.)

 

Note that the class files have been compiled for Java 14 or higher, so Java 11 will refuse to load them.

Edited by Eric Lafortune
  • Like 1
Link to comment
Share on other sites

Ahh, that works! The error messages were such that googling was not giving me anything useful at all, and I didn't even think to check if the -jar command line argument was even correct. Thanks for that! Nice and simple to use, and the results are quite good :)

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...