49

I am to test voice recognition programs. Some which I have access to the code and others where I don't.

Sadly my (beautiful) voice is not perfect, so when I am reading a text it sounds slightly different each time. Which makes the testing difficult and time consuming. Giving that I can tweak a lot of parameters.

So I was wondering if there was a way to record my own voice (already done). And then play it as normal microphone input so the voice recognition program I am testing will see it as microphone input.

This would also help greatly if it could be done programatically in C#. So I can in my own code specify when to play what.

To play it from speakers and have the voice recognition programs listen to the microphone is not an option, because it is not the same sound on different computers/speakers/microphones.

Thanks.

Edit: What i have found so far is to use a software sound Card simulator. But I haven't been able to find a suitable one.

Mr. Java Wolf
  • 1,293
  • 2
  • 13
  • 28
  • As an architectural aside, if your recognition can be made to work from an arbitrary stream of audio data, then this becomes trivial to solve – Rowland Shaw Dec 13 '13 at 14:42
  • It is also my plan some of the way. But one (rather important) voice recognition program I am to test, doesn't allow this. – Mr. Java Wolf Dec 13 '13 at 14:47
  • Does anyone knows how to solve this? – Mr. Java Wolf Dec 14 '13 at 18:53
  • 9
    Is this a "bad" question? To me it sounds like a good idea to be able to simulate audio-in from a sound file. – Mr. Java Wolf Dec 16 '13 at 08:35
  • @Radiodef, the OP stated that he does not have access to the source code of several of the programs, and a crucial one in particular does not allow reading from a file, so that is not an option for him. Though I've never tried feeding a line level source to the mic jack (and my system actually doesn't have one at the moment), Google suggests that usually results in "a lot of distortion and noise", and thus probably isn't a desirable solution. –  Dec 18 '13 at 01:03
  • 1
    @jrodatus It's a semi-valid suggestion. It would depend on the device but line-out to line-in won't fundamentally add any more noise than during the extra level of DA/AD. The most likely problem would be that the out will be TRS and the in will be TS so you only get one channel (or 1/2 volume if the signal is mono). What Google is suggesting is that it's typical for a sound card input to expect a low-level signal. This could be defeated by getting an attenuator or (very possibly if it's even necessary) reducing the volume of the recording. – Radiodef Dec 18 '13 at 01:29
  • You could try the [jack audio server for windows](http://jackaudio.org/jack_on_windows) – pce Dec 18 '13 at 12:36
  • @Mr.JavaWolf you succeeded in doing this using VB-Audio Virtual Cable + VoiceMeeter? So if I get it correctly, if you play an audio file on your computer speakers, the microphone would pick it up as input as well? If yes... could you please explain how you did it? I've been trying for days now. – Jeet Parekh Jun 10 '16 at 16:07
  • 1
    @vicky96 As the answer have stated, you install the VoiceMeeter, which creates a virtual Speaker and Microphone. Everything you play into the virtual speaker will be forwarded to the virtual Microphone. – Mr. Java Wolf Jun 13 '16 at 09:07
  • 1
    @Mr.JavaWolf yes, I finally got it to work – Jeet Parekh Jun 13 '16 at 20:33

1 Answers1

72

Just as there are printer drivers that do not connect to a printer at all but rather write to a PDF file, analogously there are virtual audio drivers available that do not connect to a physical microphone at all but can pipe input from other sources such as files or other programs.

I hope I'm not breaking any rules by recommending free/donation software, but VB-Audio Virtual Cable should let you create a pair of virtual input and output audio devices. Then you could play an MP3 into the virtual output device and then set the virtual input device as your "microphone". In theory I think that should work.

If all else fails, you could always roll your own virtual audio driver. Microsoft provides some sample code but unfortunately it is not applicable to the older Windows XP audio model. There is probably sample code available for XP too.

Laurie Stearn
  • 833
  • 1
  • 11
  • 25
  • Thanks alot. The VB-Audio Virtual Cable + Voice Meeter (same place) solves the problem very very good. You just made my day. Mostly the [Voice Meeter](http://vb-audio.pagesperso-orange.fr/Voicemeeter/index.htm). – Mr. Java Wolf Dec 18 '13 at 13:56
  • Any suggestions for android Platform? – user2801184 Feb 03 '17 at 01:22
  • @user2801184, Michael's comment on [this question](http://stackoverflow.com/questions/21024851) suggests it may have to be custom-made for a given Android platform, using the available ALSA drivers. His full answer was over my head, but it might be a starting point. –  Feb 11 '17 at 14:29
  • 4
    Any suggestion for ubuntu? – user3806649 Apr 17 '17 at 07:35
  • Genius! I just used this technique to set a high-quality MP3 recording for my Google Voice outgoing message. Worked flawlessly. – Jay Jul 21 '18 at 18:36
  • I tried using this with .NET's `SpeechRecognition`, but it never seemed to work :( – kayleeFrye_onDeck Sep 07 '18 at 16:16