V-Sekai / godot-whisper

An GDExtension addon for the Godot Engine that enables realtime audio transcription, supports OpenCL for most platforms, Metal for Apple devices, and runs on a separate thread.
MIT License
48 stars 5 forks source link

Fix resample audio buffer bug #37

Closed aiaimimi0920 closed 5 months ago

aiaimimi0920 commented 5 months ago

hello, @fire @Ughuuu

I have not tested whether this code has issues in the project because I encountered the problem of silent audio when using similar code in another project

The specific reason for the issue is that, according to this documentation

"output_frames" corresponds to the Maximum number of frames pointed to by "data_out."

For example, when resampling from 16000 to 48000, you may encounter long segments of silent audio later on. In such cases, you need to use this code: src_data.output_frames = int(p_src_frame_count * src_data.src_ratio);

Ughuuu commented 5 months ago

Ill test locally if it still works. Thanks for the pr.