Clear Filters
Clear Filters

Why do wavwrite and audiowrite produce different results?

2 views (last 30 days)
I am transitioning from wavwrite to audiowrite and encountered the problem that wavread and audioread do not always produce identical wav files. For example the code
y = repmat((1:750)', 1, 3);
wavwrite(y, 500, 32, 'test1.wav');
audiowrite('test2.wav', y, 500, 'BitsPerSample', 32);
fid = fopen('test1.wav');
test1 = fread(fid);
fclose(fid);
fid = fopen('test2.wav');
test2 = fread(fid);
fclose(fid);
length(test1)
length(test2)
returns 9044 and 9096. Why is that and how can I reproduce the results from wavwrite in my existing code with audiowrite?
PS: I am aware of audioread, but that is not an option here.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!