-
Notifications
You must be signed in to change notification settings - Fork 6
created windows audio client #38
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
base: develop
Are you sure you want to change the base?
Conversation
| import pyaudiowpatch as pyaudio | ||
|
|
||
| def translator(): | ||
| DOCKER_IP = "http://0.0.0.0:8000/" |
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.
This should be a global or a parameter passed into the translator function because the IP address of the server is not static and may need to be changed by the user.
Consider allowing the user to pass in the addr/port as command line arguments.
|
|
||
| def translator(): | ||
| DOCKER_IP = "http://0.0.0.0:8000/" | ||
| print("TRANSLATOR IS RUNNING") |
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.
Bad practice to use print statements like this. Use the logging module instead
| # open PyAudio manager via context manager | ||
| with pyaudio.PyAudio() as p: | ||
| # open audio stream via context manager | ||
| with p.open(format=pyaudio.paInt32, channels=2, rate=48000, input=True, frames_per_buffer=1024) as stream: |
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.
audio settings change depending on the user's setup, it would be nice to not have these be hard-coded values
Also, the input device is never specified. Look at the examples in the PyAudioWPatch repo for how you are supposed to use this.
| } | ||
|
|
||
| # send audio data to Docker container | ||
| with requests.Session() as session: |
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.
having a session that is immediately closed defeats the purpose of the session. It would be better to either use requests.post or to pass the session into this function so each post request can use the same session.
| "avg": float(avg), | ||
| "peak": float(peak), | ||
| "data": data.tolist(), | ||
| "source": "Windows Device" |
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.
The source tag is supposed to refer to which audio input is being used - saying 'windows device' is fine but it would be more helpful to grab the actual name/id of the input device that is getting recorded.
|
closes #30 |
No description provided.