How can I send my audio file to stdout with the libsox library?

338 Views Asked by At

I'm setting an audio program on my raspberry using libsox, the developer library of SoX. And for instance I need to make it play my input mp3 file to my stdout output so I can hear the song with my earpiece connected to the jack port of the raspberry.

So I used this code, but the "-" in the filetype of the function "sox_open_write()" doesn't transfer my song into the stdout. I got this error:

no handler for given file type -' exe1: example1.c:99: main: Assertionin = sox_open_read(argv[1], NULL, >> NULL,"-")' failed.

Here is the code :

https://github.com/dmkrepo/libsox/blob/master/src/example1.c#L145

I've tried to output the audio into another file and it is working. Also tried to look at the function original developper made in fossies libsox website.

assert(out = sox_open_write(argv[2], &in->signal, NULL, "-", NULL, NULL));

For instance I just changed one of the parameter of the function. In the manual it's supposed to transfer the audio file to stdout output. But an error occurs

I just expect the program to play a single song.

0

There are 0 best solutions below