comparison service/audioInputLevels/audioInputLevelsPulse.py @ 1282:61ce2830dea7

set source volume at start Ignore-this: 7bb0fe3c3df3a9172490227c1b3e6aaa darcs-hash:9973562f7b7d404f7b571ea1af8cacc258212af4
author drewp <drewp@bigasterisk.com>
date Sat, 20 Apr 2019 23:57:47 -0700
parents 52960ea4dfa6
children 4fa5c6a61282
comparison
equal deleted inserted replaced
1281:80397afd5b52 1282:61ce2830dea7
1 # based on http://freshfoo.com/blog/pulseaudio_monitoring 1 # based on http://freshfoo.com/blog/pulseaudio_monitoring
2 # 2 #
3 # https://github.com/swharden/Python-GUI-examples/blob/master/2016-07-37_qt_audio_monitor/SWHear.py is similar 3 # https://github.com/swharden/Python-GUI-examples/blob/master/2016-07-37_qt_audio_monitor/SWHear.py is similar
4 from __future__ import division 4 from __future__ import division
5 import socket, time, logging, os 5 import socket, time, logging, os, subprocess
6 from Queue import Queue 6 from Queue import Queue
7 from ctypes import c_void_p, c_ulong, string_at 7 from ctypes import c_void_p, c_ulong, string_at
8 from docopt import docopt 8 from docopt import docopt
9 from influxdb import InfluxDBClient 9 from influxdb import InfluxDBClient
10 import numpy 10 import numpy
173 -v Verbose 173 -v Verbose
174 """) 174 """)
175 175
176 log.setLevel(logging.DEBUG if arg['-v'] else logging.INFO) 176 log.setLevel(logging.DEBUG if arg['-v'] else logging.INFO)
177 177
178 influx = InfluxDBClient('bang6', 9060, 'root', 'root', 'main') 178 # todo move this into the PeakMonitor part
179 subprocess.check_output(['pactl',
180 'set-source-volume', arg['--source'], '94900'])
181
182 influx = InfluxDBClient('bang.vpn-home.bigasterisk.com', 9060, 'root', 'root', 'main')
179 183
180 hostname = socket.gethostname() 184 hostname = socket.gethostname()
181 METER_RATE = 8192 185 METER_RATE = 8192
182 monitor = PeakMonitor(arg['--source'], METER_RATE) 186 monitor = PeakMonitor(arg['--source'], METER_RATE)
183 for sample in monitor: 187 for sample in monitor: