Please tell me how do I create an ultra sound with an android phone? If you already have a code sample? Thank you!
Ultrasonic waves are sound waves in a frequency that is higher than humans can hear. Cellphone microphones, however, can and do record these higher frequencies.
The phone's speaker can reproduce a maximum frequency of 18-20 kHz. Ultrasound - this is the frequency above 20 kHz. It is impossible to generate ultrasonic signal.
Liquid foams can completely block ultrasound transmission of some frequencies, suggesting that foams are metamaterials that could be used for acoustic insulation. Foam blocks.
Generally, yes (confirmed by both theory and experiment) though probably not as effectively as they can lower frequencies.
Creating an ultra sound is just a matter of playing a sound which contains very high pitches (small wavelength). Sounds are played through electronic devices by quickly changing the power of an electromagnet which is attached to a membrane which vibrates accordingly (a speaker). Sounds can be played at varying levels of granularity, but some speakers may be able to keep up with the signal sent much better than others.
You can construct an artificial wave that thrashes the power quickly from high to low, and any given device will probably reproduce that signal with varying degrees of success. The better it keeps up, the closer it will get to the true volume of the signal. If it doesn't keep up very well, you may only get a tiny vibration rather than the large vibration you sent. In other words, you may find that you can produce the ultrasound frequency you want, but it not in a high enough volume to be useful. And it will definitely vary by device.
Also, it should be noted that ultrasound just means something that is a higher pitch than we can hear. Some people (particularly teenagers) can hear much higher pitches than others. So there is some wiggle room in the definition of ultrasound. But ultimately, these phones' speakers are optimized for playing sounds that we can all hear, and the higher you try to stretch the equipment outside of its intended range, the more limitations you are likely to find in its performance.
If you want to experiment, look up the specs on different sound formats. I think .wav may be the one that you will find the simplest, and therefore the easiest to experiment with. Then construct your sound file according to that spec to make large, fast waves. For example, if the signal power ranges from 0 to 255, you can try a pattern like 0, 127, 255, 127, 0, 127, 255, etc. or even just try 0, 255, 0, 255, 0, which would be one octave higher. And see if you can record something of that wave on another device. (Because you aren't going to hear it with your ear.)
By the way, you will also find that that simply producing the signal is the easy part. If you want to "transmit", then your other device is going to have to hear the signal. But of course, what it actually hears will be mixed with all of the back ground noise in the room, so separating that one frequency from the rest of the noise involves some math. You'll need to get familiar with terms like Fourier Transform. The math is out there. It has already been worked out. But you'll have to work out how to apply that complex math to the problem of sorting out when this frequency is being heard. If you love math, this will be a fun project.
Modern Android devices support a sampling frequency of 48 kHz, so theoretically you could transmitt ultrasounds in the 19-24 kHz range. Now, due to the presence of an antialiasing filter in the microphone's input your actual range is restricted to 19-20.5 kHz and on some devices to 19-21 kHz. If what your looking for is transmitting an ultrasonic tone, then it is very easy. For instance:
int samplingFreq = 48000;
int numberOfSamplesXSymbol = 48000; //1 sec tone
int f0 = 20000;//ultrasonic tone
for (int i=0;i<numberOfSamplesXSymbol;i++)
{
tone[i] = Math.cos(2*pi*f0/samplingFreq*i);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With