Changing input sizes error when writing data with dsp.AudioFileWriter

15 views (last 30 days)
I am using "dsp.AudioFileWriter" to write audio files. When I divide the file into multiple pieces, the last piece will have a different size compared with the previous ones, therefore MATLAB throws the following error message:
Error using dsp.AudioFileWriter/parenReference
Changing the size on input 1 is not allowed without first calling the release() method.
Is there a workaround for this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 11 Aug 2020
At the current time dsp.AudioFileWriter does not support variable sized inputs and the error is due to the fact that the last frame size is different than the original frame size the object was locked with. Zero-padding is the best way to avoid this error.
You may also consider the following as possible workarounds:
1. Bufffer the audio file data using dsp.AsyncBuffer
2. Write the data to the file in using dsp.AudioFileWriter or audiowrite
An enhancement request has been submitted to the development team to consider supporting this functionality in a future release.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!