-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio
executable file
·560 lines (473 loc) · 11 KB
/
radio
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#!/usr/bin/env bash
#
# Tim Osburn
# 220825
#
# This requires installation of the octl tool below
# - https://github.com/janten/onkyo-eiscp-remote-mac
# My personal setup: TX-8270 192.168.0.24:60128
#
RADIO=192.168.0.24
RPORT=60128
if [ $# -eq 0 ]
then
echo "Usage: `basename "$0"` command"
fi
# -------------------------------------------------------------
# Turn Radio off
if [ "$1" == "off" ]
then
octl PWR00 ${RADIO} ${RPORT} > /dev/null &
fi
# Turn radio off
if [ "$1" == "on" ]
then
octl PWR01 ${RADIO} ${RPORT} > /dev/null &
fi
# -------------------------------------------------------------
# Toggle on/off A Speaker output
if [ "$1" == "a" ]
then
octl SPAUP ${RADIO} ${RPORT} > /dev/null &
fi
# Toggle on/off B Speaker output
if [ "$1" == "b" ]
then
octl SPBUP ${RADIO} ${RPORT} > /dev/null &
fi
# Switch the radio to PC input mode
# Sets a plethora of items, need to add sleep as sending commands to the radio API too fast it get lost
# Input Selector Command: PC Input (05)
# Tone Front Bass: +10 (A hex)
# Tone Front Treble: +10 (A hex)
# Master Volumn: 60 (78 hex)
# Display Dimmer: Dim (01)
# Listening Mode Command: Stereo (00)
# Sleep: off
# Speaker A: On
# Speaker B: On
# SubVolumn: 0db
if [ "$1" == "pc" ]
then
octl SLI05 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRB+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRT+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl MVL78 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl DIM01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl LMD00 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SLPOFF ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPA01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPB01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SWL+00 ${RADIO} ${RPORT} > /dev/null &
fi
# Switch the radio to PC input mode
# Sets a plethora of items, need to add sleep as sending commands to the radio API too fast it get lost
# Input Selector Command: PC Input (05)
# Tone Front Bass: +10 (A hex)
# Tone Front Treble: +10 (A hex)
# Master Volumn: 32 (40 hex)
# Display Dimmer: Dim (01)
# Listening Mode Command: Stereo (00)
# Sleep: off
# Speaker A: On
# Speaker B: On
# SubVolumn: 0db
if [ "$1" == "pcv" ]
then
octl SLI05 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRB+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRT+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl MVL40 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl DIM01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl LMD00 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SLPOFF ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPA01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPB01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SWL+00 ${RADIO} ${RPORT} > /dev/null &
fi
# Switch the radio to Tuner mode
if [ "$1" == "tuner" ]
then
octl SLI26 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRB+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRT+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl MVL40 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPA01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPB01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SWL+00 ${RADIO} ${RPORT} > /dev/null &
fi
# Switch the radio to network mode
if [ "$1" == "net" ]
then
octl SLI2b ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRB+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl TFRT+A ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl MVL40 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPA01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SPB01 ${RADIO} ${RPORT} > /dev/null &
sleep 0.1
octl SWL+00 ${RADIO} ${RPORT} > /dev/null &
fi
# Turn on Music Optimizer
if [ "$1" == "opton" ]
then
octl MOT01 ${RADIO} ${RPORT} > /dev/null &
fi
# Turn off Music Optimizer
if [ "$1" == "optoff" ]
then
octl MOT00 ${RADIO} ${RPORT} > /dev/null &
fi
# Music Optimizer toggle on/off
if [ "$1" == "opt" ]
then
octl MOTUP ${RADIO} ${RPORT} > /dev/null &
fi
# -------------------------------------------------------------
# Mute audio (toggle) wrap around (if on then off, if off then on)
if [ "$1" == "m" ]
then
octl AMTTG ${RADIO} ${RPORT} > /dev/null &
fi
# Mute Audio
if [ "$1" == "mute" ]
then
octl AMT01 ${RADIO} ${RPORT} > /dev/null &
fi
# Unmute Audio
if [ "$1" == "unmute" ]
then
octl AMT00 ${RADIO} ${RPORT} > /dev/null &
fi
# Sub Volumn level (convert to hex)
# radio sv - 15
# radio sv + 12
if [ "$1" == "sv" ]
then
DEC=$(echo "obase=10; ${3}*2" | bc)
HEX=$(printf '%02x\n' ${DEC})
octl SWL${2}${HEX} ${RADIO} ${RPORT} > /dev/null &
fi
# Speaker Volumn
if [ "$1" == "v" ]
then
DEC=$(echo "obase=10; ${2}*2" | bc)
HEX=$(printf '%02x\n' ${DEC})
octl MVL${HEX} ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 00
if [ "$1" == "v00" ]
then
octl MVL00 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 10
if [ "$1" == "v10" ]
then
octl MVL14 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 20
if [ "$1" == "v20" ]
then
octl MVL28 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 30
if [ "$1" == "v30" ]
then
octl MVL3c ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 40
if [ "$1" == "v40" ]
then
octl MVL50 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 50
if [ "$1" == "v50" ]
then
octl MVL64 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 60
if [ "$1" == "v60" ]
then
octl MVL78 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 70
if [ "$1" == "v70" ]
then
octl MVL8c ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 80
if [ "$1" == "v80" ]
then
octl MVLa0 ${RADIO} ${RPORT} > /dev/null &
fi
# Set Speaker Volumn to 90
if [ "$1" == "max" ]
then
octl MVLb4 ${RADIO} ${RPORT} > /dev/null &
fi
# -------------------------------------------------------------
# Increase volumn by 1
if [ "$1" == "up" ]
then
for ((i=1;i<=${2};i++))
do
octl MVLUP1 ${RADIO} ${RPORT} > /dev/null &
sleep 0.08
done
fi
# Decrease volumn by 1
if [ "$1" == "down" ]
then
for ((i=1;i<=${2};i++))
do
octl MVLDOWN1 ${RADIO} ${RPORT} > /dev/null &
sleep 0.08
done
fi
# -------------------------------------------------------------
# manual tuning
# radio tun 10150 = FM 101.50
# radio tun 01000 = AM 1000
# change to tuner mode
if [ "$1" == "tun" ]
then
octl TUN${2} ${RADIO} ${RPORT} > /dev/null &
fi
# -------------------------------------------------------------
# Some local presets I put into the channel memory slots
if [ "$1" == "list" ]
then
printf '\033[8;42;130t';stty rows 42 cols 130
echo "1 = 89.5 knhc"
echo "2 = 92.5 kqmv"
echo "3 = 93.3 kjr"
echo "4 = 94.1 kswd"
echo "5 = 95.7 kjeb"
echo "6 = 96.1 kxxo"
echo "7 = 96.5 kjaq"
echo "8 = 97.3 kiro"
echo "9 = 98.9 knuc"
echo "10 = 99.9 kisw"
echo "11 = 100.7 kkwf"
echo "12 = 101.5 kplz"
echo "13 = 102.5 kzok"
echo "14 = 103.7 khtp"
echo "15 = 104.5 klsw"
echo "16 = 105.3 kcms"
echo "17 = 106.1 kbks"
echo "18 = 106.9 krwm"
echo "19 = 107.7 kndd"
echo "20 ="
echo "21 ="
echo "22 ="
echo "23 ="
echo "24 ="
echo "25 ="
echo "26 ="
echo "27 ="
echo "28 = 570 kvi"
echo "29 = 710 kiroam"
echo "30 = 770 ktth"
echo "31 = 850 khho"
echo "32 = 1000 knwn"
echo "33 = 1090 kptr"
echo "34 = 1150 kknw"
echo "35 = 1190 1190"
echo "36 = 1210 kmia"
echo "37 = 1300 kkol"
echo "38 = 1330 1330"
echo "39 = 1540 kxpa"
echo "40 = 1590 klfe"
fi
# -------------------------------------------------------------
# Recall preset memory selections
if [ "$1" == "knhc" ]
then
octl PRS01 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kqmv" ]
then
octl PRS02 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kjr" ]
then
octl PRS03 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kswd" ]
then
octl PRS04 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kjeb" ]
then
octl PRS05 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kxxo" ]
then
octl PRS06 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kjaq" ]
then
octl PRS07 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kiro" ]
then
octl PRS08 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "knuc" ]
then
octl PRS09 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kisw" ]
then
octl PRS0A ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kkwf" ]
then
octl PRS0B ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kplz" ]
then
octl PRS0C ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kzok" ]
then
octl PRS0D ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "khtp" ]
then
octl PRS0E ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "klsw" ]
then
octl PRS0F ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kcms" ]
then
octl PRS10 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kbks" ]
then
octl PRS11 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "krwm" ]
then
octl PRS12 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kndd" ]
then
octl PRS13 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS14 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS15 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS16 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS17 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS18 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS19 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS1A ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "XXXX" ]
then
octl PRS1B ${RADIO} ${RPORT} > /dev/null &
fi
# AM 28 570
if [ "$1" == "kvi" ]
then
octl PRS1C ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kiroam" ]
then
octl PRS1D ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "ktth" ]
then
octl PRS1E ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "khho" ]
then
octl PRS1F ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "knwn" ]
then
octl PRS20 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kptr" ]
then
octl PRS21 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kknw" ]
then
octl PRS22 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "1190" ]
then
octl PRS23 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kmia" ]
then
octl PRS24 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kkol" ]
then
octl PRS25 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "1330" ]
then
octl PRS26 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "kxpa" ]
then
octl PRS27 ${RADIO} ${RPORT} > /dev/null &
fi
if [ "$1" == "klfe" ]
then
octl PRS28 ${RADIO} ${RPORT} > /dev/null &
fi