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

feat: add audio narration (updated) #346

Closed
wants to merge 33 commits into from

Conversation

angelala3252
Copy link
Collaborator

@angelala3252 angelala3252 commented Jul 3, 2023

Summary

Updated version of PR #195 due to deleting previous fork. This feature is blocked until MacOS accessibility issues are fixed.

(Addresses #164)

Checklist

  • My code follows the style guidelines of OpenAdapt
  • I have performed a self-review of my code
  • If applicable, I have added tests to prove my fix is functional/effective
  • I have linted my code locally prior to submission
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. README.md, requirements.txt)
  • New and existing unit tests pass locally with my changes

@angelala3252 angelala3252 mentioned this pull request Jul 3, 2023
openadapt/record.py Outdated Show resolved Hide resolved
@abrichr
Copy link
Member

abrichr commented Aug 24, 2023

@0dm can you please comment about what would be required to get an analogous implementation of this for Mac? 🙏

audio_frames.append(indata.copy())

# open InputStream and start recording while ActionEvents are recorded
audio_stream = sounddevice.InputStream(
Copy link
Member

Choose a reason for hiding this comment

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

@angelala3252 @0dm what is the easiest way to implement a MacOS-compatible analog of this? Can we re-use existing code in other PRs?

Copy link
Collaborator

Choose a reason for hiding this comment

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

#362 has a good method of getting audio devices via Apple AVFoundation, I'm sure it can be used here with minimal issue. I'm not sure if it'll be plug & play with my PR though, would need some changes depending on the implementation.

@0dm
Copy link
Collaborator

0dm commented Aug 24, 2023

@0dm can you please comment about what would be required to get an analogous implementation of this for Mac? 🙏

The issue with not being able to capture audio with openadapt.record running should be fixed after the changes in _macos a while ago.

@@ -24,6 +24,11 @@

Copy link
Member

Choose a reason for hiding this comment

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

Please update module documentation with optional flag example

@abrichr
Copy link
Member

abrichr commented Aug 30, 2023

@angelala3252 can you please fix merge commits? I believe you will need to re-generate the alembic scripts as well.

Please also confirm this works with poetry. After checking out your branch and running poetry install followed by python -m openadapt.record foo --enable_audio, I get:


Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/abrichr/oa/src/OpenAdapt/openadapt/record.py", line 27, in <module>
    import sounddevice
ModuleNotFoundError: No module named 'sounddevice'

requirements.txt Outdated
git+https://github.com/openai/whisper.git
Copy link
Member

Choose a reason for hiding this comment

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

Is this still the recommended way to install whisper?

I also found https://pypi.org/project/openai-whisper/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

poetry add openai-whisper isn't working for me as I get issues building wheel for llvmlite and numba, and also Unable to find installation candidates for triton (2.0.0). The fixes online all suggest that this is because pip is older than version 19.0, but our pip is version 23.1.2. poetry add git+https://github.com/openai/whisper.git works so for now I'm just going with that.

@angelala3252
Copy link
Collaborator Author

After pulling from main, for some reason importing sounddevice breaks recordings. I can record audio just fine, but nothing else can be recorded and no window events can be registered and the recording hangs indefinitely after Ctrl+C. This even happens when I'm not recording audio and I can't figure out why. I'm using the same version (0.4.6) I was when everything still worked.

@abrichr
Copy link
Member

abrichr commented Mar 2, 2024

@angelala3252 this may be due to openadapt.capture

@0dm any ideas? 🙏

@KIRA009 KIRA009 mentioned this pull request May 15, 2024
7 tasks
@abrichr
Copy link
Member

abrichr commented Jun 18, 2024

Implemented in #673

@angelala3252 thank you for blazing the trail here!! 🙏

@abrichr abrichr closed this Jun 18, 2024
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.

4 participants