Skip to content

Out-of-context audio tools MVP #661

@itsramiel

Description

@itsramiel

General Idea

We want to provide api for for triming, generating static waveform, [insert your ideas here] AudioBuffers as well as longer files (that shouldn't be really loaded into memory), that can be done outside of the AudioContext and realtime aspect of it.

It should be designed while taking the Encoder/Decoder and other out-of-audio-context issues into consideration (as parts of the implementation will be shared or at least similar)

Example TS API

// Example usage 1
const file = await openAudioFile(path: string);
const outputFile1 = await trimAudioFile(file, 0.35, file.duration - 0.35); // durations in seconds
const outputFile2 = await trimAudioFile(file, 128, file.durationSR - 128); // durations in sample rate(?)

// reuses same codec/format as original
await writeAudioFile(outputFile1, `${Directory.Document}/myfiles/output1.mp3`);

// encode with different format
await writeAudioFile(outputFile2, Encoders.M4A.High, `${Directory.Document}/myfiles/output2.m4a`);

// Example usage 2
await openAudioFile(path: string)
  .trim((info) => ({ start: 0.35, end: info.duration - 0.35 }))
  .saveAs(`${Directory.Document}/myfiles/output.mp3`)

Note: this TS examples are not well-thought and might be unrealistic, make sure the api will better align with encoders, decoders and other tooling before starting any implementation!



TheMostImportantNode: This issue is potentially huge it should be split into smaller ones once we decide on the approach

The purpouse of the task is to provide design document that will be used as a base for further development

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions