开发者

How to create artificial microphone input in Linux?

开发者 https://www.devze.com 2023-04-10 19:38 出处:网络
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

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:

  1. make a named pipe with mkfifo (mkfifo ~/audio_out.pipe)
  2. cat the audiofile into this pipe (cat test.wav > ~/audio_out.pipe)
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号