Replacing Microphone input with input from computer

Hello. I am working on a project that uses a microphone to listen to sound and sends the input from analogRead() to the rest of code to perform a series of actions on the information. I am wondering if there is an easy way to change the input from being a microphone to a file that is played on my computer.

For example, originally I was playing a song from my phone right next to the speaker so that the speaker could pick up the noise, but the problem is that if this occurs in an environment that has a lot of background noise there will be tremendous interference in the information that the speaker collects. So I am looking for a way for that song to be played on my computer and sent directly to the arduino with the same output from analogRead() while also playing from the speakers. I need to finish this as soon as possible so thanks in advance for the help!

Yes it can be done, a bit tricky because of ground loops. Basically you need to build an antatuator to reduce the levels the system needs. They sell devices call DI boxes (Direct Injection) where the decent ones have a transformer reducing and/or eliminating most of the hum problems. You can look up a DIY DI box and find a lot of schematics showing how to make it. Many will also explain how to match the input and output impedances. My best results are when powering the Arduino with about 8V via the Vin pin, the additional filtering helps a lot.

A simple interface, useful to connect the Arduino ADC to line out audio and earphone outputs, is explained in this thread.

Capture

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.