Sunday, February 10, 2019

Streaming Bandwidth Limitation of Slingbox and Solution

This post shows how the streaming bandwidth of Slingbox is limited by delay between Slingbox and the client despite sufficient bandwidth available between them. This is a common situation for users of Slingbox streaming videos over a long distance.  A solution to this problem by using TCP proxy is shown in the end.  All experiments were done with Slingbox 350.

Streaming Bandwidth Limitation

Delay between Slingbox and the client limits the streaming bandwidth despite very high bandwidth available between them.  This was found by an experiment where delay is deliberately inserted between Slingbox the client that are physically located very close to each other.

The following figure shows the measured video bit rate versus the round-trip delay inserted between Slingbox and the client.  Up to about 20 ms of round-trip delay, the maximum video bit rate of 8 Mbps is maintained, but it starts decreasing as the delay increases.  For example, the typical round-trip delay between Tokyo and New York of 220 ms limits the streaming bit rate to about 2.5 Mbps.

Slingbox video bit rate versus round-trip delay.

In normal TCP communication, TCP window size is dynamically adjusted so the delay will not be a limiting factor of bandwidth.  However, it appears that window control is not very effective with Slingbox or some unique flow control is used in conjunction with Slingbox's proprietary streaming technology.

Solution

It was found by experiment that delay in up to and including the TCP layer matters, but that in higher layers does not limit the streaming bandwidth.  Therefore, inserting a TCP proxy physically close to Slingbox solves the problem.  This way, Slingbox talks to the proxy in the TCP level with a very small delay while it directly talks to the client in the application layer with a large delay.  This is described in the figure below.


Direct connection and connection via a TCP proxy.


Practically speaking, SlingPlayer doesn't allow direct entry of Slingbox's IP address.  Therefore, DNAT must be inserted somewhere between the client and TCP proxy so Slingbox's IP address is converted to that of the TCP proxy.  This is fairly easy on Linux with iptables.  A TCP proxy can also easily be set up with socat on Linux.

With this approach, it was confirmed that stable streaming at the max rate of 8 Mbps is achievable in a real use case where the streaming bandwidth is normally limited to around 3 Mbps with a round trip delay of about 150 ms.

Saturday, October 21, 2017

Ayre K-5xeMP direct input selection using hidden remote codes

The original remote of Ayre K-5xeMP doesn't allow direct selection of the input source.  It turned out that the amplifier is capable of that via IR control, but the remote lacks keys for that.  This amplifier uses the standard RC-5 format with the device code of 16.  I found the following codes that the original remote doesn't have keys for:

OBC/Function
1/B1
2/B2
3/S1
4/S2
56/mute off (not toggle)
57/mute on (not toggle)

These codes can be set to any JP1 programmable remote and let your favorite remote learn from it.

Although I don't have a way to confirm this, these codes may work on KX-5 and KX-R which also seem to lack direct input selection with the original remote.


Tuesday, July 4, 2017

Krell KAV-400xi and B&W 803D3 loaded and unloaded frequency response

Out of curiosity, I tried measuring the frequency response of my Krell KAV-400xi loaded/unloaded with B&W 803D3 to get some sense of its output impedance relative to the speaker's impedance over frequencies.

The following plots show voltage measured at the speaker end of the cable in unloaded/loaded conditions.  Since the speaker has separate binding posts for HF and LF, I could also take partially loaded measurements.  Fluke 187, which claims to have bandwidth of 100 kHz for AC RMS, was used for measurements.  I do not have fancy equipment.  Since the amplitude is very small to compared with the amp's full scale, I believe distortion components are negligible and do not contribute to RMS values.


When unloaded (blue curve), the amplifier shows a fairly flat frequency response.  The high-frequency roll off may belong to the multimeter or the source (not sure).  However, once loaded with the speaker, what a roller coaster ride!  Over frequencies the amplitude swings by about 1 dB.  1 dB of amplitude difference is clearly audible.

The conclusion I can draw here is that the output impedance of the amplifier is somewhat comparable to that of the speaker.  To see which one is changing so much over frequencies, I need to repeat the same measurement with a dummy load whose impedance doesn't change over the frequencies of interest.  It would be also of interest to repeat the measurements with a fancy amp, but I currently do not own one.

Also, I tried measuring at the amp and speaker end to see if there is any measurable difference.  The speaker cable used here is Canare 4S11 in biwire configuration.   The LF side was measured on the speaker side.


Some drop over the cable is visible.  I performed the measurements on both L & R channels and saw very similar responses.

