I have this primitive hobby project, where an Arduino micro-controller board communicates with a smartphone, via the phone audio jack. The phone plays these Audio files and the Arduino samples the voltage on the audio line, in order to discern between high voltage, low voltage and no voltage. It’s a simple project and it already works OK without any amplification and that is how i want it to stay, for this project (without amplification).
But i have a suspicion that it could work even better, if i had a bit more knowledge about the types of sounds, that produce various levels of voltage on an audio line. What i am using now is a sound of a siren, that i recorded with such a gain, that it is full of distortion. i think distortion is good for my case, since it seems to be decoded by the Arduino, as a high voltage signal, most of the time.
But when i installed a sound editor software on my computer and set the graphic view of the sound file in a certain way, i saw that actually only small portions of that sound file, raise the sound magnitude to the maximum possible gain. My conclusion was that it must be surly possible to create a sound file, that produces a higher and/or constant voltage on the audio line. The sound file runs for 5-10 seconds.
So my question is what kind of sound sample would produce the highest constant voltage on an audio line?
None i guess. Sound is by definition an ac signal. So the voltage must fluctuate up and down around 0 volt. And most likely the electrical parts in the line in/out circuit have capacitors in series that will be charged when a constant signal is applied. So any contant value applied will disapear as a decaying curve in millisecond s.
So the fact that in the visualization graph of the sound file, i see that most of the time the file does not reach the maximum value actually means nothing regarding voltage that passes in the line? Because as i wrote above, most of the time (maybe more than 80%), the Arduino differentiates between the low volume signal and the extra-gain-distorted high volume signal. Can you try to explain what you said above at a more basic level? i understand the AC/DC difference between what the Arduino expects and what the phone audio line-out delivers, but yet it does work most of the time, so i probably did not quite understand all you were saying…
Well, it’s hard to say because I do not know what that visualization graph is showing, or how it’s scale is defined. Could be linear, or logarithmically/dB. I was just saying that the voltage applied to the arduino input is likely going to be a decaying curve if the phone outputs a constant high. It will not be constant high on the output-jack. It won’t pass the highpass filtering.
I suppose you could fool the Arduino by generating square waves of max volume (easier than sine waves) with some Android/Apple-code on the phone with sufficient high frequency yet still in the human audio range (to avoid getting lost in the anti-alias low-pass filter). These signals are still AC and therefore would get through the highpass filter of the line-out circuitry. The Arduino would then sample it’s input and then flag when the value got above a certain threshold within a certain time period (long enough to capture a sample on the positive side of the square wave). I don’t know what the line-out max voltage is, so that’s up to you to tweak.
I think what you’re seeing is the difference between a loud signal and a not so loud signal. It’s just volume, the “type” of audio has nothing to do with it.