Skip to content

Commit 9eb2d1d

Browse files
exzosexzos
authored andcommitted
chore: update App.tsx to dynamically load and process audio file via new load helper
1 parent 02ef4cf commit 9eb2d1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

example/src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { useCallback, useEffect, useState } from 'react';
22

33
import { ScrollView, StyleSheet, Text, View } from 'react-native';
4-
import { computeAmplitude } from 'react-native-audio-analyzer';
4+
import { load, computeAmplitude } from '../../src';
55
import { robustScale, sample, scale, trimmedScale } from '../../src/helpers';
66

77
export default function App() {
88
const [data, setData] = useState<number[]>([]);
99

1010
const run = useCallback(async () => {
1111
try {
12-
const result = computeAmplitude(
13-
'/data/data/audioanalyzer.example/files/sample.mp3',
14-
100
12+
const path = await load(
13+
'https://file-examples.com/storage/fe180a8b03688f5559b9baf/2017/11/file_example_MP3_1MG.mp3'
1514
);
15+
const result = computeAmplitude(path, 100);
1616
setData(result);
1717
} catch (raw) {
1818
console.log(raw);

0 commit comments

Comments
 (0)