Skip to content

Commit 68a6625

Browse files
exzosexzos
authored andcommitted
docs: add load function documentation to API Reference section in README.md
1 parent 9eb2d1d commit 68a6625

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,27 @@ const createWaveform = (data: number[], style: 'bars' | 'line' | 'area') => {
139139

140140
## API Reference 📚
141141

142+
### `load(url: string): Promise<string>`
143+
144+
Load and cache audio file.
145+
146+
#### Parameters
147+
148+
- `url` (string): Url to the audio file to be cached
149+
150+
#### Returns
151+
152+
- `Promise<string>`: Promise with absolute file system path to cached file.
153+
154+
#### Example
155+
156+
```typescript
157+
const path = load('https://file-examples.com/storage/fe180a8b03688f5559b9baf/2017/11/file_example_MP3_1MG.mp3', 500);
158+
// Returns: /data/user/0/audioanalyzer.example/cache/9349e0a758090499d982e320a10273ab.audio
159+
```
160+
161+
---
162+
142163
### `computeAmplitude(filePath: string, outputSampleCount: number): number[]`
143164
144165
Analyzes an audio file and returns an array of amplitude values.
@@ -155,7 +176,7 @@ Analyzes an audio file and returns an array of amplitude values.
155176
#### Example
156177
157178
```typescript
158-
const amplitudes = computeAmplitude('/path/to/song.mp3', 500);
179+
const amplitudes = computeAmplitude(path, 500);
159180
// Returns: [0.1, 0.3, 0.5, 0.2, ...] (500 values)
160181
```
161182

0 commit comments

Comments
 (0)