Recently there was a need, at work, to test the end-to-end latency of an audio signal between two android devices running our VoIP application. In previous cases (using other hardware) we've been able to attach test leads to the microphone and speaker or the the microphone and speaker jacks to monitor the signal. These would be connected to an oscilloscope and an impulse on one device and the corresponding (delayed) impulse on the other device would be displayed on the scope and the temporal difference measured.
This method is perfectly adequate but to go a step further, it could be beneficial to have a record of the test results. True, the scope could be configured to record the signals to a file, but not everyone has access to the scope when they need to test the latency. So the first step was to record the audio to file.
To begin this method, I needed a cable setup which would let me send audio to one phone (as well as a recorder device) and get that output from another phone to get to the recorder device.
To do the testing, the hardware engineer at work created the cable shown in the next photo. This worked fine to begin with; I could play a tone into one end, and record the tone (and the delayed tone) on the other. There were some connection issues though. Occasionally, I couldn't get both tones on the recording device, or there was a lot of noise present. Overall though, it worked well enough for the tests.
Eventually we needed to change the tested devices though, and this revealed another problem. Too many standards. It seems that the headset port on a phone has two standards. The headset port is a 3.5mm phono plug using four conductors rather than three. The plugs are TRRS (Tip Ring Ring Sleeve) for headsets and TRS (Tip Ring Sleeve) for headphones.
The TRRS connector standard used by Nokia (and a lot of other companies) uses the standard shown in the left image below. Apple, in their infinite wisdom, decided to be different and swap Ring2 and Sleeve. Samsung also has been known to use the Apple configuration (though I don't think they use it in all their devices). I guess you could at least say that while Apple chose a configuration that broke compatibility with existing accessories, they at least were consistent enough to always use it. . .
When we went to reconfigure the version one tester cable, we ran into difficulties. As you can see, it's kind of a mess of wires; we swapped ring2 and sleeve of the TRRS connector, but I wasn't getting any audio out. We sat with this, trying to figure out what was going on for quite a while (I don't even remember how long we messed with it). Eventually, I found that if I plugged the cable in 'just right' I was able to get it to work. I don't know what the exact issue was, but thought it could be related to the TRRS swap. At this point I really wanted a better setup.
I originally envisioned this as a board with the headphone/headset jacks connected to banana jacks. This would have provided all the flexibility I needed, and then some; any combination of connections could be made. I decided that this was probably too unweildy for normal use, as I'd have to remember which connections needed to be made (in case they'd been changed since the last time I used it) for both Nokia and Apple standards. I eventually settled on a fixed configuration with the ability to switch between the two standards.
The first image below shows the wiring of the initial test cable. This used only one TRRS connector which plugged into the sending phone (it was the only one which needed to use the microphone). The second image shows the modified wiring. Here, I'm using TRRS connectors for both phones and TRS connectors for the source and recording connections.
Additionally, the version two setup uses a couple of switches to help manage the two standards. A DPDT switch connects both the ground and microphone to the two necessary terminals depending on which position the switch is in. Similarly, I'm utilizing half of another DPDT switch to perform the same function on the ground connection of the output device.
I'm not really going to give a step-by-step account of this build since it is fairly well constrained. Similarly, there won't be an abundance of photos either - the space is small, and the photos would largely look very similar. With that being said, I've updated the version two wiring diagram to include the terminal numbers of the parts I used, shown below, followed by a photo of the parts (before assembly), a couple photos of the finished wiring, and the front of the box in its final form.
I was finally able to obtain some four conductor (TRRS) male-to-male cables to test the wiring; I found a mistake (oops). I accidentally wired up the right channel of the receiver phone to the right channel of the recorder. Once I fix this, attaching the left channel of the receiver to the right channel of the recorder, I'll be set.
|2||CP5-43502PM-ND||3.5mm 4 conductor jack - panel mount||Digikey|
|2||CP1-3513-ND||3.5mm 3 conductor jack - panel mount||Digikey|
|2||SW653-ND||DPDT rocker switch 6A 125V||Digikey|
|1||377-1717-ND||Project box - 3.09" x 2.09" x 1.00"||Digikey|
|2||GBA-159||6' 3.5mm 4 conductor male-to-male cable||Fry's Electronics|