You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When playing back compressed audio files, reading of the files takes much longer than using the existing memory mapped WAV file method. The juce::BufferingAudioSource method used for compressed files doesn't really form a suitable solution.
This is especially evident when jumping to a new position, dropouts are almost always heard.
Requirements
Real-time safe read operations which don't block at all (this causes dropouts in the main audio graph)
Error reporting for when a read operation fails so audio can be faded in/out accordingly to avoid glitches
Ability to cache the whole decompressed file in memory
Better handling of caching, keeping most recently used blocks. This will much improve the audio thumbnail drawing where views tend to be scrolled backwards and forwards rather than being completely random access
Approach
Replace the fallbackReader (and internals of CacheAudioFormatReader) with a better juce::AudioFormatReader subclass
This should still use a thread to read the audio file and copy it in to memory
Memory should be allocated in blocks covering a portion of the audio file
If the whole file is to be cached, the thread should fill these blocks but this may happen out of order if the read position is changed
Allocated blocks should be contiguous for better cache performance
Blocks should be time-stamped and the oldest ones reused to keep recently used blocks in memory
Some file types (mp3?) may need to read contiguously to avoid sample mismatches?
It might be an idea to use a shared allocator for this so all cache blocks are near each other in memory
There might be a performance boost by memory mapping the original file and letting the OS cache the file reads
This should be developed with benchmarks and tests to ensure performance is as desired
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Motivation
When playing back compressed audio files, reading of the files takes much longer than using the existing memory mapped WAV file method. The juce::BufferingAudioSource method used for compressed files doesn't really form a suitable solution.
This is especially evident when jumping to a new position, dropouts are almost always heard.
Requirements
Approach
fallbackReader
(and internals ofCacheAudioFormatReader
) with a betterjuce::AudioFormatReader
subclassBeta Was this translation helpful? Give feedback.
All reactions