-
Notifications
You must be signed in to change notification settings - Fork 757
wave is a Python Standard Library module
#1588
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
wave is a Python Standard Library module
#1588
Conversation
wave is a Python Standard Library module
Installing the third-party ___Whole Architecture Verification___ module https://pypi.org/project/Wave is [breaking our builds](https://github.com/ArduPilot/MAVProxy/actions/workflows/windows_build.yml). The Python Standard Library module [`wave`](https://docs.python.org/3/library/wave.html) has an API that corresponds to: https://github.com/ArduPilot/MAVProxy/blob/a45549f9bcb09603be1507c260de2bafe516212a/MAVProxy/modules/mavproxy_chat/chat_voice_to_text.py#L72-L78 Therefore, we should stop doing `pip install wave` and instead use the Standard Library. The docs at https://ardupilot.org/mavproxy/docs/modules/chat.html#prerequisites must also be modified. % `git grep wave`
ba3b320 to
6cf5b33
Compare
These changes should be made together with: * ArduPilot/MAVProxy#1588
|
This looks good to me - was it tested as working with the standard module? |
Yes, I ran the full test suite that was included in: (Sorry, only joking...) This is a Windows app, and I have no access to Windows, but I did... % On macOS, I created a new #!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "openai",
# "pyaudio",
# ]
# ///Paste if __name__ == "__main__":
from pathlib import Path
filename = chat_voice_to_text().record_audio()
assert filename == "recording.wav"
filepath = Path(__file__).parent / filename
assert filepath.exists()
assert filepath.is_file()
print(f"{filepath.stat() = }")
print(f"Size of {filepath} is {filepath.stat().st_size:,} bytes.")Make a change to the code: - while not stop_recording[0]:
+ # while not stop_recording[0]:
+ print("chat: recording audio for 5 seconds...")
+ for _ in range(0, int(44100 / 1024 * 5)): # record for 5 seconds%
% This runs all wave-related lines of code and produces audible proof that it works. |
|
The author ping'd me about this so I've added it to the EUDevCall. I'm not really qualified to review the PR |
|
@peterbarker Time ran out on today's EUDevCall which only focused on the main repo. Are you satisfied with the testing above? What are the todos here? This does fix broken builds. |
|
I've had a look at this PR. To clarify any confusion: The pypi Reading .wav files is handled by the built-in It is an annoying name-collision between the pypi package and built-in libraries. I've tested the PR and it works fine. |
Ah, sorry. We usually only do focus on the main repo, it's actually very rare that we remember to go and check other repos for DevCallEU!
Our Windows maintainer tested it as good - so I've merged it, thanks! |
These changes should be made together with: * ArduPilot/MAVProxy#1588
These changes should be made together with: * ArduPilot/MAVProxy#1588
Installing the third-party Whole Architecture Verification module https://pypi.org/project/Wave is breaking our builds.
The Python Standard Library module
wavehas an API that corresponds to:MAVProxy/MAVProxy/modules/mavproxy_chat/chat_voice_to_text.py
Lines 72 to 78 in a45549f
Therefore, we should stop doing
pip install waveand instead use the Standard Library.The docs at https://ardupilot.org/mavproxy/docs/modules/chat.html#prerequisites must also be modified.
waveis a Python Standard Library module ardupilot_wiki#6947@rmackay9 Your review, please.