diff --git a/README.md b/README.md index e76b6bb..42b4187 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,105 @@ -ODR-mmbTools scripts for 24/7 operation -======================================= -version : 2016-10-07 - -Prerequisites -------------- -You need to have a working ODR-DabMux, ODR-DabMod, ODR-AudioEnc, ODR-PadEnc -and/or Toolame-DAB configuration to use these scripts. Also -[supervisor](http://supervisord.org/) is needed. (apt-get install supervisor) - -The tools are expected to be installed in their usual place in /usr/local. - -Folder Structure ----------------- - -The 'config' folder contains all needed configuration file and needed to be -moved into /home/odr/ folder. - - * config/mod.conf : contains ODR-DabMod configuration - * config/mux.conf : contains ODR-DabMux configuration - * config/supervisor/ : contains all supervisor configuration files - * config/mot/ : contains all dls and slide files. You need to create fifo - with mkfifo for each radio (e.g. mkfifo /home/odr/config/mot/f3.pad) - - -About Audio and PAD Encoders ----------------------------- - -The encoder (ODR-AudioEnc or toolame-dab) writes ICY-Text into a text file. You -need to create this file at first for each radio : - * touch /home/odr/config/mot/f3.txt - -ODR-PadEnc reads ICY-Text information from previous text file and writes into -the pad file. This pad file need to be a FIFO and you need to create it for -each radio : - * mkfifo /home/odr/config/mot/f3.pad - -If you use Slide Show, you can put your images into the directory under mot -folder corresponding to the radio (example: /home/odr/config/mot/f3/) - - -About Supervisor ----------------- - -You need to create sym link into /etc/supervisor/conf.d/ for each radio -configuration file and call supervisorctl to reread and update configuration. -Please refer to the official [supervisor](http://supervisord.org/) -documentation for details. - -Example : - * sudo ln -s /home/odr/config/supervisor/f3.conf /etc/supervisor/conf.d/f3.conf - * sudo supervisorctl reread - * sudo supervisorctl update - -All services are launched from supervisor. - -To show status of all services : - * sudo supervisorctl status - -To [stop|start|restart] a service : - * sudo supervisorctl [stop|start|restart] service-name - -To apply change after change anything in /home/odr/config/supervisor/ file you -need to call supervisor to reread and update configuration. - * sudo supervisorctl reread - * sudo supervisorctl update - -Supervisor redirects all logs from the tools to files in /var/log/supervisor/ -You may need to ensure yourself that this directory exists. The logs will get -rotated according to the policy defined by your distribution. More details in -the [child logging](http://supervisord.org/logging.html#child-process-logs) -section of the documentation. +# Table of contents +- [Introduction](#introduction) +- [ODR-mmbTools components](#odr-mmbtools-components) +- [Repository structure](#repository-structure) +- [Operations](#operations) +- [Configuration](#configuration) + +# Introduction +The goal of this repository is to provide a: +- Debian shell script that installs or removes the: + - Main components of the odr-mmbTools suite used in a transmission chain + - [Supervisor](http://supervisord.org/) package +- Simple yet functional dab configuration sample that you can adapt to your needs +- Vagrantfile that allows you to quickly setup a lite debian bullseye virtual environment over which to test ODR-mmbTools + +# ODR-mmbTools components +- Encoder-manager: provides a web interface to manage audio streams and their related PAD data +- PAD encoder: one per radio station being broadcasted. Gathers radio-related data (ex: artist, song, slogan, logo) and shares it with the related audio encoder +- Audio encoder: one per radio station being broadcasted. Receives the radio web stream, combines it with the data from the PAD encoder and shares it with the multiplexer +- Multiplexer: packs the data from audio encoders into a DAB/DAB+ ensemble and shares it with a modulator +- Multiplex-manager: provides a web interface to view and modify some multiplex parameters +- Modulator: creates a modulation with the multiplexer data and sends it to a transmitter + +# Repository structure +## config +This folder contains the sample configuration files. If you use the provided installation script, it will be copied on your system: +- config/odr-dabmod.ini: ODR-DabMod configuration +- config/odr-dabmux.info: ODR-DabMux configuration +- config/supervisor/ODR-encoders.conf: supervisor configuration file for all encoders (audio + PAD) +- config/supervisor/ODR-encoders.conf: supervisor configuration file for all other odr-mmbTools excluding the encoders +- config/mot/: folder with the dls and slide files +## install +This folder contains the installation/removal shell script. Please check the **README.md** file inside this directory to run the installation shell script +## vagrant +This folder contains Vagrant-related files. Please check the **README.md** file inside this directory to setup and run a Vagrant box. + +# Operations +In this section: +- **server** relates to the host where you installed the odr-mmbTools and the configuration files +- **client** relates to any computer (including the server) + +After you ran the installation script on the server, point the web browser on the client to the **Supervisor web interface** on the host (http://server_address:8001). The default user name is **odr** and the default password is **odr**. Please note that this user name is not a system user profile. + +The supervisor web interface provides a graphical interface to start or stop each components of the DAB/DAB+ transmission chain: modulator, multiplexer, encoders (audio & data), encoder-manager and multiplex-manager. + +# Configuration +## User access +### Supervisor web interface +If you want to change the default user name and/or user password authorized to access the Supervisor web interface, then apply the following commands: +``` +# Change the user name +sudo sed -e 's/^username = odr/^username = whatever_user/' -i /etc/supervisor/supervisord.conf + +# Change the user password +sudo sed -e 's/^password = odr/^password = whatever_password/' -i /etc/supervisor/supervisord.conf +``` +Please note that *whatever_user* is not related to any linux profiles + +### Encoder-manager web interface +If you want to change the default user profile and/or user password authorized to access the Encoder-manager web interface, then apply the following commands: +``` +# Change the user name +sed -e 's/"username": "odr"/"username": "whatever_user"/' -i $HOME/config/encodermanager.json + +# Change the user password +sed -e 's/"password": "odr"/"password": "whatever_password"/' -i $HOME/config/encodermanager.json +``` +Please note that *whatever_user* is not related to any linux profiles + +## RF Transmission +### Improve the transmitted RF spectrum +If your hardware/virtual host is not powerful enough, then you should set the following 2 parameters in the $HOME/config/odr-dabmod.ini file to less stringent value: +- modulator rate=2048000 +- firfilter enabled=0 + +### Change the transmission channel +If channel 5A is being used in your area, you can easily switch to a [new transmission channel](http://www.wohnort.org/config/freqs.html) by applying the following command: +``` +sed -e 's/^channel=5A/^channel=a_free_channel_in_your_area/' -i $HOME/config/odr-dabmod.ini +``` + +### Change the SOAPYSDR-compatible device +The modulator sample configuration file is setup for a [HackRF One](https://greatscottgadgets.com/hackrf/one/) using the [SoapySDR](https://github.com/pothosware/SoapySDR/wiki) interface. + +If you need to transmit with another SoapySDR-compatible transceiver card, then apply one of the following commands: +``` +# LimeSDR +sed -e 's/^device=driver=hackrf/^device=driver=lime/' -i $HOME/config/odr-dabmod.ini + +# PlutoSDR +sed -e 's/^device=driver=hackrf/^device=driver=plutosdr/' -i $HOME/config/odr-dabmod.ini +``` + +### Change the transmission power setting +We recommend that you check the documentation of the SoapySDR module for your device for the field **txgain** in file $HOME/config/odr-dabmod.ini + +## Broadcast programs +### Change the name of the multiplex +If you want to change the name of the multiplex, then change the label and shortlabel values within the **ensemble** block in file $HOME/config/odr-dabmux.info + +### Change and/or add new programs +If your server is powerful enough, then you can add more services/sub-channels/components +1. Start job **10-EncoderManager** from the Supervisor web access +1. Point the web browser of the client to the **Encoder Manager web interface** on the host (http://server_address:8003). You can use the excellent [radio browser directory](https://www.radio-browser.info) to identify the url of the radio audio stream +1. Modify file $HOME/config/odr-dabmux.info and adapt the services, subchannels and components in relation with the changes you made with the Encoder-Manager. You should use the values mentionned in the [official ETSI TS 101 756 document](https://www.etsi.org/deliver/etsi_ts/101700_101799/101756/02.02.01_60/ts_101756v020201p.pdf). diff --git a/config/encodermanager.json b/config/encodermanager.json new file mode 100644 index 0000000..6c8a04f --- /dev/null +++ b/config/encodermanager.json @@ -0,0 +1,165 @@ +{ + "global": { + "daemon": false, + "max_encoder_instance": 3, + "logs_directory": "/home/pi/ODR-mmbTools/ODR-EncoderManager/logs/", + "supervisor_xmlrpc": "http://odr:odr@127.0.0.1:8001/RPC2", + "static_directory": "/home/pi/ODR-mmbTools/ODR-EncoderManager/static/", + "host": "0.0.0.0", + "supervisor_file": "/home/pi/config/supervisor/ODR-encoders.conf", + "port": 8003 + }, + "auth": { + "users": [ + { + "username": "odr", + "password": "odr" + } + ] + }, + "odr": [ + { + "uniq_id": "defee58a-f768-4ca9-a0f7-88f08b2e8748", + "autostart": "false", + "path": { + "encoder_path": "/usr/local/bin/odr-audioenc", + "padenc_path": "/usr/local/bin/odr-padenc", + "sourcecompanion_path": "/usr/local/bin/odr-sourcecompanion", + "zmq_key_tmp_file": "/var/tmp/zmq-P01.key" + }, + "source": { + "type": "stream", + "stats_socket": "/var/tmp/P01.stats", + "stream_url": "http://radiomonaco.ice.infomaniak.ch/radiomonaco-128.mp3", + "stream_writeicytext": "true", + "stream_lib": "vlc", + "alsa_device": "plughw:1,0", + "driftcomp": "true", + "silence_detect": "true", + "silence_duration": "60", + "avt_input_uri": "udp://:32010", + "avt_control_uri": "udp://192.168.128.111:9325", + "avt_pad_port": "9405", + "avt_jitter_size": "80", + "avt_timeout": "4000", + "aes67_sdp_file": "/var/tmp/defee58a-f768-4ca9-a0f7-88f08b2e8748.sdp", + "aes67_sdp": "" + }, + "output": { + "type": "dabp", + "output": [ + { + "name": "", + "type": "editcp", + "host": "127.0.0.1", + "port": "9001", + "enable": "true" + } + ], + "zmq_key": "", + "bitrate": "128", + "samplerate": "48000", + "channels": "2", + "dabp_sbr": "true", + "dabp_ps": "false", + "dabp_afterburner": "true", + "dab_dabmode": "j", + "dab_dabpsy": "1", + "edi_identifier": "", + "edi_timestamps_delay": "" + }, + "padenc": { + "enable": "true", + "pad": "34", + "dls_file": "/home/pi/config/mot/P01/INFO.dls", + "slide_directory": "/home/pi/config/mot/P01/slide/", + "slide_sleeping": "0", + "slide_once": "false", + "raw_dls": "false", + "raw_slides": "false", + "uniform_label": "12", + "uniform_label_ins": "1200", + "slide_carousel_interval": "", + "slide_live_interval": "", + "slide_live_lifetime": "" + }, + "name": "P01", + "description": "Radio Monaco", + "supervisor_additional_options": { + "user": "pi", + "group": "pi", + "autorestart": "false" + } + }, + { + "uniq_id": "7158c498-1ef1-4580-b385-23a3c06ba985", + "autostart": "false", + "path": { + "encoder_path": "/usr/local/bin/odr-audioenc", + "padenc_path": "/usr/local/bin/odr-padenc", + "sourcecompanion_path": "/usr/local/bin/odr-sourcecompanion", + "zmq_key_tmp_file": "/var/tmp/zmq-P02.key" + }, + "source": { + "type": "stream", + "stats_socket": "/var/tmp/P02.stats", + "stream_url": "http://media-ice.musicradio.com/CapitalMP3", + "stream_writeicytext": "true", + "stream_lib": "vlc", + "alsa_device": "plughw:1,0", + "driftcomp": "true", + "silence_detect": "true", + "silence_duration": "60", + "avt_input_uri": "udp://:32010", + "avt_control_uri": "udp://192.168.128.111:9325", + "avt_pad_port": "9405", + "avt_jitter_size": "80", + "avt_timeout": "4000", + "aes67_sdp_file": "/var/tmp/7158c498-1ef1-4580-b385-23a3c06ba985.sdp", + "aes67_sdp": "" + }, + "output": { + "type": "dabp", + "output": [ + { + "name": "", + "type": "editcp", + "host": "127.0.0.1", + "port": "9002", + "enable": "true" + } + ], + "zmq_key": "", + "bitrate": "128", + "samplerate": "48000", + "channels": "2", + "dabp_sbr": "true", + "dabp_ps": "false", + "dabp_afterburner": "true", + "dab_dabmode": "j", + "dab_dabpsy": "1", + "edi_identifier": "", + "edi_timestamps_delay": "" + }, + "padenc": { + "enable": "true", + "pad": "34", + "dls_file": "/home/pi/config/mot/P02/INFO.dls", + "slide_directory": "/home/pi/config/mot/P02/slide", + "slide_sleeping": "0", + "slide_once": "false", + "raw_dls": "false", + "raw_slides": "false", + "uniform_label": "12", + "uniform_label_ins": "1200" + }, + "name": "P02", + "description": "Capital FM London", + "supervisor_additional_options": { + "user": "pi", + "group": "pi", + "autorestart": "false" + } + } + ] +} \ No newline at end of file diff --git a/config/mod.ini b/config/mod.ini deleted file mode 100644 index 9c5cf07..0000000 --- a/config/mod.ini +++ /dev/null @@ -1,244 +0,0 @@ -; Sample configuration file for ODR-DabMod - -[remotecontrol] -; enable the telnet remote control on localhost:2121 -; Since this is totally unsecure telnet, the software -; will only listen on the local loopback interface. -; To get secure remote access, use SSH port forwarding -telnet=1 -telnetport=2121 - -; Enable zmq remote control. -; The zmq remote control is intended for machine-to-machine -; integration and requires that ODR-DabMod is built with zmq support. -; The zmq remote control may run in parallel with Telnet. -; -; Protocol: -; ODR-DabMod binds a zmq rep socket so clients must connect -; using either req or dealer socket. -; [] denotes message part as zmq multi-part message are used for delimitation. -; All message parts are utf-8 encoded strings and match the Telnet command set. -; Explicit codes are denoted with "". -; The following commands are supported: -; REQ: ["ping"] -; REP: ["ok"] -; -; REQ: ["get"][module name][parameter] -; REP: [value] _OR_ ["fail"][error description] -; -; REQ: ["set"][module name][parameter][value] -; REP: ["ok"] _OR_ ["fail"][error description] -zmqctrl=0 -zmqctrlendpoint=tcp://127.0.0.1:9400 - -[log] -; Write to a logfile or to syslog. -; Setting filename to stderr is very useful during tests and development -syslog=0 -filelog=1 -filename=/dev/stderr - -[input] -; A file or fifo input is using transport=file -;transport=file -;source=/dev/stdin - -; When the end of file is reached, it is possible to rewind it -;loop=0 - -; When recieving data using ZeroMQ, the source is the URI to be used -transport=zeromq -source=tcp://localhost:9050 -; The option max_frames_queued defines the maximum number of ETI frames -; that can be in the input queue -max_frames_queued=100 - -[modulator] -; Gain mode: 0=FIX, 1=MAX, 2=VAR -; -; Mode 0 (FIX) uses a fixed factor and is really not recommended. It is more -; useful on an academic perspective for people trying to understand the DAB -; modulation. -; -; Mode 1 (MAX) is the normalization of every OFDM symbol. No overshoot, no -; truncating, but varying output power (around 3dB) which might not be the best -; for some power amplifier. The output samples are limited to a magnitude -; of 32768. -; -; Mode 2 (VAR) uses the method specified in ETSI 300 798. This method -; normalizes to 4 times the standard deviation for an approximation of the RMS -; power. So around 6/100000 samples will be truncated and will introduce some -; really minor distortion. But this mode also maximizes the output power. This -; is the gain mode recommended for real world operation as it is based on a DAB -; standard; the only difference is that ODR-DabMod uses a better resolution -; with 16 bits instead of 8 bits. -gainmode=2 - -; Transmission mode -; If not defined, take the mode from ETI -mode=1 - -; The digital gain is a value that is multiplied to each sample. It is used -; to tune the chain to make sure that no non-linearities appear up to the -; USRP daughterboard programmable gain amplifier (PGA). -; If there is clipping, the spectral quality of the signal will quickly deteriorate, -; and wide-band noise will be generated. -; -; Be aware that there is a dependency with resampling. -digital_gain=0.8 - -; Output sample rate. Values other than 2048000 enable -; resampling. -; Warning! digital_gain settings are different if resampling -; is enabled or not ! -rate=2048000 - -; CIC equaliser for USRP1 and USRP2 -; Set to 0 to disable CicEqualiser -; when set to 400000000, an additional USRP2 check is enabled. -; See DabModulator.cpp line 186 -dac_clk_rate=0 - -; The USRP1 does not have flexible clocking, you will need -;rate=3200000 -; and -;dac_clk_rate=128000000 - -[firfilter] -; The FIR Filter can be used to create a better spectral quality. -; The filter taps can be calculated with the python script -; doc/fir-filter/generate-filter.py -enabled=0 -filtertapsfile=simple_taps.txt - -[output] -; choose output: possible values: uhd, file, zmq -output=uhd - -[fileoutput] -; Two output formats are supported: In the default mode, -; the file output writes I/Q float values (i.e. complex float) -; to the file. The I and Q samples can take values up to -; 100000 in absolute magnitude with gainmode FIX. -; With gainmode VAR, they should never exceed 50000. -; With gainmode MAX, thet are limited to 32767. -;format=complexf -; -; When the format is set to s8, the output writes I/Q 8-bit -; signed integers, where the magnitude is multiplied by 128/50000 -; effectively mapping the gainmode VAR range of -50000 -- 50000 -; to -128 -- 128. For other gainmodes, use the digital_gain setting -; to make sure you don't create clipping. -;format=s8 - -; The output file: -;filename=/dev/stdout - -[uhdoutput] -; The UHD output can be directly used with the Ettus USRP devices -; -; You have to set master_clock_rate to a multiple of the -; sample_rate. Ideally, it should be -; master_clock_rate = 4 * sample_rate -; or even a higher factor. -; -; Settings for a USRP B100: -;device= -; you can put additional UHD device settings here -;master_clock_rate=32768000 -;type=b100 -;txgain=2.0 -; Try first with small gain values -; Also set rate to 2048000 - -; For the B200 -; More information and measurements available on: -; http://wiki.opendigitalradio.org/index.php/USRP_B200_Measurements -; -; Settings: -device= -master_clock_rate=32768000 -type=b200 -txgain=40 -; The B200 needs larger gains (up to 89dB) but, -; "Gain settings are application specific, but it is recommended that users -; consider using at least half of the available gain to get reasonable dynamic -; range." -; From the B200 User Manual -; http://files.ettus.com/uhd_docs/manual/html/usrp_b200.html - - -; For the USRP1 -;device= -;type=usrp1 -; the usrp1 can have two daughterboards, the subdevice parameter allows you -; to choose which one to use -;subdevice=A:0 -; The USRP1 doesn't support master_clock_rate, you need to enable resamping - - -; You must specify either frequency or channel, but not both. -;frequency=234208000 -channel=13C - -; The reference clock to use. The gpsdo is the ODR LEA-M8F board, the -; official Ettus GPSDO is selected with gpsdo-ettus -; possible values : internal, external, MIMO, gpsdo, gpsdo-ettus -refclk_source=internal - -; The reference one pulse-per second to use -; possible values : none, external, MIMO, gpsdo -pps_source=none - -; Behaviour when external clock reference lock lost -; possible values: ignore, crash -behaviour_refclk_lock_lost=ignore - -; The maximum accepted holdover time for the gpsdo. -; Valid only if the refclk and pps_source are set to gpsdo. -; This value is also used for the initial lock check, and must -; be at least a minute so that the GPSOD has enough time to lock -; and to start disciplining its oscillator. -; Units: seconds -; Set to 0 to disable holdover check -; default value: 0 -max_gps_holdover_time=600 - -; section defining ZeroMQ output properties -[zmqoutput] - -; on which port to listen for connections -; please see the Transports section in man zmq -; for more informat io the syntax -listen=tcp://*:54001 - -; what ZMQ socket type to use. Valid values: PUB, REP -; Please see man zmq_socket for documentation -socket_type=pub - -; Used for SFN with the UHD output -[delaymanagement] - -; Enable handling of timestamps for SFN -synchronous=0 - -; Whether to mute the TX when incoming frames have no timestamp -mutenotimestamps=0 - -; This offset is added to the TIST, and the sum defines the -; TX time of the transmission frame. It can by changed at runtime -; through the remote control. -offset=0.002 - -; The previous static vs dynamic offset distinction, and reading the -; modulatoroffset from a file has been removed. - -[tii] -; (experimental) -; If these options are set, TII transmission is enabled. -; DAB modes I and II are supported, and must be set explicitly in -; this file. Reading DAB mode from ETI is not supported. -enable=0 -comb=16 -pattern=3 - diff --git a/config/mot/bbc1.txt b/config/mot/P01/INFO.dls old mode 100644 new mode 100755 similarity index 100% rename from config/mot/bbc1.txt rename to config/mot/P01/INFO.dls diff --git a/config/mot/P01/INFO.txt b/config/mot/P01/INFO.txt new file mode 100755 index 0000000..c76ade3 --- /dev/null +++ b/config/mot/P01/INFO.txt @@ -0,0 +1 @@ +RADIO MONACO - MADE IN MONTECARLO diff --git a/config/mot/P01/slide/P01-logo.jpg b/config/mot/P01/slide/P01-logo.jpg new file mode 100644 index 0000000..50bb69f Binary files /dev/null and b/config/mot/P01/slide/P01-logo.jpg differ diff --git a/config/mot/f3.txt b/config/mot/P02/INFO.dls old mode 100644 new mode 100755 similarity index 100% rename from config/mot/f3.txt rename to config/mot/P02/INFO.dls diff --git a/config/mot/P02/INFO.txt b/config/mot/P02/INFO.txt new file mode 100755 index 0000000..a00aa4b --- /dev/null +++ b/config/mot/P02/INFO.txt @@ -0,0 +1,2 @@ +LONDON'S NO.1 HIT MUSIC STATION + diff --git a/config/mot/P02/slide/P02-logo.jpg b/config/mot/P02/slide/P02-logo.jpg new file mode 100644 index 0000000..cb40994 Binary files /dev/null and b/config/mot/P02/slide/P02-logo.jpg differ diff --git a/config/mot/fip.txt b/config/mot/fip.txt deleted file mode 100644 index e69de29..0000000 diff --git a/config/mot/maxxima.txt b/config/mot/maxxima.txt deleted file mode 100644 index e69de29..0000000 diff --git a/config/mux.conf b/config/mux.conf deleted file mode 100644 index 45896c0..0000000 --- a/config/mux.conf +++ /dev/null @@ -1,207 +0,0 @@ -; This is an example configuration file that illustrates -; the structure of the configuration. -; It doesn't show all possible options. A more detailed example -; is available in doc/advanced.mux -; -; More information about the usage of the tools is available -; in the guide, which can be found on the -; www.opendigitalradio.org website. -; -; As you can see, comments are defined by semicolons. -; -; It consists of six mandatory sections, whose relative order in this -; file are of no importance. - -; The general section defines global multiplex parameters. -general { - ; the DAB Transmission mode (values 1-4 accepted) - dabmode 1 - - ; the number of ETI frames to generate (set to 0 to get an unlimited number) - nbframes 0 - - ; boolean fields can accept either false or true as values: - - ; Set to true to enable logging to syslog - syslog false - - ; Enable timestamp definition necessary for SFN - ; This also enables time encoding using the MNSC. - tist false - - ; The management server is a simple TCP server that can present - ; statistics data (buffers, overruns, underruns, etc) - ; which can then be graphed a tool like Munin - ; The doc/stats_dabmux_multi.py tool is a suitable - ; plugin for that. - ; If the port is zero, or the line commented, the server - ; is not started. - managementport 12720 -} - -remotecontrol { - ; enable the telnet remote control server on the given port - ; This server allows you to read and define parameters that - ; some features export. It is only accessible from localhost. - ; Set the port to 0 to disable the server - telnetport 12721 - - ; the remote control server makes use of the unique identifiers - ; for the subchannels, services and components. Make sure you - ; chose them so that you can identify them. -} - -; Some ensemble parameters -ensemble { - id 0x4fff ; you can also use decimal if you want - ecc 0xec ; Extended Country Code - - local-time-offset auto ; autmatically calculate from system local time - ; or - ;local-time-offset 1 ; in hours, supports half-hour offsets - - ; all labels are maximum 16 characters in length - label "OpenDigitalRadio" - ; The short label is built from the label by erasing letters, and cannot - ; be longer than 8 characters. If omitted, it will be truncated from the - ; label - shortlabel "ODR" -} - -; Definition of DAB services -services { - ; Each service has it's own unique identifier, that is - ; used throughout the configuration file and for the RC. - srv-f3 { - id 0x8daa - label "Frequence3" - shortlabel "F3" - } - srv-maxxima { - id 0x8dab - label "Maxxima" - } - srv-fip { - id 0x8dac - label "FIP" - } - srv-bbc1 { - id 0x8dad - label "BBC1" - } -} - -subchannels { - sub-f3 { - type dabplus - inputfile "tcp://*:9001" - bitrate 96 - id 1 - protection 3 - ; ZMQ specific options, mandatory: - - ; Maximum size of input buffer, in AAC frames (24ms) - ; when this buffer size is reached, some frames will be - ; discarded to get the size again below this value. - ; As the present implementation discards entire AAC superframes, - ; (5 frames = 120ms) the effect will clearly be audible. - zmq-buffer 40 - - ; At startup or after an underrun, the buffer is filled to this - ; amount of AAC frames before streaming starts. - zmq-prebuffering 20 - } - sub-maxxima { - type dabplus - inputfile "tcp://*:9002" - bitrate 96 - id 2 - protection 3 - - zmq-buffer 40 - zmq-prebuffering 20 - } - sub-fip { - type dabplus - inputfile "tcp://*:9003" - bitrate 96 - id 3 - protection 3 - - zmq-buffer 40 - zmq-prebuffering 20 - } - - sub-bbc1 { - type audio - inputfile "tcp://*:9004" - bitrate 128 - id 4 - protection 1 - - zmq-buffer 40 - zmq-prebuffering 20 - } -} - -; In our simple example, each component links one service to one subchannel -components { - ; the component unique identifiers are used for the RC. - comp-f3 { - ; According to specification, you should not define component labels if - ; the service is only used in one component. The service label is sufficient - ; in that case. - - service srv-f3 - subchannel sub-f3 - - figtype 0x2 - ; 0x2 : MOT Slideshow - } - - comp-maxxima { - service srv-maxxima - subchannel sub-maxxima - - figtype 0x2 - } - - comp-fip { - service srv-fip - subchannel sub-fip - - figtype 0x2 - } - - comp-bbc1 { - service srv-bbc1 - subchannel sub-bbc1 - - figtype 0x2 - } -} - -outputs { - ; The unique-id can be used by the remote control or the statistics server - ; to identify the output - - ; Output RAW ETI NI to standard output - ;stdout "fifo:///dev/stdout?type=raw" - - ; ZeroMQ output example - ; Listen on all interfaces, on port 9050 - zmq "zmq+tcp://*:9050" - - ; Throttle output to real-time (one ETI frame every 24ms) - throttle "simul://" - - ; Important! For real-time operation, you need to have exactly one - ; output that applies back-pressure to ODR-DabMux, otherwise it will run - ; at the highest possible rate on your system! - ; - ; For an output to a pipe, the data consumer at the other end of the pipe - ; will dictate the multiplexing rate to ODR-DabMux. - ; - ; If you use the zmq output, you must also enable a simul:// output! -} - diff --git a/config/odr-dabmod.ini b/config/odr-dabmod.ini new file mode 100644 index 0000000..cd9bd5e --- /dev/null +++ b/config/odr-dabmod.ini @@ -0,0 +1,41 @@ +[remotecontrol] +telnet=0 +telnetport=2121 +zmqctrl=0 +zmqctrlendpoint=tcp://127.0.0.1:9400 + +[log] +syslog=0 +filelog=0 +filename=odr-dabmod.log + +[input] +transport=edi +source=tcp://127.0.0.1:9201 + +[modulator] +gainmode=var +digital_gain=0.8 +rate=4096000 + +[cfr] +enable=0 +clip=50.0 +error_clip=0.1 + +[firfilter] +enabled=1 + +[poly] +enabled=0 +polycoeffile=polyCoefs + +[output] +output=soapysdr + +[soapyoutput] +device=driver=hackrf +master_clock_rate=32768000 +txgain=23 +channel=5A +bandwidth=1750000 diff --git a/config/odr-dabmux.info b/config/odr-dabmux.info new file mode 100644 index 0000000..91eb04f --- /dev/null +++ b/config/odr-dabmux.info @@ -0,0 +1,99 @@ +general { + dabmode 1 + nbframes 0 + syslog false + tist false + managementport 12720 +} + +remotecontrol { + telnetport 12721 + zmqendpoint tcp://lo:12722 +} + +ensemble { + id 0x4fff + ecc 0xe1 + local-time-offset auto + international-table 1 + reconfig-counter hash + label "Micro DAB" + shortlabel "M DAB" +} + +services { + srv-01 { + id 0xb1c7 + ecc 0xe2 + label "RADIO MONACO" + shortlabel "MONACO" + pty 10 + pty-sd static + language 0x0f + } + srv-02 { + id 0xc479 + ecc 0xe1 + label "CAPITAL LONDON" + shortlabel "CAPITAL" + pty 10 + pty-sd static + language 0x09 + } +} + +subchannels { + sub-01 { + type dabplus + bitrate 128 + id 1 + protection 3 + inputproto edi + inputuri "tcp://127.0.0.1:9001" + buffer-management prebuffering + buffer 40 + prebuffering 20 + } + sub-02 { + type dabplus + bitrate 128 + id 2 + protection 3 + inputproto edi + inputuri "tcp://127.0.0.1:9002" + buffer-management prebuffering + buffer 40 + prebuffering 20 + } +} + +components { + comp-01 { + service srv-01 + subchannel sub-01 + user-applications { + userapp "slideshow" + } + } + comp-02 { + service srv-02 + subchannel sub-02 + user-applications { + userapp "slideshow" + } + } +} + +outputs { + edi { + destinations { + edi_tcp { + protocol tcp + listenport 9201 + } + } + } + + ; Throttle output to real-time (one ETI frame every 24ms) + throttle "simul://" +} diff --git a/config/supervisor/ODR-encoders.conf b/config/supervisor/ODR-encoders.conf new file mode 100644 index 0000000..362a41b --- /dev/null +++ b/config/supervisor/ODR-encoders.conf @@ -0,0 +1,79 @@ +# P01 +[program:odr-padencoder-defee58a-f768-4ca9-a0f7-88f08b2e8748] +command=/usr/local/bin/odr-padenc + --dir=/home/pi/config/mot/P01/slide + --sleep=0 + --dls=/home/pi/config/mot/P01/INFO.dls + --output=defee58a-f768-4ca9-a0f7-88f08b2e8748 + --label=12 + --label-ins=1200 +autostart=false +autorestart=false +priority=10 +user=pi +group=pi +redirect_stderr=true +stdout_logfile=/var/log/supervisor/odr-padencoder-defee58a-f768-4ca9-a0f7-88f08b2e8748.log + +# P01 +[program:odr-audioencoder-defee58a-f768-4ca9-a0f7-88f08b2e8748] +command=/usr/local/bin/odr-audioenc + --vlc-uri=http://radiomonaco.ice.infomaniak.ch/radiomonaco-128.mp3 + --drift-comp + --silence=60 + --bitrate=128 + --rate=48000 + --channels=2 + --sbr + --pad=34 + --pad-socket=defee58a-f768-4ca9-a0f7-88f08b2e8748 + --write-icy-text=/home/pi/config/mot/P01/INFO.dls + -e tcp://127.0.0.1:9001 + --stats=/var/tmp/P01.stats +autostart=false +autorestart=false +priority=10 +user=pi +group=pi +redirect_stderr=true +stdout_logfile=/var/log/supervisor/odr-audioencoder-defee58a-f768-4ca9-a0f7-88f08b2e8748.log + +# P02 +[program:odr-padencoder-7158c498-1ef1-4580-b385-23a3c06ba985] +command=/usr/local/bin/odr-padenc + --dir=/home/pi/config/mot/P02/slide + --sleep=0 + --dls=/home/pi/config/mot/P02/INFO.dls + --output=7158c498-1ef1-4580-b385-23a3c06ba985 + --label=12 + --label-ins=1200 +autostart=false +autorestart=false +priority=10 +user=pi +group=pi +redirect_stderr=true +stdout_logfile=/var/log/supervisor/odr-padencoder-7158c498-1ef1-4580-b385-23a3c06ba985.log + +# P02 +[program:odr-audioencoder-7158c498-1ef1-4580-b385-23a3c06ba985] +command=/usr/local/bin/odr-audioenc + --vlc-uri=http://media-ice.musicradio.com/CapitalMP3 + --drift-comp + --silence=60 + --bitrate=128 + --rate=48000 + --channels=2 + --sbr + --pad=34 + --pad-socket=7158c498-1ef1-4580-b385-23a3c06ba985 + --write-icy-text=/home/pi/config/mot/P02/INFO.dls + -e tcp://127.0.0.1:9002 + --stats=/var/tmp/P02.stats +autostart=false +autorestart=false +priority=10 +user=pi +group=pi +redirect_stderr=true +stdout_logfile=/var/log/supervisor/odr-audioencoder-7158c498-1ef1-4580-b385-23a3c06ba985.log diff --git a/config/supervisor/ODR-misc.conf b/config/supervisor/ODR-misc.conf new file mode 100644 index 0000000..8e4279f --- /dev/null +++ b/config/supervisor/ODR-misc.conf @@ -0,0 +1,38 @@ +[program:10-EncoderManager] +command=python3 run.py -c /home/pi/config/encodermanager.json +directory=/home/pi/ODR-mmbTools/ODR-EncoderManager +autostart=false +autorestart=false +priority=10 +user=pi +group=pi +stderr_logfile=/var/log/supervisor/encoderManager.log +stdout_logfile=/var/log/supervisor/encoderManager.log + +[program:20-Multiplex] +command=odr-dabmux odr-dabmux.info +directory=/home/pi/config/ +autostart=false +autorestart=false +user=pi +group=pi +stderr_logfile=/var/log/supervisor/mux.log +stdout_logfile=/var/log/supervisor/mux.log + +[program:21-Multiplex-Manager] +command=python3 odr-dabmux-gui.py --port=8002 --host=raspberrypi.local +directory=/home/pi/ODR-mmbTools/ODR-DabMux/gui +autostart=false +autorestart=false +user=pi +group=pi +stderr_logfile=/var/log/supervisor/mux-manager.log +stdout_logfile=/var/log/supervisor/mux-manager.log + +[program:30-Modulator] +command=odr-dabmod odr-dabmod.ini +directory=/home/pi/config/ +autostart=false +autorestart=false +stderr_logfile=/var/log/supervisor/mod.log +stdout_logfile=/var/log/supervisor/mod.log diff --git a/config/supervisor/encoder-bbc1.conf b/config/supervisor/encoder-bbc1.conf deleted file mode 100644 index c53068a..0000000 --- a/config/supervisor/encoder-bbc1.conf +++ /dev/null @@ -1,20 +0,0 @@ -[program:encoder-bbc1] -# DAB encoding using odr-audioenc -command=/usr/local/bin/odr-audioenc --dab --vlc-uri=http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p -b 128 -r 48000 -o tcp://127.0.0.1:9004 --pad=58 --pad-fifo=/home/odr/config/mot/bbc1.pad --write-icy-text=/home/odr/config/mot/bbc1.txt - -# DAB encoding using toolame -#command=/usr/local/bin/toolame-dab -s 48 -V http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p -b 128 -W /home/odr/config/mot/bbc1.txt -p 58 -P /home/odr/config/mot/bbc1.pad tcp://127.0.0.1:9004 - -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/encoder-bbc1.log -stdout_logfile=/var/log/supervisor/encoder-bbc1.log - -[program:mot-bbc1] -command=/usr/local/bin/odr-padenc -t /home/odr/config/mot/bbc1.txt -o /home/odr/config/mot/bbc1.pad --pad=58 --charset=15 --dir=/home/odr/config/mot/bbc1/ --sleep=30 -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/mot-bbc1.log -stdout_logfile=/var/log/supervisor/mot-bbc1.log diff --git a/config/supervisor/encoder-f3.conf b/config/supervisor/encoder-f3.conf deleted file mode 100644 index 715bf1a..0000000 --- a/config/supervisor/encoder-f3.conf +++ /dev/null @@ -1,15 +0,0 @@ -[program:encoder-f3] -command=/usr/local/bin/odr-audioenc --vlc-uri=http://ice.stream.frequence3.net/frequence3-128.mp3 -b 96 -r 48000 -o tcp://127.0.0.1:9001 --pad=58 --pad-fifo=/home/odr/config/mot/f3.pad --write-icy-text=/home/odr/config/mot/f3.txt -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/encoder-f3.log -stdout_logfile=/var/log/supervisor/encoder-f3.log - -[program:mot-f3] -command=/usr/local/bin/odr-padenc -t /home/odr/config/mot/f3.txt -o /home/odr/config/mot/f3.pad --pad=58 --dir=/home/odr/config/mot/f3/ --sleep=30 -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/mot-f3.log -stdout_logfile=/var/log/supervisor/mot-f3.log diff --git a/config/supervisor/encoder-fip.conf b/config/supervisor/encoder-fip.conf deleted file mode 100644 index a35b96b..0000000 --- a/config/supervisor/encoder-fip.conf +++ /dev/null @@ -1,15 +0,0 @@ -[program:encoder-fip] -command=/usr/local/bin/odr-audioenc --vlc-uri=http://audio.scdn.arkena.com/11016/fip-midfi128.mp3 -b 96 -r 48000 -o tcp://127.0.0.1:9003 --pad=58 --pad-fifo=/home/odr/config/mot/fip.pad --write-icy-text=/home/odr/config/mot/fip.txt -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/encoder-fip.log -stdout_logfile=/var/log/supervisor/encoder-fip.log - -[program:mot-fip] -command=/usr/local/bin/odr-padenc -t /home/odr/config/mot/fip.txt -o /home/odr/config/mot/fip.pad --pad=58 --dir=/home/odr/config/mot/fip/ --sleep=30 -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/mot-fip.log -stdout_logfile=/var/log/supervisor/mot-fip.log diff --git a/config/supervisor/encoder-maxxima.conf b/config/supervisor/encoder-maxxima.conf deleted file mode 100644 index 550eb91..0000000 --- a/config/supervisor/encoder-maxxima.conf +++ /dev/null @@ -1,15 +0,0 @@ -[program:encoder-maxxima] -command=/usr/local/bin/odr-audioenc --vlc-uri=http://maxxima.mine.nu:8000/ -b 96 -r 32000 -o tcp://127.0.0.1:9002 --pad=58 --pad-fifo=/home/odr/config/mot/maxxima.pad --write-icy-text=/home/odr/config/mot/maxxima.txt -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/encoder-maxxima.log -stdout_logfile=/var/log/supervisor/encoder-maxxima.log - -[program:mot-maxxima] -command=/usr/local/bin/odr-padenc -t /home/odr/config/mot/maxxima.txt -o /home/odr/config/mot/maxxima.pad --pad=58 --dir=/home/odr/config/mot/maxxima/ --sleep=30 -autostart=false -autorestart=true -priority=10 -stderr_logfile=/var/log/supervisor/mot-maxxima.log -stdout_logfile=/var/log/supervisor/mot-maxxima.log diff --git a/config/supervisor/mod.conf b/config/supervisor/mod.conf deleted file mode 100644 index f4941e6..0000000 --- a/config/supervisor/mod.conf +++ /dev/null @@ -1,7 +0,0 @@ -[program:mod] -command=/usr/local/bin/odr-dabmod /home/odr/config/mod.ini -autostart=false -autorestart=true -priority=1 -stderr_logfile=/var/log/supervisor/mod.log -stdout_logfile=/var/log/supervisor/mod.log diff --git a/config/supervisor/mux.conf b/config/supervisor/mux.conf deleted file mode 100644 index 5539ea3..0000000 --- a/config/supervisor/mux.conf +++ /dev/null @@ -1,7 +0,0 @@ -[program:mux] -command=/usr/local/bin/odr-dabmux /home/odr/config/mux.conf -autostart=false -autorestart=true -priority=1 -stderr_logfile=/var/log/supervisor/mux.log -stdout_logfile=/var/log/supervisor/mux.log diff --git a/install/README.md b/install/README.md new file mode 100644 index 0000000..83e74a0 --- /dev/null +++ b/install/README.md @@ -0,0 +1,61 @@ +# Table of contents +- [Introduction](#introduction) +- [Installation](#installation) +- [Removal](#removal) + +# Introduction +The goal of the mmbtools-get shell script is to install: +- the [odr-mmbtools](https://www.opendigitalradio.org/mmbtools) components developed by the [Open Digital Radio](https://www.opendigitalradio.org/) non-profit association on a clean debian environment +- Working configuration files that you can later customize as you see fit + +# Installation +## Preliminary notes +We **highly recommend** that you install odr-mmbTools on a **new debian** environment, starting from the Bullseye release. Since some software components, like the audio encoders or the modulator, are CPU-intensive, we recommend you setup a lite debian environment (ie. without a GUI framework). + +If you want to quickly setup a lite clean debian environment, we suggest you use [Vagrant](https://www.vagrantup.com) associated with a virtualization hypervisor, like [Virtualbox](https://www.virtualbox.org). A sample Vagrantfile is available in the Vagrant folder of this repository. + +## Steps +1. Sign-in with your user profile +1. Update your system: + ``` + sudo apt-get update + sudo apt-get upgrade -y + ``` +1. Find your time zone: + ``` + timedatectl list-timezones + ``` +1. Set your time zone: + ``` + sudo timedatectl set-timezone your_timezone + ``` +1. Install the git command: + ``` + sudo apt-get install -y git + ``` +1. Clone this repository: + ``` + cd $HOME + + # Clone the stable version of dab-scripts + git clone https://github.com/opendigitalradio/dab-scripts.git + + # Or clone the next version of dab-scripts + git clone --branch next https://github.com/opendigitalradio/dab-scripts.git + ``` +1. Install the ODR-mmbTools suite and the sample configuration folder + ``` + # Install the stable version of odr-mmbTools + bash $HOME/dab-scripts/install/mmbtools-get --branch master install + + # Or install the next version of odr-mmbTools + bash $HOME/dab-scripts/install/mmbtools-get --branch next install + ``` + +# Removal +If you wish to remove the odr-mmbTools suite and the sample configuration folder, then follow these steps: +1. Stop all odr-mmbTools related jobs in supervisor +2. Remove the ODR-mmbTools software suite and the configuration folder + ``` + bash $HOME/dab-scripts/install/mmbtools-get remove + ``` diff --git a/install/mmbtools-get b/install/mmbtools-get new file mode 100644 index 0000000..2dab049 --- /dev/null +++ b/install/mmbtools-get @@ -0,0 +1,266 @@ +#!/bin/bash + +# mmbtools-get - Build, install, uninstall, remove the software stack +# Copyright (C) 20222 Robin ALEXANDER +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +## CONSTANTS +source $(realpath $(dirname $0))/mmbtools-get.conf + +print_usage () { + cat <<- EOF + Usage: + mmbtools-get [option] action + + Option: + -h, --help Print this help + -b, --branch Specify the odr-mmbTools branch to use + + Action: + install Install the programs and the configuration sample + remove Remove the programs and the configuration sample + +EOF +} + +install_base () { + # Install the essential tools and create the tools root directory + sudo apt-get update + sudo apt-get install -y build-essential automake libtool supervisor + + if [ ! -d ${DIR_MMB} ]; then + mkdir ${DIR_MMB} + fi + + if [ ! $(grep inet_http_server /etc/supervisor/supervisord.conf) ]; then + cat << EOF | sudo tee -a /etc/supervisor/supervisord.conf > /dev/null + +[inet_http_server] +port = 8001 +username = odr ; Auth username +password = odr ; Auth password +EOF + fi +} + +install_audioenc () { + # Install mmb-tools: audio encoder + sudo apt-get install -y libzmq3-dev libzmq5 libvlc-dev vlc-data vlc-plugin-base libcurl4-openssl-dev pkg-config + if [ ! -d ${DIR_AUDIO} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-AudioEnc.git --branch ${1} + popd + fi + pushd ${DIR_AUDIO} + ./bootstrap + ./configure --enable-vlc + make + sudo make install + make clean + popd +} + +install_padenc () { + # Install mmb-tools: PAD encoder + sudo apt-get install -y libmagickwand-dev + if [ ! -d ${DIR_PAD} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-PadEnc.git --branch ${1} + popd + fi + pushd ${DIR_PAD} + ./bootstrap + ./configure + make + sudo make install + make clean + popd +} + +install_dabmux () { + # Install mmb-tools: dab multiplexer + sudo apt-get install -y libboost-system-dev libcurl4-openssl-dev python3-zmq + if [ ! -d ${DIR_MUX} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-DabMux.git --branch ${1} + popd + fi + pushd ${DIR_MUX} + ./bootstrap.sh + ## Temporary, until ODR-DabMux configure is modified + arch=$(uname -m) + if [ "${arch}" = "armv7l" ]; then + ./configure --with-boost-libdir=/usr/lib/arm-linux-gnueabihf + else + ./configure + fi + make + sudo make install + make clean + popd +} + +install_dabmod () { + # Install mmb-tools: modulator + sudo apt-get install -y libfftw3-dev libzmq3-dev libuhd-dev libsoapysdr-dev libbladerf-dev liblimesuite-dev + if [ ! -d ${DIR_MOD} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-DabMod.git --branch ${1} + popd + fi + pushd ${DIR_MOD} + ./bootstrap.sh + ./configure CFLAGS="-O3 -DNDEBUG" CXXFLAGS="-O3 -DNDEBUG" --enable-fast-math --disable-zeromq --enable-limesdr --enable-bladerf + make + sudo make install + make clean + popd +} + +install_fdkaac () { + # Install mmb-tools: fdk-aac + if [ ! -d ${DIR_FDKAAC} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/fdk-aac.git + popd + fi + pushd ${DIR_FDKAAC} + ./bootstrap + ./configure + make + sudo make install + make clean + popd +} + +install_srccmp () { + # Install mmb-tools: source companion + if [ ! -d ${DIR_SRCCMP} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-SourceCompanion.git --branch ${1} + popd + fi + pushd ${DIR_SRCCMP} + ./bootstrap + ./configure + make + sudo make install + make clean + popd +} + +install_encmgr () { + # Install mmb-tools: encoder manager + sudo apt-get install -y python3-cherrypy3 python3-jinja2 python3-serial python3-yaml supervisor python3-pysnmp4 + if [ ! -d ${DIR_ENCMGR} ]; then + pushd ${DIR_MMB} + git clone https://github.com/Opendigitalradio/ODR-EncoderManager.git --branch ${1} + popd + fi + ## Add the current user to the dialout and audio groups + sudo usermod --append --group dialout $(id --user --name) + sudo usermod --append --group audio $(id --user --name) +} + +install_config () { +# Copy the configuration files + if [ -d ${DIR_CONFIG} ]; then + rm -r ${DIR_CONFIG} + fi + cp -r $(realpath $(dirname $0))/../${CONFIG_NAME} ${DIR_CONFIG} + sudo ln -s ${DIR_CONFIG}/supervisor/*.conf /etc/supervisor/conf.d/ + + ## Adapt the supervisor configuration files + sed -e "s;user=pi;user=$(id --user --name);g" -i ${DIR_CONFIG}/supervisor/*.conf + sed -e "s;group=pi;group=$(id --group --name);g" -i ${DIR_CONFIG}/supervisor/*.conf + sed -e "s;/home/pi;${HOME};g" -i ${HOME}/config/supervisor/*.conf + + ## Adapt the ODR-EncoderManager configuration file + sed -e "s;/home/pi;${HOME};g" -i ${DIR_CONFIG}/encodermanager.json + sed -e "s;\"user\": \"pi\";\"user\": \"$(id --user --name)\";g" -i ${DIR_CONFIG}/encodermanager.json + sed -e "s;\"group\": \"pi\";\"group\": \"$(id --group --name)\";g" -i ${DIR_CONFIG}/encodermanager.json + + ## Adapt the odr-misc.conf + sed -e "s;--host=raspberrypi.local;--host=$(hostname -I | awk '{print $1}');" -i ${DIR_CONFIG}/supervisor/ODR-misc.conf + + ## Restart supervisor + sudo supervisorctl reread + sudo supervisorctl reload + + echo "Sample configuration files installed" +} + +install () { + # Clone the sources, build and install programs, clean-up + install_base ${1} + install_fdkaac ${1} + install_audioenc ${1} + install_padenc ${1} + install_dabmux ${1} + install_dabmod ${1} + install_srccmp ${1} + install_encmgr ${1} + install_config + sudo ldconfig + + sudo apt-get purge -y + sudo rm -rf /var/lib/apt/lists/* + + echo "ODR-mmbTools suite and configuration files installed" +} + +remove () { + # Uninstall programs + for makefile in $(ls ${DIR_MMB}/**/Makefile); do + pushd $(dirname ${makefile}) + sudo make uninstall + popd + done + + # Delete sources + rm -rf ${DIR_MMB} + + # Delete configuration files + rm -rf ${DIR_CONFIG} + + # Update supervisor + sudo rm /etc/supervisor/conf.d/ODR-* + sudo supervisorctl reread + sudo supervisorctl reload + + echo "ODR-mmbTools suite and configuration files removed" +} + +# MAIN PROGRAM +branch="master" +action="" + +while [ "$#" -gt 0 ] ; do + case "${1}" in + (-h|--help) print_usage; exit 0 ;; + (-b|--branch) branch="${2}" ; shift ;; + install) action="install" ;; + remove) action="remove" ;; + *) print_usage; exit 1 ;; + esac + shift +done + +if [ "${action}" == "install" ]; then + install ${branch} +else + remove +fi \ No newline at end of file diff --git a/install/mmbtools-get.conf b/install/mmbtools-get.conf new file mode 100644 index 0000000..e20380d --- /dev/null +++ b/install/mmbtools-get.conf @@ -0,0 +1,11 @@ +# DEFINE DIRECTORIES +CONFIG_NAME=config +DIR_CONFIG=${HOME}/${CONFIG_NAME} +DIR_MMB=${HOME}/ODR-mmbTools +DIR_AUDIO=${DIR_MMB}/ODR-AudioEnc +DIR_PAD=${DIR_MMB}/ODR-PadEnc +DIR_MUX=${DIR_MMB}/ODR-DabMux +DIR_MOD=${DIR_MMB}/ODR-DabMod +DIR_FDKAAC=${DIR_MMB}/fdk-aac +DIR_SRCCMP=${DIR_MMB}/ODR-SourceCompanion +DIR_ENCMGR=${DIR_MMB}/ODR-EncoderManager \ No newline at end of file diff --git a/vagrant/README.md b/vagrant/README.md new file mode 100644 index 0000000..3f24c68 --- /dev/null +++ b/vagrant/README.md @@ -0,0 +1,37 @@ +# Introduction +[Vagrant](https://www.vagrantup.com) provides easy to configure, reproducible, and portable work environments on top of virtual management software like [Virtualbox](https://www.virtualbox.org/). + +With Vagrant and Virtualbox, you can run the ODR-mmbTools regardless of the operating system you are using, such as Windows, MacOS, *BSD or any non-Debian Linux. + +# Setup +1. Install Virtualbox for your operating system +1. Install the Virtualbox Extension pack +1. Install Vagrant for your operating system +1. Clone this repository or copy the Vagrantfile on your host +1. Create and start the virtual environment: + ``` + # Go to the directory that contains the Vagrantfile + vagrant up + ``` +1. Access the virtual session to build the ODR-mmbTools suite: + ``` + vagrant ssh + ``` +1. Follow the instructions of the **README.md** in the install folder to build the ODR-mmbTools suite +1. Exit the virtual session with the command **exit** +1. Connect the SoapySDR transceiver device to your physical host where VirtualBox is running +1. Open VirtualBox and add a USB filter that relates to your SoapySDR device to the **odr-mmb** session +1. Restart the **odr-mmbtools** VirtualBox session with Vagrant: + ``` + vagrant reload + ``` + +# Operations +Once the ODR-mmbTools are installed, you no longer need to access the virtual session, unless you need to make configuration changes. + +Here are the url to access the following web interfaces: +- Supervisor: http://localhost:8001 +- Multiplex Manager: http://localhost:8002 +- Encoder Manager: http://localhost:8003 + +You can monitor the output of odr-DabMux with dablin on localhost:9201 \ No newline at end of file diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 0000000..c61f0c8 --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,15 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "generic/debian11" + config.vm.network "forwarded_port", guest: 8001, host: 8001 + config.vm.network "forwarded_port", guest: 8002, host: 8002 + config.vm.network "forwarded_port", guest: 8003, host: 8003 + config.vm.network "forwarded_port", guest: 9201, host: 9201 + config.vm.provider "virtualbox" do |vb| + vb.name = "odr-mmbtools" + vb.customize ['modifyvm', :id, '--usbxhci', 'on'] + end + end + \ No newline at end of file