Package: nimRum
nimRum (Nimble Rumble)What this isThis is an implementation of thewww.abtaudio.techsolution.Free for private use and evaluation purposes.This implementation is limited to:*Raspberry Pi 2,3,4 / Raspbian GNU/Linux 11 (bullseye)* Max 8 clients/receivers (Enough for 7.1 or 5.2)* Max 2 audio channels per client (1 audio channel per client is the normal case)* No audio repair in case of packet loss* Single local networkWhat it doesA program/library to transmit wireless audio over WiFi/Ethernet.The receiving speakers will play the audio in synch, just as if you connected them with wires, ..without mixing up + and -.In other words, this solution is good enough for puttingmultiple wireless speakersin the same room, and let themplay toghether, either for music, or as surround speakers.This maybe sounds obvious, but this is NOT what most wireless speakers does today.What you needA couple ofRaspberry Pis 2|3|4withRaspbian GNU/Linux 11 (bullseye)All connected through a local network, where one of the Raspberries being the AP5GHz WiFi has the perfect balance between range and radio interference for this purposeEthernet cables works as wellThe one configured as AP should be the transmitterAs sound source, either use a local file or the Line-In|S/PDIF input from a soundcard.If transmitter has IR-sensor/LIRC, then volume/mute can be controlled from a remote.The ones configured as receivers should have a soundcard with either line-out or direct speaker outputThe built in line-out on RPI is very noisyThe transmitter can also be a receiver at the same time as long as the HW supports itRecomended soundcards?HifiBerry & IQAudio works fine, with or without built in amplifier...probably many others as well.Just a kind remarkIf using line-in on a Bluetooth speaker, be aware that these probably adds something like 20-60ms delay.This is ok for nimRum, you just need to adjust for it....the problem is that sometimes this delay is not always constant.Getting startedsudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libasound-dev flac screen libflac-devNote:All units should have NTP turned off:sudo systemctl disable systemd-timesyncd.service(...and yes, there is a reason why RPi/Linux implementation use CLOCK_REALTIME, even though it is the 'wrong' clock)The TX part (On the RPi being AP):pip3 install nimRumrunNimRumTx.pyaFileWithSound.wav(This will play this file repeatedly, forever)First time you will get a message telling you to create a txConfig.yaml file.
It will also tell where you find an example, with instructions, to copy. Most important to add are thehostnamesof the RX devices and map correct audio channels to them.The RX partpip3 install nimRumrunNimRumTx.pyFirst time it will use default settings. When you close (Ctrl-C) the program, it will store an examplerxConfig.lastfile for you. Rename it torxConfig.yamlto alter the default settings if needed.Note: It will use the first 'hw:' sound device it finds. Please disable the others.Hint:# dtparam=audio=ondtoverlay=vc4-kms-v3d -> dtoverlay=vc4-kms-v3d,noaudioSupportYou will need some background knowledge to set this up. I am not saying it is hard, it is actually far from it. But you probably need some previous experience.Please look in the provided python files, I've tried to make them readable.'which runNimRumTx.py'and'pip show nimRum'will tell you where your installation is located.'ldd libNimRum...so'will show what librraries dynamically linked.Getting furtherStreaming from Line-In|S/PDIF inputStartrunNimRumTx.pywithout providing any input sound file.
It will then look for the first 'hw:' input sound device it finds.Start at bootrunNimRumForever.shcan be used to start automatically at boot. The file is located next torunNimRumTx.pyandrunNimRumRx.py. Instructions are found inside.In case you want to install nimRum to a virtuelenvpip3 install virtualenv virtualenvwrappernano .bashrc#Virtualenvwrapper settings:export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3export WORKON_HOME=$HOME/.virtualenvsexport VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenvsource ~/.local/bin/virtualenvwrapper.shexport VIRTUALENVWRAPPER_ENV_BIN_DIR=binLogin/Logout OR source ~/.bashrcmkvirtualenv testPyNimRumworkon testPyNimRumdeactivateGetting involvedIt is not possible to get unlimited support to whatever question from AbtAudio. If anyone like this to the level they would like to help others to install, improve the scripts, improve documentation, moderate some chat/forum, or in any other way get involved, then those questions will be prioritized.
BR,www.abtaudio.techTODOFind all remaining bugsImprove installation instruction and PyPi package?Replace libNimRumAlsaCapture_py.soThis is a library used to capture samples from an audio input and provide raw sample data for transmission. This has nothing to do with what AbtAudio focus on.FFMPEG is a great tool, but using latest version instead of Bullseye default version would be better. Updating version becomes much easier if this is written directly in Python.The function it does can be explained with this (will spam your terminal forever):ffmpeg -f alsa -i hw -f wav - | ffmpeg -i - -y -f wav -Try this if you want to understand what it does (will not spam your terminal forever):ffmpeg -t 20 -f alsa  -i hw -f wav - | ffmpeg   -i - -y t2.wavIn addition to just grab the samples, it is good to have low/known latency, not to mess up lip-synch.It should also enable compensation for clock drift. Either by resample the incoming stream to local clock, or provide the exact rate to libNimRumTx_py.soIt should automatically detect if PCM or Encoded data, in best of worlds, without adding HW specific code....maybeimport asynciois a good start?Support any format for input files. CurrentlynimRumTxReadFile_wavio.pyis used, which only supports .wav-format.nimRumTxReadFile_soundfile.pyneeds to be fixed....Working in development mode for pypigit clonehttps://github.com/abtaudio/nimRumcd nimRumrm -rf distpip3 install -e .python3 setup.py sdisttwine upload dist/*