How to create artificial microphone input in Linux?
I'm working on an audio recognition project.
For testing, I'd like to be able to have a program:
- load audio data from a file
- provide it to the Linux kernel, as if it were coming from a microphone
- have any user-space program sampling the microphone be obtaining data sourced from my file.
Is that possible in Linux without having开发者_运维技巧 to write a new kernel module?
EDIT: i guess that solution won't work .. but see my comment below.
this shoud be simple under linux.
here are the steps:
- make a named pipe with mkfifo (mkfifo ~/audio_out.pipe)
- cat the audiofile into this pipe (cat test.wav > ~/audio_out.pipe)
- get the program you want to listen, to get input from this pipe. maybe you have to make a symlink for programs not flexible enough to read from any device.
I hope I got your question right.
精彩评论