nimRum


NamenimRum JSON
Version 0.2 PyPI version JSON
download
home_pagehttps://github.com/abtaudio/nimRum
SummaryNimble Rumble, a library to play wireless(WiFi) sound in perfect synch, for private use and evaluation
upload_time2023-01-10 19:42:33
maintainer
docs_urlNone
authorAbtAudio AB
requires_python>=3
licenseAbtAudio
keywords abtaudio about time audio wireless sound synchronization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# nimRum (Nimble Rumble)

## What this is
This is an implementation of the **www.abtaudio.tech** solution. **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 network


## What it does
A 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 putting **multiple wireless speakers** in the same room, and let them **play toghether**, either for music, or as surround speakers.

This maybe sounds obvious, but this is NOT what most wireless speakers does today.

## What you need
* A couple of **Raspberry Pis 2|3|4** with
    * **Raspbian GNU/Linux 11 (bullseye)**

* All connected through a local network, where one of the Raspberries being the AP  
    * 5GHz WiFi has the perfect balance between range and radio interference for this purpose  
    * Ethernet cables works as well  

* The one configured as AP should be the transmitter  
    * As 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 output  
    * The built in line-out on RPI is very noisy  
    * The transmitter can also be a receiver at the same time as long as the HW supports it  

* Recomended soundcards?
    * HifiBerry & IQAudio works fine, with or without built in amplifier
    * ...probably many others as well.

* Just a kind remark  
    If 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 started

sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libasound-dev flac screen libflac-dev  

**Note:** 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):
1. pip3 install nimRum
2. runNimRumTx.py *aFileWithSound.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 the *hostnames* of the RX devices and map correct audio channels to them.

## The RX part
1. pip3 install nimRum
2. runNimRumTx.py

First time it will use default settings. When you close (Ctrl-C) the program, it will store an example *rxConfig.last* file for you. Rename it to *rxConfig.yaml* to alter the default settings if needed.

Note: It will use the first 'hw:' sound device it finds. Please disable the others.  
    Hint:  
    # dtparam=audio=on  
    dtoverlay=vc4-kms-v3d -> dtoverlay=vc4-kms-v3d,noaudio
## Support
You 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 further
## Streaming from Line-In|S/PDIF input
Start *runNimRumTx.py* without providing any input sound file.
It will then look for the first 'hw:' input sound device it finds.

## Start at boot
*runNimRumForever.sh* can be used to start automatically at boot. The file is located next to *runNimRumTx.py* and *runNimRumRx.py*. Instructions are found inside.
## In case you want to install nimRum to a virtuelenv
pip3 install virtualenv virtualenvwrapper

nano .bashrc  
#Virtualenvwrapper settings:  
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3  
export WORKON_HOME=$HOME/.virtualenvs  
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv  
source ~/.local/bin/virtualenvwrapper.sh  
export VIRTUALENVWRAPPER_ENV_BIN_DIR=bin  

Login/Logout OR source ~/.bashrc  

mkvirtualenv testPyNimRum  

workon testPyNimRum  

deactivate  

# Getting involved
It 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.tech

## TODO

* Find all remaining bugs

* Improve installation instruction and PyPi package?

* Replace libNimRumAlsaCapture_py.so  
    This 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.wav  

    In 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.so  
    It should automatically detect if PCM or Encoded data, in best of worlds, without adding HW specific code.  
    ...maybe *import asyncio* is a good start?  

* Support any format for input files. Currently *nimRumTxReadFile_wavio.py* is used, which only supports .wav-format. *nimRumTxReadFile_soundfile.py* needs to be fixed.

* ...

