I cant use audiowrite function in MATAB R2016a
4 views (last 30 days)
Show older comments
if true
% code
end
clc;
clear all;
close all;
[wavdata,fs] = audioread('roja.wav');
wavbinary = dec2bin( typecast( single(wavdata(:)), 'uint8'), 8 ) - '0';
orig_size = size(wavdata);
data_class_to_use = 'int32'; %or as appropriate
SampleRate = fs; %set as appropriate
wavdata1 = reshape( typecast( uint8(bin2dec( char(wavbinary + '0') )), data_class_to_use ), orig_size );
audiowrite('ABC_REC.wav', wavdata1, SampleRate);
clear wavdata1 fs;
[wavdata1,fs] = audioread('ABC_REC.wav');
sound(wavdata1,fs);
Following error message shows Error using audiowrite>validateFilename (line 323) Cannot create file ABC_REC.wav. Permission Denied.
Error in audiowrite (line 105) [props.filename, fileExisted] = validateFilename( props.filename );
Error in san_lgc (line 10) audiowrite('ABC_REC.wav', wavdata1, SampleRate);
0 Comments
Answers (2)
Stephan
on 12 Oct 2018
Edited: Stephan
on 12 Oct 2018
Hi,
this appears to be not a problem of Matlab. Try:
audiowrite('C:\Path_you_are_allowed_to_write_in\ABC_REC.wav', wavdata1, SampleRate);
A (bad) workaround could be, to run Matlab as administrator.
A further reason for this error could be, the file is already opened in another software.
Best regards
Stephan
0 Comments
Steven Lord
on 12 Oct 2018
Do you have write permissions for your current directory when you try to execute that command?
One way to test this is to try writing the file into your temporary directory, for which you ought to have write permission. [If you don't, I'd expect lots of other functionality to fail.]
filenameInTemp = fullfile(tempdir, 'ABC_REC.wav');
audiowrite(filenameInTemp, ...
0 Comments
See Also
Categories
Find more on Code Execution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!