-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional cmdline argument for pyaudio #17
Conversation
auditok/cmdline.py
Outdated
@@ -576,6 +576,8 @@ def main(argv=None): | |||
group.add_option("-r", "--rate", dest="sampling_rate", help="Sampling rate of audio data [default: %default]", type=int, default=16000, metavar="INT") | |||
group.add_option("-c", "--channels", dest="channels", help="Number of channels of audio data [default: %default]", type=int, default=1, metavar="INT") | |||
group.add_option("-w", "--width", dest="sample_width", help="Number of bytes per audio sample [default: %default]", type=int, default=2, metavar="INT") | |||
group.add_option("-A", "--audio-device", dest="input_device_index", help="Audio device index", type=int, default=0, metavar="INT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this!
I would use -I
, --input-device-index
for this option.
Also, following the behavior of pyaudio, the default value for this argument should be None
. This will ensure backward compatibility of auditok
for users who don't specify this argument (just figured out that the default device is not always 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
auditok/cmdline.py
Outdated
@@ -576,6 +576,8 @@ def main(argv=None): | |||
group.add_option("-r", "--rate", dest="sampling_rate", help="Sampling rate of audio data [default: %default]", type=int, default=16000, metavar="INT") | |||
group.add_option("-c", "--channels", dest="channels", help="Number of channels of audio data [default: %default]", type=int, default=1, metavar="INT") | |||
group.add_option("-w", "--width", dest="sample_width", help="Number of bytes per audio sample [default: %default]", type=int, default=2, metavar="INT") | |||
group.add_option("-A", "--audio-device", dest="input_device_index", help="Audio device index", type=int, default=0, metavar="INT") | |||
group.add_option("-F", "--audio-frame-per-buffer", dest="frame_per_buffer", help="Audio frame per buffer", type=int, default=1024, metavar="INT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should specify the default value for the new arguments in the help. Also, it'd be helpful to mention that this argument is used for pyaudio
(not sure if we need this for other audio libraries)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Great, thanks for your contribution :) |
I needed to be able to specify the device index, and the frame buffer size for PyAudio.