Why does Audacity store audio in small chunks?

Feedback and Reviews for Audacity 2.x
Forum rules
This board is ONLY for general feedback and discussion about Audacity 2.X.

If you require help, or think you have found a "bug", please post on the forum board relevant to your operating system.
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
madis
Posts: 11
Joined: Fri May 15, 2020 10:44 am
Operating System: Linux *buntu

Why does Audacity store audio in small chunks?

Post by madis » Sun Mar 14, 2021 1:27 pm

Hi,

I'm interested to know the reason why Audacity team decided to store audio in small chunks (~1.1MB) - as it's not really necessary for seeking (without loading the whole file into memory), and for working around e.g 4GB limit the chunk could be larger.

I noticed Audacity 3 changes this, but if I have correct information, the new project file is sqlite database and still contains little binary audio chunks inside?

It's not that this is wrong or anything, I'm only interested in *why* was this decision taken in the first place and would it be the same if you would start the project now?

waxcylinder
Forum Staff
Posts: 14515
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Why does Audacity store audio in small chunks?

Post by waxcylinder » Sun Mar 14, 2021 2:26 pm

For processing speed
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

steve
Site Admin
Posts: 80392
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by steve » Sun Mar 14, 2021 2:59 pm

madis wrote:
Sun Mar 14, 2021 1:27 pm
It's not that this is wrong or anything, I'm only interested in *why* was this decision taken in the first place and would it be the same if you would start the project now?
Say you have an 8 hour long track and you need to remove a click from somewhere within that track.
Because Audacity's data is stored in (approx) 1 MB blocks, you only need to write 1 MB of new data, and retain 1 MB of "undo" data.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

madis
Posts: 11
Joined: Fri May 15, 2020 10:44 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by madis » Sun Mar 14, 2021 4:14 pm

Thank you for the quick reply.
steve wrote:
Sun Mar 14, 2021 2:59 pm
madis wrote:
Sun Mar 14, 2021 1:27 pm
It's not that this is wrong or anything, I'm only interested in *why* was this decision taken in the first place and would it be the same if you would start the project now?
Say you have an 8 hour long track and you need to remove a click from somewhere within that track.
Because Audacity's data is stored in (approx) 1 MB blocks, you only need to write 1 MB of new data, and retain 1 MB of "undo" data.
Ah, I really wasn't thinking about this. So, it makes the implementation of writing the data and the undo-redo engine simpler or more effective than it would be to edit and split large files afterwards.

steve
Site Admin
Posts: 80392
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by steve » Sun Mar 14, 2021 4:42 pm

madis wrote:
Sun Mar 14, 2021 4:14 pm
So, it makes the implementation of writing the data and the undo-redo engine simpler or more effective than it would be to edit and split large files afterwards.
There's also an important optimisation for the graphic waveform display. Each block contains peak and RMS "summary data". When zoomed out sufficiently for a block to be around the size of a screen pixel, the waveform can be drawn from the summary data without having to re-analyse the audio data. The summary data also allows effects such as "Amplify" to be able to calculate the peak level of a selection almost instantly. When part of a track is edited, Audacity only has to re-calculate the summary data for those blocks that have been modified.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

madis
Posts: 11
Joined: Fri May 15, 2020 10:44 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by madis » Fri Mar 19, 2021 4:09 pm

Thanks for the insight! Out of interest - is this block summary data also directly inside of the binary file or only in the project xml?

steve
Site Admin
Posts: 80392
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by steve » Fri Mar 19, 2021 4:14 pm

Things have changed somewhat with the release of Audacity 3.0.0. The entire project is now within the "AUP3" project file.
(See: https://www.audacityteam.org/audacity-3-0-0-released/)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

madis
Posts: 11
Joined: Fri May 15, 2020 10:44 am
Operating System: Linux *buntu

Re: Why does Audacity store audio in small chunks?

Post by madis » Fri Mar 19, 2021 4:28 pm

Uuh, I missed the big release! Congratulations shipping it!

Post Reply