skip to Main Content

I have downloaded a program from Github a Ubuntu/Python program to produce Talkie voice files (LPC) from Audio .wav files.
https://github.com/berrak/wav-files-to-arduino-talkie-lpc#python-language-installation
But the problem is that I have to manually do it from the CLI, as it only allows one file to be processed at a time.
I have at least 43 files to do, so this is SLOW.

I would like to put this into a python script that calls the CLI repeatedly with a list of files names attached to the CLI.
I have no control over the arguments given in the command line.
The CLI is python3 python_wizard -S -T tms5220 -f arduino ae.wav >> wavelpc.h

I need to change the ae.wav file to the files I need to process in the script.
I am quite happy to repeat the same command in the script, and manually change the file name to what it should be, but this does not work in python.
But I have tried some suggestions on various websites, but to no avail.
I have no programming experience in Python, so I am a bit lost!

I tried the Rumpy process, and the import sys, subprocess to no avail.
It just comes up with errors I don’t understand.

2

Answers


  1. Chosen as BEST ANSWER

    I have found the answer which is to use a BASH script. The Original advice from the author was to include some python commands at the beginning, but when I stripped these out, the CLI line now works and takes each file name and executes the call to python_wizard, updating the file and then executing the next command The command is in the form of

    python3  /home/stephena/python_wizard/python_wizard -S -T tms5220 -f arduino ae.wav >> wavelpc.h
    

    I changed the filename of the .wav file on each line. The >> adds to the file rather overwriting it. The File name is Fredall.sh and to execute it I change directory to the python_wizard directory and run the following command

    bash Fredall.sh
    

  2. All I have is 43 wave files in the same directory as python_wizard. … How do I get it to call all the CLI including the setting repeatedly?

    If there are no other wave files in the directory, you can

    for file in *.wav
    do  python3 python_wizard -S -T tms5220 -f arduino "$file"
    done >>wavelpc.h
    

    (if you really want to append the output to wavelpc.h – otherwise use >wavelpc.h).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search