What FLAC compression level does audiowrite use?

8 Ansichten (letzte 30 Tage)
Selene Fregosi
Selene Fregosi am 18 Apr. 2025
Beantwortet: Anushka am 7 Mai 2025
FLAC audio compression has 9 levels (0-8). Higher levels lead to higher compression levels but take longer to encode. What level does the audiowrite function use? I cannot find this anywhere in the the audiowrite documentation.

Akzeptierte Antwort

Anushka
Anushka am 7 Mai 2025
MATLAB’s ‘audiowrite’ function supports writing FLAC files, but unfortunately, it does not provide any parameter to control the FLAC compression level (which ranges from 0 to 8). Additionally, the documentation does not specify what default level is used internally.
Here is a workaround you can use if you need to control the compression level:
1.Write a WAV file using ‘audiowrite’:
audiowrite(audio.temp_wav,y,Fs);
2. Then, convert it to FLAC using the FLAC command-line tool:
system(flac -f -8 audio_temp.wav);
% You can use -0 to -8 compression level
This approach gives you full control over the compression level. It relies on MATLAB’s system command and the external FLAC encoder, which must be installed separately. Make sure the ‘flac’ command is accessible from your system’s PATH.
Hope this helps!

Weitere Antworten (0)

Kategorien

Mehr zu Measurements and Spatial Audio finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by