## Working in development mode for pypi
git clone https://github.com/abtaudio/nimRum  
cd nimRum  
rm -rf dist  
pip3 install -e .  
python3 setup.py sdist  
twine upload dist/*  



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/abtaudio/nimRum",
    "name": "nimRum",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "abtaudio about time audio wireless sound synchronization",
    "author": "AbtAudio AB",
    "author_email": "evaluate@abtaudio.tech",
    "download_url": "https://files.pythonhosted.org/packages/35/25/414dcdee8c2c356572da9e6b288c5246433e8e12571718440e22a868fb62/nimRum-0.2.tar.gz",
    "platform": null,
    "description": "\n# nimRum (Nimble Rumble)\n\n## What this is\nThis is an implementation of the **www.abtaudio.tech** solution. **Free for private use and evaluation purposes.**  \n\nThis implementation is limited to:  \n    * **Raspberry Pi 2,3,4 / Raspbian GNU/Linux 11 (bullseye)**  \n    * Max 8 clients/receivers (Enough for 7.1 or 5.2)  \n    * Max 2 audio channels per client (1 audio channel per client is the normal case)  \n    * No audio repair in case of packet loss  \n    * Single local network\n\n\n## What it does\nA program/library to transmit wireless audio over WiFi/Ethernet.\n\nThe receiving speakers will play the audio in synch, just as if you connected them with wires, ..without mixing up + and -.\n\nIn other words, this solution is good enough for putting **multiple wireless speakers** in the same room, and let them **play toghether**, either for music, or as surround speakers.\n\nThis maybe sounds obvious, but this is NOT what most wireless speakers does today.\n\n## What you need\n* A couple of **Raspberry Pis 2|3|4** with\n    * **Raspbian GNU/Linux 11 (bullseye)**\n\n* All connected through a local network, where one of the Raspberries being the AP  \n    * 5GHz WiFi has the perfect balance between range and radio interference for this purpose  \n    * Ethernet cables works as well  \n\n* The one configured as AP should be the transmitter  \n    * As sound source, either use a local file or the Line-In|S/PDIF input from a soundcard.  \n    * If transmitter has IR-sensor/LIRC, then volume/mute can be controlled from a remote.  \n\n* The ones configured as receivers should have a soundcard with either line-out or direct speaker output  \n    * The built in line-out on RPI is very noisy  \n    * The transmitter can also be a receiver at the same time as long as the HW supports it  \n\n* Recomended soundcards?\n    * HifiBerry & IQAudio works fine, with or without built in amplifier\n    * ...probably many others as well.\n\n* Just a kind remark  \n    If using line-in on a Bluetooth speaker, be aware that these probably adds something like 20-60ms delay.  \n    This is ok for nimRum, you just need to adjust for it.  \n    ...the problem is that sometimes this delay is not always constant.  \n\n# Getting started\n\nsudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libasound-dev flac screen libflac-dev  \n\n**Note:** All units should have NTP turned off:  \n**sudo systemctl disable systemd-timesyncd.service**  \n(...and yes, there is a reason why RPi/Linux implementation use CLOCK_REALTIME, even though it is the 'wrong' clock)\n## The TX part (On the RPi being AP):\n1. pip3 install nimRum\n2. runNimRumTx.py *aFileWithSound.wav* (This will play this file repeatedly, forever)\n\nFirst time you will get a message telling you to create a txConfig.yaml file.\nIt will also tell where you find an example, with instructions, to copy. Most important to add are the *hostnames* of the RX devices and map correct audio channels to them.\n\n## The RX part\n1. pip3 install nimRum\n2. runNimRumTx.py\n\nFirst time it will use default settings. When you close (Ctrl-C) the program, it will store an example *rxConfig.last* file for you. Rename it to *rxConfig.yaml* to alter the default settings if needed.\n\nNote: It will use the first 'hw:' sound device it finds. Please disable the others.  \n    Hint:  \n    # dtparam=audio=on  \n    dtoverlay=vc4-kms-v3d -> dtoverlay=vc4-kms-v3d,noaudio\n## Support\nYou 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.\n\nPlease look in the provided python files, I've tried to make them readable.  \n*'which runNimRumTx.py'* and *'pip show nimRum'* will tell you where your installation is located.  \n*'ldd libNimRum...so'* will show what librraries dynamically linked.\n\n# Getting further\n## Streaming from Line-In|S/PDIF input\nStart *runNimRumTx.py* without providing any input sound file.\nIt will then look for the first 'hw:' input sound device it finds.\n\n## Start at boot\n*runNimRumForever.sh* can be used to start automatically at boot. The file is located next to *runNimRumTx.py* and *runNimRumRx.py*. Instructions are found inside.\n## In case you want to install nimRum to a virtuelenv\npip3 install virtualenv virtualenvwrapper\n\nnano .bashrc  \n#Virtualenvwrapper settings:  \nexport VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3  \nexport WORKON_HOME=$HOME/.virtualenvs  \nexport VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv  \nsource ~/.local/bin/virtualenvwrapper.sh  \nexport VIRTUALENVWRAPPER_ENV_BIN_DIR=bin  \n\nLogin/Logout OR source ~/.bashrc  \n\nmkvirtualenv testPyNimRum  \n\nworkon testPyNimRum  \n\ndeactivate  \n\n# Getting involved\nIt 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.\nBR,  \nwww.abtaudio.tech\n\n## TODO\n\n* Find all remaining bugs\n\n* Improve installation instruction and PyPi package?\n\n* Replace libNimRumAlsaCapture_py.so  \n    This 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.  \n    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.\n\n    The function it does can be explained with this (will spam your terminal forever):  \n    >ffmpeg -f alsa -i hw -f wav - | ffmpeg -i - -y -f wav -  \n\n    Try this if you want to understand what it does (will not spam your terminal forever):  \n    >ffmpeg -t 20 -f alsa  -i hw -f wav - | ffmpeg   -i - -y t2.wav  \n\n    In addition to just grab the samples, it is good to have low/known latency, not to mess up lip-synch.  \n    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.so  \n    It should automatically detect if PCM or Encoded data, in best of worlds, without adding HW specific code.  \n    ...maybe *import asyncio* is a good start?  \n\n* Support any format for input files. Currently *nimRumTxReadFile_wavio.py* is used, which only supports .wav-format. *nimRumTxReadFile_soundfile.py* needs to be fixed.\n\n* ...\n\n## Working in development mode for pypi\ngit clone https://github.com/abtaudio/nimRum  \ncd nimRum  \nrm -rf dist  \npip3 install -e .  \npython3 setup.py sdist  \ntwine upload dist/*  \n\n\n",
    "bugtrack_url": null,
    "license": "AbtAudio",
    "summary": "Nimble Rumble, a library to play wireless(WiFi) sound in perfect synch, for private use and evaluation",
    "version": "0.2",
    "split_keywords": [
        "abtaudio",
        "about",
        "time",
        "audio",
        "wireless",
        "sound",
        "synchronization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3525414dcdee8c2c356572da9e6b288c5246433e8e12571718440e22a868fb62",
                "md5": "0b2aeec55e17e45a919d68f839d16cf4",
                "sha256": "7dcc1cd9af48749dd4c8da59d5c0e8d16055375bfc34a3e5d554743f043c00bc"
            },
            "downloads": -1,
            "filename": "nimRum-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0b2aeec55e17e45a919d68f839d16cf4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 102968,
            "upload_time": "2023-01-10T19:42:33",
            "upload_time_iso_8601": "2023-01-10T19:42:33.899843Z",
            "url": "https://files.pythonhosted.org/packages/35/25/414dcdee8c2c356572da9e6b288c5246433e8e12571718440e22a868fb62/nimRum-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-10 19:42:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "abtaudio",
    "github_project": "nimRum",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "nimrum"
}
        
Elapsed time: 0.02745s