Handy icon indicating copy to clipboard operation
Handy copied to clipboard

[BUG] Version 0.6.3 broken on Linux Mint

Open ChrisB85 opened this issue 1 month ago • 2 comments

Bug Description

Transcription does not work - application freezes immediately after starting recording. The only option is to terminate the Handy process.

Image

handy.log

System Information

App Version:

0.6.3

Operating System:

Linux Mint 22.2 Cinnamon

CPU:

AMD Ryzen 5 3600

GPU:

NVIDIA RTX 2070 SUPER

ChrisB85 avatar Nov 28 '25 07:11 ChrisB85

Same here on Ubuntu 24.04.3 LTS Logs don't show any error message at all.

lstep avatar Nov 28 '25 09:11 lstep

Thanks for the reports. May roll back the version, as I don't have a system to test on.

@lhotari are you able to replicate

@lstep do you get the same issue when building from source?

And to be clear this is a regression from older versions correct??

Can anyone confirm if this happens with the overlay disabled? or only with it enabled?

cjpais avatar Nov 28 '25 23:11 cjpais

I'm able to replicate this. I notice the program freezes when I stop the recording, though it may have froze at the start. Getting this issue on the latest release when overlay is both, enabled and disabled.

I believe this regression is from the old version. Most recently, the application worked from me during development on the #376 branch.

alabhyajindal avatar Nov 29 '25 05:11 alabhyajindal

@alabhyajindal thank you that's helpful, would you mind trying commit 8136e6b?

I am suspecting maybe #224 since it is in the hotpath of the recording start/stop. Otherwise maybe its due to the specta overhaul i made?

cjpais avatar Nov 29 '25 07:11 cjpais

Just tried commit 8136e6b and it's working! Of course, this is with disabling the overlay, since the overlay captures focus, but that's a different issue.

alabhyajindal avatar Nov 29 '25 09:11 alabhyajindal

Thank you @alabhyajindal, can you try #392? I featured flagged off most of the cancel functionality in this PR. Wondering if it will generally fix things up here for the time being.

cjpais avatar Nov 29 '25 09:11 cjpais

Yes - works! Thank you!

alabhyajindal avatar Nov 29 '25 09:11 alabhyajindal

Great pulling it in and cutting the next release, thank you for your quick testing! I really really appreciate it!

cjpais avatar Nov 29 '25 09:11 cjpais

I noticed the audio recorder wasn't always picking the best settings. In fact, without this change, Handy was crashing in a loop on my machine.

I tweaked recorder.rs to check for F32 support and prioritize that over I16 or I32 if available. This fixes the crash and ensures better audio quality for transcription.

Here is the specific change I made:

impl AudioRecorder {
    // ... existing code ...
    fn get_preferred_config(
        device: &cpal::Device,
    ) -> Result<cpal::SupportedStreamConfig, Box<dyn std::error::Error>> {
        let supported_configs = device.supported_input_configs()?;
        let mut best_config: Option<cpal::SupportedStreamConfigRange> = None;

        // Try to find a config that supports 16kHz, prioritizing better formats
        for config_range in supported_configs {
            if config_range.min_sample_rate().0 <= constants::WHISPER_SAMPLE_RATE
                && config_range.max_sample_rate().0 >= constants::WHISPER_SAMPLE_RATE
            {
                match best_config {
                    None => best_config = Some(config_range),
                    Some(ref current) => {
                        // Prioritize F32 > I16 > I32 > others
                        let score = |fmt: cpal::SampleFormat| match fmt {
                            cpal::SampleFormat::F32 => 4,
                            cpal::SampleFormat::I16 => 3,
                            cpal::SampleFormat::I32 => 2,
                            _ => 1,
                        };

                        if score(config_range.sample_format()) > score(current.sample_format()) {
                            best_config = Some(config_range);
                        }
                    }
                }
            }
        }

        if let Some(config) = best_config {
            return Ok(config.with_sample_rate(cpal::SampleRate(constants::WHISPER_SAMPLE_RATE)));
        }

        // If no config supports 16kHz, fall back to default
        Ok(device.default_input_config()?)
    }
}

mg-dev25 avatar Nov 29 '25 09:11 mg-dev25

@mg-dev25 do you want to submit as a PR? im assuming youre also on a linux distro

cjpais avatar Nov 29 '25 09:11 cjpais

Ok, I will do it in few hours.

mg-dev25 avatar Nov 29 '25 09:11 mg-dev25

Okay, 0.6.4 should close this issue, if @ChrisB85 @alabhyajindal @lstep anyone could give a test that would be great to confirm! Thank you for the quick reporting.

And thank you @alabhyajindal for testing! I really appreciate, couldn't do it without you!

cjpais avatar Nov 29 '25 10:11 cjpais

I have tested it and can confirm that it works. Thank you!

ChrisB85 avatar Nov 29 '25 10:11 ChrisB85

Great! Closing this!

cjpais avatar Nov 29 '25 10:11 cjpais