-
-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hi
I'm trying to use extractAudioAnalysis on various audio files, on Android. On small files it works but I get memory errors with larger files. Is there a way to use extractAudioAnalysis without getting these errors ? I tried with various segmentDuration and decodingOptions without success. Should I truncate the audio files or is there another way ?
The code is simple :
const analysisConfig: SelectedAnalysisConfig = {
segmentDurationMs: 100,
features: {
energy: false,
rms: false,
zcr: false,
mfcc: false,
spectralCentroid: false,
spectralFlatness: false,
spectralRolloff: false,
spectralBandwidth: false,
chromagram: false,
tempo: false,
hnr: false,
melSpectrogram: false,
spectralContrast: false,
tonnetz: false,
pitch: false
}
};
// Use extractAudioAnalysis directly
const audioAnalysis = await extractAudioAnalysis({
fileUri: normalizedAudioUri,
arrayBuffer: undefined,
logger: loggerExtendAudioAnalysis,
segmentDurationMs: analysisConfig.segmentDurationMs,
features: analysisConfig.features,
decodingOptions: {
targetSampleRate: 16000,
targetChannels: 1,
targetBitDepth: 16,
normalizeAudio: false,
},
})
Example of error :
ERROR Error generating preview: [Error: Call to function 'ExpoAudioStream.extractAudioAnalysis' has been rejected.
→ Caused by: java.lang.OutOfMemoryError: Failed to allocate a 16 byte allocation with 1053312 free bytes and 1028KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.]
Versions used :
[email protected]
@siteed/[email protected]
└─ [email protected]
@siteed/[email protected]