Skip to content

Conversation

@josephpark0828
Copy link

No description provided.

import pyaudiowpatch as pyaudio

def translator():
DOCKER_IP = "http://0.0.0.0:8000/"
Copy link
Owner

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

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:
Copy link
Owner

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:
Copy link
Owner

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

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.

@BCaven BCaven added the enhancement New feature or request label May 4, 2024
@BCaven
Copy link
Owner

BCaven commented May 4, 2024

closes #30

@BCaven BCaven changed the title created windows audio client (systems guru point) created windows audio client May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants