breakfastquay / rubberband

Official mirror of Rubber Band Library, an audio time-stretching and pitch-shifting library.
http://breakfastquay.com/rubberband/
GNU General Public License v2.0
566 stars 91 forks source link

Piping support for the CLI? #47

Open Ziao opened 2 years ago

Ziao commented 2 years ago

First off, amazing library. I have been using this a lot and am very happy with it. I have one question, is it currently possible to pipe wav files into / out of this tool? When I specify - as the output, I get the following message ERROR: Failed to open output file "-" for writing: Error : this file format does not support pipe write. which may indicate that it's supported but that I am doing something wrong.

If this is not supported, would it be something that is easy to add?

Thanks a lot! Nick

cannam commented 2 years ago

The error message comes from libsndfile, I think - the Rubber Band command-line tool just passes filenames direct to libsndfile.

My guess is that libsndfile will write to a pipe if it's writing headerless raw audio data, but refuses to write WAV data to a pipe because WAV has a header that needs to be updated with the data length when the file is closed. Unfortunately there is no way to use raw data with the Rubber Band tool because it would be necessary to specify the details of the raw format explicitly to the program, and that part of the puzzle simply isn't there.