I cant use audiowrite function in MATAB R2016a
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Stephan
el 12 de Oct. de 2018
Editada: Stephan
el 12 de Oct. de 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 comentarios
Steven Lord
el 12 de Oct. de 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 comentarios
Ver también
Categorías
Más información sobre Code Execution en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!