Skip to content
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

Merged
merged 3 commits into from
Nov 1, 2018

Conversation

matdurand
Copy link

I needed to be able to specify the device index, and the frame buffer size for PyAudio.

@@ -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")
Copy link
Owner

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@@ -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")
Copy link
Owner

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@amsehili amsehili merged commit 0187eec into amsehili:master Nov 1, 2018
@amsehili
Copy link
Owner

amsehili commented Nov 1, 2018

Great, thanks for your contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants