Skip to content

Hardware

Erik Mulder edited this page Mar 27, 2018 · 7 revisions

Hardware

A very important factor in Immerse is of course the soundcard hardware. The actual speaker hardware is also important for getting a nice sound, but not something Immerse is directly concerned with. Various tests have been done to see what the hardware is capable of and how it behaves while being used by Immerse. This page will list the findings of those tests and details about how certain problems have been solved. If you are looking for information on how to set up Immerse, read Setup.

Tests

Can we calculate surround sound fast enough to keep up with the 'live' audio stream?

TODO: write about test and conclusions

How much buffer is needed as a minimum to guarantee smooth playback?

TODO: write about test and conclusions

etc

TODO: write about test and conclusions

Problems to be solved

USB sound card mapping is not consistent over reboots

A big task in Immerse setup is to configure all sound cards and speakers. And once you are done you do not want to have to adjust it every time after a reboot. But when using USB sound cards of the same brand and type that is a big risk, cause there is no way to identify them uniquely. At a certain moment in time, you can use the mapping order in the OS, but this can change between reboots. For a while there seemed to be no proper solution to this then to hope that every sound card has a different name or description when listing them, so you can identify each uniquely. But that cannot hold forever, since it makes sense to buy a few of the same, cheap USB sounds cards in a batch and use those together. Furthermore, manufacturers mostly do not bother to put a serial number in those cheap products, so we are stuck with multiple fully identical pieces of hardware and an unpredictable OS mapping order.

Luckily there is one thing that can be used as an identifier that survives reboots: the physical hardware connection. For instance for USB, this is the hub and port where the card is plugged in to your computer. Every hub and every port within a hub has an index that is defined on the hardware level and is always the same. So as long as you do not physically swap 2 identical USB sound cards between reboots, Immerse will be able to identify the previous sound cards to speaker configuration reliably.

Since there is no generic way in Java to detect the mapping from the physical hardware connection to the actual sound card (*), Immerse uses an OS specific solution. At the time of writing this is only supported for a Linux based OS. Immerse will execute a shell command to get the mapping information from the OS.

For Linux, this command is used (**):
find /dev/snd/by-path -type l -printf "%f --> %l\n"

Example output:

pci-0000:00:14.0-usb-0:5:1.0 --> ../controlC2
pci-0000:00:14.0-usb-0:1:1.0 --> ../controlC3
pci-0000:01:00.1 --> ../controlC1
pci-0000:00:1f.3 --> ../controlC0

After parsing the output we can use the hardware connection point on the left to find the sound card order index on the right and use that to rebuild the Immerse surround sound model according to the saved configuration. The sound card index can be matched against the mixer name, that will always contain plughw:X,0. For instance plughw:2,0 is a sound card with index 2 and in the example above is plugged into USB port 5.

(*): There is a nice USB library for Java called usb4java. But it can only show generic USB related information (including hub and port) but not the mapping to a sound card device it may represent. That information seems to be only available in the OS itself. But if anyone knows a generic way in Java to solve this, please contact me.
(**): Another handy command to get even more information on the hardware connection is:
udevadm info -a -n /dev/snd/controlC0