4

I have a program which uses FIFO files for interacting with the user. An audio call can be made directing the output of arecord to one of the program's FIFO files:

arecord -r 48000 -c 1 -f S16_LE > call_in

An audio call can be answered by directing the output of one of the program's FIFO files to aplay:

aplay -r 48000 -c 1 -f S16_LE - < call_out

How could an audio file be used in place of the first command, the one used to make a call? Let's say I want to play "sound.wav" into that call_in file, how could it be done?

2 Answers2

1

If arecord's input is your sound card, then I suggest: aplay sound.wav & arecord call_in

aplay should play your message. The & allows the next command, arecord, to immediately execute, which should start recording what aplay is sending to your sound card.

Actually, arecord call_in & aplay sound.wav would probably be better, so you can be sure you're recording before the message plays.

Louis Waweru
  • 25,409
  • 45
  • 137
  • 203
0

Assuming the output of arecord is functionally like the contents of the wav file (i.e., they're the same media format), you could just do:

cat sound.wav > call_in
muru
  • 1,336