What FLAC compression level does audiowrite use?

조회 수: 8 (최근 30일)
Selene Fregosi
Selene Fregosi 2025년 4월 18일
답변: Anushka 2025년 5월 7일
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.

채택된 답변

Anushka
Anushka 2025년 5월 7일
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by