# Mobile microphone input data throughput via audio jack?

does anyone know how much data could be transferred through audio jack for app to process into bytes?

I'm wondering how many different buttons could be mapped and processed using mic input? (Many headphones with microphones use 3 buttons: volume up/down and calling button)

All processing should be done in realtime.

Thank you

• Do you need to be able to pass audio at the same time? Or can we assume that the entire microphone input can be used for your custom application? Nov 9 '13 at 19:12
• Also see this post: electronics.stackexchange.com/questions/9340/… Nov 9 '13 at 19:14
• At the same time. Maybe it would be more accurate to say that I want to know maximum number of buttons that can be pressed at the same time. Nov 9 '13 at 19:41

The 3 headphone buttons you referred to do not pass information digitally, but are being signaled electronically using change of resistance, as explained here: How do volume control headphones work?

In the case of the headphone buttons, you can say information about pressed buttons is being passed "out-of-band" - it doesn't occupy the audio in or out channels (except maybe for the moments of time a button is depressed).

The answer by "cagrigurleyuk" above is incorrect, in addition to being incomplete. Yes, the Shannon-Hartley Theorem places the upper bound of bit rate that may be losslessly transferred within a given bandwidth, at a given SNR.

The quantization noise for a digitized channel is modeled as a SNR of $2^Q$ (where Q is the amount of resolution bits), in which case $B\cdot\log_2 \left( 1+SNR \right)\cong B\cdot Q\$, so for the numbers mentioned above (20kHz bandwidth and 12bits), the theoretical upper bound would be 240kbps (not 500kbps).

In reality, you actually have a bit more bandwidth (up to 24kHz, for a sample rate of 48kHz), and less quantization noise (as the maximal resolution is often 16 bits), but you do need to take into account more noise sources on the line that lower the total SNR (the worst noise source probably being the amplifier).

Finally, the number originating from Shannon-Hartley Theorem is, again, just a theoretical upper bound.

The actual bitrate you can achieve is a function of the modulation and encoding schemes you use, which themselves are a function of the program's efficiency, and the processing power that is available to you (due to realtime limitations). The processing power and the program's efficiency are unknown to us, which is why we can't really fully answer this question. Also unknown are the capabilities of your buttons, or transmitters.

I can give you some pointers, though:

1. With a proper design of communication protocol, the buttons probably need not send data while they are not being depressed, so you are actually theoretically limited by the amount of buttons pressed at once, rather than the amount of total buttons. E.g., your average keyboard has hundred-something keys, but only uses a transfer rate of around 12kbps.
2. The spectral efficiency (a figure of how many bps of throughput you can cram per a Hz of bandwidth) of various digital modulation (or keying) methods are listed in a table in page 17 of this PDF file, for your reference. The higher the spectral efficiency, the more complex the algorithm would be, which would accordingly require more processing power for realtime performance.
• I'm not really sure how much can a smart phone process but it is a device that would be used (from mid-end to high-end devices). Also You pointed out correctly, I'm more interested in number of buttons that can be pressed at the same time. Thank you for great anwser Nov 11 '13 at 6:26

There are two factors in determining the maximum theoretical information capacity of any communications channel, bandwidth and signal-to-noise ratio. The Shannon-Hartley Theorem places the upper bound of bit rate for a noisy channel to be:

$$Bit Rate = B*log_2( 1 + SNR )$$

If we assume that you have a perfect 20kHz bandwidth in the audio in channel for the smartphone, and 12 bits of resolution, the theoretical maximum will be around ~500Kbps.

It should be noted that achieving a value close this will require quite complex computations in the demodulation and that may very well prove to be the bottleneck of your system.

• This only answers the first part of the question. To finish, let's assume that "real time" response for buttons is on the order of 10 ms. If you have 480 kbps of data bandwidth, you can update the state of 4800 buttons every 10 ms. Nov 10 '13 at 13:10