Open ghost opened 7 years ago
Hi @marstial,
You can create a Python script, say run_meter.py
, with something like the following:
from soundmeter.meter import Meter
from soundmeter.cli import get_meter_kwargs, setup_user_dir
import pyaudio
def main():
pyaudio.paJACK = 12
setup_user_dir()
kwargs = get_meter_kwargs()
meter = Meter(**kwargs)
meter.start()
if __name__ == '__main__':
main()
You can set pyaudio.paJACK
to some other value as you like, and run the script as if you execute the soundmeter
directly:
$ python run_meter.py --trigger +211 3 --action stop
413 Stop Action triggered
Thanks a lot, I'll look into it and keep you in touch ! Regards
@shichao-an would you accept a PR with a command line option to set another input device (input_device_index)?
@pheanex It's already supported being set in config. Why do you need the command-line option?
I think having this option (also) as command-line option has the following advantages:
Why would you not want this to be added as a command-line option?
@pheanex I think it makes sense to add it in config rather than command-line because these configs are used to initialize the audio stream. If you want to make input_device_index also a command-line option, you would also want to make other config parameters (format, channels, rate, etc.) as command-line options for feature parity.
However, I feel these parameters rarely change so there were made as configs in the first place. If you need to frequently switch config parameters, I think we can make profile-based settings, so that you can have multiple sections in ~/.soundmeter/config and specify the profile name from command-line to refer to the corresponding section in the config file.
I added support for multiple config profiles in the latest release 0.1.5.
Having profiles is nice, but does not solve the issue I am trying to describe. I think for most people the first contact with soundmeter is to run "soundmeter --help" if they are on the commandline, or to just run it and see what it does in default. This will probably not give them what they want as it will not work out of the box, as you have to specify a recording-device. "--help" does not show any information on how to pick a different device though. So either some people give up already, or have to go to read up on documentation and will propably end up with the Readme file here in this repository, where "input_device_index" is only mentioned in one sentence at the bottom. So giving the users an option on the commandline would in my mind be very obvious and convenient to them. I'd even vote for a possibility to add another option "list-available-devices" :-)
OK. I will look into it when I have some free cycles. As I said, for feature parity, I should add command-line options for all config parameters.
Thank you @shichao-an. It would be very much appreciated. I personally would not mind having more options to configure ;-)
Hi, Sorry this is more a question than an issue really, I can't seem to find how you specify which input the program is listening to ? I wanted to specify an entrance like "pyaudio.paJACK = 12" but I couldn't even find where you call pyaudio from... Best regards