summaryrefslogtreecommitdiff
path: root/doc/sound_node.md
blob: 03e84e49f105658aa4a3353dee28449f47dca362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Sound Node

## Requirements

```
apt install -y python3-aiohttp python3-requests python3-toml
```

## Configuration

Orange Pi Lite config (`/etc/sound_node.toml`):

```toml
[node]
listen = "0.0.0.0:8313"
process_wait_timeout = 10
name = "nodename"

record_max_time = 1800
storage = "/var/recordings"

[arecord]
bin = "/usr/bin/arecord"

[lame]
bin = "/usr/bin/lame"
bitrate = 192

[amixer]
bin = "/usr/bin/amixer"
controls = [
        {
                name = "Line In",
                caps = ["mute", "cap", "volume"]
        },
        {
                name = "Mic1",
                caps = ["mute", "cap", "volume"]
        },
        {
                name = "Mic1 Boost",
                caps = ["volume"]
        }
]

[logging]
verbose = false
default_fmt = true
```

## Audio recording

Install `lame`.

Command to record audio: `arecord -v -f S16 -r 44100 -t raw 2>/dev/null | lame -r -s 44.1 -b 192 -m m - output.mp3 >/dev/null 2>/dev/null`

## Uploading audios to remote server

- Generate ssh keys for root on each sound node:
  ```
  cd /root/.ssh
  ssh-keygen -t ed25519
  ```
- Add public keys on the remote server
- Copy `tools/sync-recordings-to-remote.sh` script to `/usr/local/bin` on all sound nodes, don't forget to `chmod +x` it.
- Add following lines to the root crontab (on all sound nodes):
  ```
  TG_TOKEN="your telegram bot token"
  TG_CHAT_ID="your telegram chat id"
  
  30 * * * *  /usr/local/bin/sync-recordings-to-remote.sh
  ```