web synth docs

sample-manager

The sample manager is an internal interface of the application that manages samples, or audio clips. It handles storing, loading, caching, and saving samples from either the local filesystem or a remote server.

Samples can be accessed using SampleDescriptors, which are handles describing a sample and how to access it. It exposes a method that can be called to retrieve the actual data for that sample. It will check the various cache levels for that sample (in-memory first and then IndexedDB) and retrieve it from there if there is a hit. If not, the sample is retrieved either via the native filesystem API in the case of local samples or via HTTP request in the case of remote samples. Once retrieved, it is automatically inserted into the cache to make future accesses quick and cheap. All of that is done transparently, and modules that make use it don't have to consider these details and can use a simple async API.

The [sample-library] [module] serves as a frontend for the sample manager. It allows users to view all previously added samples, play them back, and load new ones.

The sample manager is used internally by several [module]s such as the [granular-synthesizer], [sample-editor], [sequencer], and others.

Referred in

sample-manager