ClinicianFOCUS / FreeScribe

A medical scribe capable of creating SOAP notes running Whisper and Kobold based on conversation with a patient
GNU General Public License v3.0
0 stars 0 forks source link

Enhance audio processing with popup feedback and UI adjustments #45

Closed ItsSimko closed 1 hour ago

ItsSimko commented 4 hours ago

@sourcery-ai review

sourcery-ai[bot] commented 4 hours ago

Reviewer's Guide by Sourcery

This PR enhances the real-time audio processing functionality by improving the audio chunk handling, adding user feedback during processing, and adjusting UI elements. The main changes focus on ensuring no audio data is lost during recording and providing better visual feedback to users.

Sequence diagram for audio recording and processing

sequenceDiagram
    actor User
    participant Client as FreeScribe Client
    participant Stream as Audio Stream
    participant Queue as Audio Queue
    participant Popup as Processing Popup

    User->>Client: Start Recording
    Client->>Stream: Open Stream
    loop Recording
        Stream->>Client: Audio Data
        Client->>Queue: Add to Queue if not silent
    end
    User->>Client: Stop Recording
    Client->>Queue: Send remaining audio chunks
    Client->>Popup: Show Processing Popup
    loop Processing
        Queue->>Client: Process Audio
    end
    Popup-->>Client: Close Popup
    Client->>Stream: Close Stream
    Client->>User: Recording Complete

File-Level Changes

Change Details Files
Improved real-time audio processing logic
  • Added record duration tracking alongside silent duration
  • Modified chunk processing conditions to use both record duration and silent duration
  • Added handling of remaining audio chunks when recording stops
  • Separated realtime thread creation from recording toggle
src/FreeScribe.client/client.py
Added processing feedback popup
  • Created a new popup window that appears when stopping recording
  • Implemented animated ellipsis to indicate ongoing processing
  • Added wait mechanism to ensure all audio chunks are processed before closing
src/FreeScribe.client/client.py
Adjusted UI layout and settings
  • Modified AudioMeter widget layout and threshold line positioning
  • Updated default silence cut-off threshold value
  • Simplified recording button command binding
src/FreeScribe.client/UI/Widgets/AudioMeter.py
src/FreeScribe.client/UI/SettingsWindow.py
src/FreeScribe.client/client.py

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
sweep-ai[bot] commented 4 hours ago

Hey @ItsSimko, here is an example of how you can ask me to improve this pull request:

@sweep Add unit tests for the `record_audio` function to verify the new audio chunk processing logic, specifically testing:
- Recording duration calculation
- Silent duration tracking
- Proper chunking of audio data when minimum duration and silence thresholds are met
- Handling of remaining audio chunks when recording stops

:book: For more information on how to use Sweep, please read our documentation.

sweep-ai[bot] commented 4 hours ago

Hey @ItsSimko, here is an example of how you can ask me to improve this pull request:

@sweep Add unit tests for the audio chunk processing logic in `record_audio()` to verify that remaining audio chunks are properly sent to the queue when recording stops.

:book: For more information on how to use Sweep, please read our documentation.