OSX equivalent for channel sound for linux aplay

In Ubuntu, I can use aplay to play real-time generated sound from a script, passing the output of my script to aplay stdin:

 ./generate_sound.py | aplay -r 2000 -c2 -f MU_LAW cat sample.wav | aplay 

Is there a way to do the same from a terminal in OSX? I think afplay does not support this ...

Maybe someone knows another OSX command line audio player that would do the trick?

+5
source share
1 answer

I had high hopes for redirection / traffic, but afplay /dev/stdin <<< $(generate_sound.py) failed for all the formats I tried. Unfortunately, afplay does not allow you to specify a format, and therefore it tries to sniff it, which is probably due to a search that does not work with pipes.

I think you better find another player on the command line. sox seems like a good candidate. And! It is installed via homegrown: brew install sox .

+2
source

Source: https://habr.com/ru/post/1240679/


All Articles