Read a signal from a Jack playing a sound

Hey guys !

I am using Gdevelop software to easily build some cool apps (it's basically a no code software, using events and actions, but quite powerful).

The only con is that it cant be used to control physical stuff and I do like physical stuff =p

So I am looking for something to tweak it !

The app can actually trigger a sound, so I wonder, by playing a sound through a jack plug, could it be possible to read the signal with an arduino ?

Thanks !

Please describe that signal. What does it tell that an Arduino might be able to detect?

1 Like

For your computer, a soundcard is far-better for audio input.

If you have a laptop with no regular soundcard or audio line-in, you'd need USB audio interface with line-in. The regular audio outputs on a CD/DVD player or your TV etc., are line-level which is about 100 times stronger than a microphone signal so the mic input won't work properly. A headphone signal can be used into a line-input. Low power speaker signals can also work into a line input but high-power amplifiers would need an attenuator.

Soundcards are (obviously) designed for getting sounds into the computer. The Arduino is NOT and it doesn't make a good soundcard.

There are sound sensors (little circuit boards with microphone) for the Arduino and there are simple audio-circuits for electrical line-level or headphone-level signals. But getting the information into an application running on your computer isn't easy.

...I make sound activated lighting effects with the Arduino and once I made an experimental sound level meter. The lighting effects run stand-alone without a computer. The SPL meter used the serial monitor which is part of the Arduino IDE to display the dB loudness on the computer.

The serial monitor is really just for development and you wouldn't want to use it for a "permanent" application. In this case, it meant that I could write Arduino code and I didn't have to write a companion program to run on the computer. It also meant that I didn't have to wire-up and program a display for the Arduino.

I actually dont know what kind of signal it is. That's why I am heading over here.
But I guess (maybe wrongly =p), that when an audio is triggered through a jack wire (that produce a sound, with a speaker), there is some kind of voltage measurable with an arduino ?

Then, perhaps, there is NO "signal". Time for you to begin investigating. That requires test equipment, including an oscilloscope, so you can visualize the possible signal.

Lots of things make sounds, what type of sound does it make, a tone, pulses, ???. Can it make DTMF (Duel Tone Multi Frequency) [touch tone] sounds?

Its a MP3 directly played by the tablet on which the app is installed.
Since tablets have a jack output, I was planning to use this output with a jack wire.

So, a headphone output. You can use headphone Y-splitter if you want to connect headphones at the same time.

This post ("World's simplest sound-activated lighting effect") shows a circuit you can use on an Arduino analog input. (You don't need that code although SOME of it, and the comments MIGHT be useful to you).

For testing, run the Analog Read Serial Example, but take-out the delay.

With silence you should about half of the ADC range (512 on a regular Arduino Uno or similar.) With sound it should deviate from there with louder sounds going higher and lower, and quieter sounds staying around the "silent" reading.

That will tell you if you are getting useful readings and you can go from there.

Note that you are reading a constantly-changing wave. So even with a constant tone the readings will bounce around "randomly" and even with loud sounds you'll get some small (close to silence) readings. But you (and your software) should be able to tell the difference between silence, loud sounds, and quiet sounds, etc.

1 Like

Seems great ! Thanks !
There just one thing I dont get.
A jack wire is actually made of many wires, 3 to 5 it seems.
So which one should I use to make the wiring you show on the other topic ?
Audio Input Schematic

It sounds like you are trying to make a variation of the old fashion color organ. Use your search engine and look for that.

This might help.

A headphone needs 3 connections, left, right, and ground. Your tablet probably has another connection for a microphone at the same time. A regular TRS 3-contact headphone plug will work if you don't need the microphone connection.

I assume you have a plug or a cable you've cut? It will help if you have a multimeter or continuity tester to check the wiring through the connector. Or the ground is the "big" contact and with a TRS plug the other two are left and right and it probably doesn't matter if they are mixed-up. If you've got a TRRS plug you'll probably need a meter or continuity tester.

You'll need ground, and choose the left or right signal. Or build two of those circuits and use two Arduino analog inputs. Do NOT "short" the left & right signals together!

1 Like

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