To be continued with a dummy load...
Review of the amplifier by Stereophile (Fig. 1) shows that the output amplitudes at 8 ohm and 4 ohm loads are fairly uniformly apart by 0.25 dB up to around 10 kHz.  This implies that the output impedance is real (as opposed to complex) and about 0.24 Ohm (which means damping factor of 33 w.r.t. 8 Ohms).  If the speaker impedance was also real, I would be able to compute the speaker impedance, but it is usually it is very complex.  Interestingly, impedance measurement of 802D3 (Fig. 1) (not 803D3) shows that the speaker impedance bottoms between 100 Hz and 1 kHz and peaks at 3 kHz.  That trend is pretty well agreeing with my measurement of the 803D3.

I believe the impedance roughness is the reason why people say it's not easy to drive B&W 800 series.  If gain flatness measured at the speaker's binding post is what's important, low impedance has to be maintained over frequencies including the cable.  This calls for a lot of feedback, beefy output stage, class D, or some technique I am not aware of.  I am interested to know whether B&W designed the speaker assuming an ideal amplifier with no loading effect or used some kind of average amplifier model for tuning.

Monday, November 28, 2016

IR receiver + IR transmitter + RTC for Raspberry Pi

I needed an IR receiver for my Raspberry Pi which I use as an internet TV receiver with some custom program.  As expected, I could not find any IR receiver module that fits nicely in my favorite simple & discreet Rasperry Pi case which only exposes all connectors and GPIO.  A USB adapter was an option, but I did not want anything sticking out of the pi.  Solution: make my own.

The board is shaped so it fits nicely in the case.   Since there was plenty of board space left, I also put an IR transmitter and RTC (DS1308U)+battery in addition to the IR receiver.  The IR receiver and transmitter are connected to the standard LIRC GPIOs (GPIO18 for receiver and GPIO17 for transmitter).  The RTC is connected to the I2C bus, and is compatible with the DS1307 driver which is included in the current Raspibian Kernel.   All GPIOs used on this board belong to the upper 12 pins of the GPIO header so a 12-pin female connector can be used instead of a full 40 pin (SMT 40-pin female connectors are really pricey!)



  

  

The PCB is available here.

A low-power battery-operated 2-to-1 stereo combiner

I was shopping for a simple compact device which simply combines two stereo inputs into one, but couldn't find such a thing.  There are a bunch of products with fancy mixing and such, but I am not interested in those.  Long-life battery operation was another thing I was looking for.  My solution turned out to be making my own.

This is just a couple of text-book inverting amplifiers with AC coupling on both inputs and output sides to minimize DC current draw from the battery.  This way, DC current draw from the battery consists of just the opamps and the voltage divider for common mode generation.  Total DC current draw should not exceed 21 uA.  Optimistic battery life expectation is 220 mAh (from CR2032)  / 21 uA  = 416 days which of course depends on the actual usage of the device.





The PCB can be ordered at https://oshpark.com/shared_projects/KPojBfKX (I do not make any money).


Monday, August 8, 2016

Improving TX3 Pro Amlogic S905X Android box's IR remote sensitivity

TX3 Pro is a decent and affordable Android box based on Amlogic S905X.  Unlike many other cheap Android boxes, this box does have an window for the IR receiver.  Its IR sensitivity turned out to be indeed better than Tronsmart S95 Pro's, which is horrible due to the poor IR transmission of the body and lack of IR receiving window (you can drill a hole and replace the receiver with a decent one).  However, it is still not as good as I expected.  For example, it cannot detect IR reflection from the ceiling, which decent IR receivers with a proper window can handle.

I tried to align the IR receiver with the window as much as possible, but no noticeable improvement was seen.  So, I replaced the IR receiver with Vishay TSOP34438, which is pin compatible with the original. The legs of the receiver need to be bent so the receiving dome touches the IR window when the board is mounted on the case.  Now I can point the remote at the ceiling and the box still recognizes the signal with no problem - SUCCESS.

By the way, the IR remote control can be easily customized by editing /system/etc/remote.conf which has a mapping table from IR code to Linux key code (not Android key code!).  Here is a nice Linux key code table along with Android key code.  If remote.conf keeps being overwritten by the default one at reboot, make it readonly with chmod so it won't be overwritten.

IR window

Motherboard with the new IR receiver

New IR receiver

 
Original IR receiver



Wednesday, July 8, 2015

HAP-Z1ES PCM1795 Register Settings

I measured the serial configuration interface of the PCM1795.  The following register settings were found in the DSD mode (for both DSD source and DSD remastering).  DMF[1:0] = Reg18[4:3] = 01, so DSD Filter-2 is used for the analog FIR.  In addition to the on-chip FIR filtering, there is additional first-order FIR filtering (1+z^{-1}) realized by connecting two current outputs together with one input delayed by one sample.  

Reg16 = 0xff
Reg17 = 0xff
Reg18 = 0x54
Reg19 = 0x00
Reg20 = 0x20
Reg21 = 0x00
Reg22 = 0x00
Reg23 = 0x00