Skip to content

how to pass variable vaw file to whispercpp #1845

Discussion options

You must be logged in to vote

ChatGPT saved my day:

In the first code snippet, when using subprocess.Popen with stdin=subprocess.PIPE, you are trying to pass the WAV data directly to the subprocess through its standard input. However, the whispercpp command seems to expect an actual file path with the -f option, not the audio data through standard input.

In the second code snippet, you save the audio data to a temporary WAV file (/dev/shm/temp.wav) and then pass the file path to the whispercpp command, which works.

If you want to use an in-memory file-like object, you can use the tempfile module to create a temporary file in memory. Here's an example:

    import tempfile
    
    # ... your existing code ...
    
  …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@trappedinspacetime
Comment options

Answer selected by trappedinspacetime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant