Open manuelgitgomes opened 5 months ago
It does seem strange that this is happening for you; I think it'd be better if we addressed the root cause of the fact that the audio is still being appended while saving, since if that's the case there may be other issues that crop up related to the cause
After recording a file, when saving, everything froze, without any output and without giving any hints on what might be.
After some debugging, I found out that the sound_chunks variable (list) kept appending while saving. This hit a point that the sound chunks that were appending were being added faster that the ones being united to make the full audio (or at least very close to it.) This created a seemingly never-ending creation of the full audio that never saved.
To solve this, before saving, a copy of the sound_chunks variable is created. This copy is the one that is saved, so no further data enters that variable. There could be a solution to make pygame stop recording audio, but as I am not familiar with that library, I abstained from changing anything. This solution is a simple fix that might solve it, but you might want to solve everything within pygame.
To aid debugging (and even user experience) I added prints and a progress bar when saving!