mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-16 09:53:01 -06:00
CSDR-AM script added to the examples folder
This commit is contained in:
parent
9833900751
commit
d23457e9aa
91
docs/examples/csdr/README.md
Normal file
91
docs/examples/csdr/README.md
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
# CSDR-AM
|
||||||
|
|
||||||
|
The purpose of this shell script is to record multiple AM frequencies from a single RTL-SDR and creates individual audio files per conversation.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Tested on a linux box.
|
||||||
|
|
||||||
|
* [csdr](https://github.com/ha7ilm/csdr)
|
||||||
|
* [sox](http://sox.sourceforge.net/)
|
||||||
|
|
||||||
|
## Configurations
|
||||||
|
|
||||||
|
### Within the script itself
|
||||||
|
|
||||||
|
Change the the values to you needs. Make sure the `centered_freq` and `sampling_rate` covers the `freqs`.
|
||||||
|
|
||||||
|
Note the syntax for `freqs` and `filenames`, they are arrays.
|
||||||
|
|
||||||
|
Each filename template use sox multiple output mode syntax for file numbering (`%6n`). The static part is reused by `dirWatch` to distinguish which `talkgroup` to import to.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
audio_dir=./audio_files/air
|
||||||
|
device_id=00000001
|
||||||
|
center_freq=119.4e6
|
||||||
|
gain=38.6
|
||||||
|
sampling_rate=2400000
|
||||||
|
squelch=2e-4
|
||||||
|
|
||||||
|
freqs=(118.9e6 119.1e6 119.9e6)
|
||||||
|
|
||||||
|
filenames=(118900000-%6n 119100000-%6n 119900000-%6n)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rdio Scanner
|
||||||
|
|
||||||
|
Whenever a new file is being created by the `CSDR-AM` script, `Rdio Scanner` will pick it up and load it.
|
||||||
|
|
||||||
|
Since the script create a file for each frequency which will have a size of `0` until the next conversation, we have to tell the `dirWatch` entry to delay the import for `4000` milliseconds.
|
||||||
|
|
||||||
|
The system also needs to be defined.
|
||||||
|
|
||||||
|
> For simplicy, talkgroup ids are defined with the same value as for the frequency. It makes it easier to change things afterwards.
|
||||||
|
|
||||||
|
```json
|
||||||
|
"rdioScanner": {
|
||||||
|
"dirWatch": [
|
||||||
|
{
|
||||||
|
"delay": 4000,
|
||||||
|
"deleteAfter": true,
|
||||||
|
"directory": "/home/radio/csdr/audio_files/air",
|
||||||
|
"extension": "wav",
|
||||||
|
"system": 61,
|
||||||
|
"talkgroup": ".*\\/(\\d+)-.*"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
{
|
||||||
|
"id": 61,
|
||||||
|
"label": "AIRCRAFT",
|
||||||
|
"led": "cyan",
|
||||||
|
"talkgroups": [
|
||||||
|
{
|
||||||
|
"id": 119100000,
|
||||||
|
"label": "YMX TOWER",
|
||||||
|
"name": "YMX Tower",
|
||||||
|
"tag": "Aircraft",
|
||||||
|
"group": "AIRCRAFT",
|
||||||
|
"frequency": 119100000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 119900000,
|
||||||
|
"label": "YUL TOWER",
|
||||||
|
"name": "YUL Tower",
|
||||||
|
"tag": "Aircraft",
|
||||||
|
"group": "AIRCRAFT",
|
||||||
|
"frequency": 119900000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 118900000,
|
||||||
|
"label": "YUL DA_SE",
|
||||||
|
"name": "YUL Dep/Arr S/E",
|
||||||
|
"tag": "Aircraft",
|
||||||
|
"group": "AIRCRAFT",
|
||||||
|
"frequency": 118900000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
85
docs/examples/csdr/csdr-am
Executable file
85
docs/examples/csdr/csdr-am
Executable file
|
|
@ -0,0 +1,85 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##
|
||||||
|
## #############################################################################
|
||||||
|
## Copyright (C) 2019-2020 Chrystian Huot
|
||||||
|
##
|
||||||
|
## 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 <http://www.gnu.org/licenses/>
|
||||||
|
## #############################################################################
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## Begin of configurable values
|
||||||
|
##
|
||||||
|
|
||||||
|
audio_dir=./audio_files/air
|
||||||
|
device_id=00000001
|
||||||
|
center_freq=119.4e6
|
||||||
|
gain=38.6
|
||||||
|
sampling_rate=2400000
|
||||||
|
squelch=2e-4
|
||||||
|
|
||||||
|
## List of frequencies covered by your RTL
|
||||||
|
|
||||||
|
freqs=(118.9e6 119.1e6 119.9e6)
|
||||||
|
|
||||||
|
## Filename tempaltes for each frequencies
|
||||||
|
## See sox documentation for multiple files output
|
||||||
|
|
||||||
|
filenames=(118900000-%6n 119100000-%6n 119900000-%6n)
|
||||||
|
|
||||||
|
##
|
||||||
|
## End of configurable values
|
||||||
|
##
|
||||||
|
|
||||||
|
for i in ${!freqs[@]}; do
|
||||||
|
mkfifo /tmp/csdr_${device_id}_${freqs[i]}_iq.fifo
|
||||||
|
|
||||||
|
mkfifo /tmp/csdr_${device_id}_${freqs[i]}_squelch.fifo
|
||||||
|
done
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
test -d ${audio_dir} || mkdir -p ${audio_dir} || exit 1
|
||||||
|
|
||||||
|
trap "rm -f /tmp/csdr_${device_id}_*.fifo" EXIT
|
||||||
|
|
||||||
|
for i in ${!freqs[@]}; do
|
||||||
|
cat /tmp/csdr_${device_id}_${freqs[i]}_iq.fifo |
|
||||||
|
csdr convert_u8_f |
|
||||||
|
csdr shift_addition_cc $(csdr =\(${center_freq}-${freqs[i]}\)/${sampling_rate}) |
|
||||||
|
csdr fir_decimate_cc 50 0.005 HAMMING |
|
||||||
|
csdr squelch_and_smeter_cc --fifo /tmp/csdr_${device_id}_${freqs[i]}_squelch.fifo --outfifo /dev/null 6e-5 600 |
|
||||||
|
csdr amdemod_cf |
|
||||||
|
csdr agc_ff |
|
||||||
|
csdr limit_ff |
|
||||||
|
csdr convert_f_s16 |
|
||||||
|
sox -c 1 -r 44100 -t s16 - "${audio_dir}/${filenames[i]}.wav" silence 1 0.50 0.1% 1 2.0 0.1% : newfile : restart &
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in ${!freqs[@]}; do
|
||||||
|
echo ${squelch} >/tmp/csdr_${device_id}_${freqs[i]}_squelch.fifo
|
||||||
|
done
|
||||||
|
|
||||||
|
server="rtl_sdr -d ${device_id} -f ${center_freq} -g ${gain} -s ${sampling_rate} -"
|
||||||
|
|
||||||
|
for i in ${!freqs[@]}; do
|
||||||
|
if [ $i == $((${#freqs[@]} - 1)) ]; then
|
||||||
|
server+=" > /tmp/csdr_${device_id}_${freqs[i]}_iq.fifo"
|
||||||
|
else
|
||||||
|
server+=" | tee /tmp/csdr_${device_id}_${freqs[i]}_iq.fifo"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
eval ${server}
|
||||||
Loading…
Reference in a new issue