Audiowrite Too Many Input Arguments..

4 views (last 30 days)
Edmund Paul Malinowski
Edmund Paul Malinowski on 21 Nov 2015
Answered: Jan on 21 Nov 2015
Hey all,
I'm having a bit of an issue with audiowrite. It's saying there are too many output arguments and i'm guessing its something to do with the MyOPfiltCREATE part of my audiowrite code.
Basically the first part of the code is a section out of a push button function that creates a sine wave melody from user input (textbox) notes. MyOPfiltCREATE is the final output data from these sine waves with a lp filter. This all works perfectly.
The second part of the code is my push button save code where my audiowrite resides. I could have left out some of the code i copied here but thought it all might be relevant..
% FOR: LOOP THROUGH THE 7 USER CHOSEN NOTES..
for i = 1:7;
tX = 0:1/Fs:1; % TIME..
f = out(i); % FREQUENCY..
SineZ{i} = sin(2*pi*f*tX); % CREATE SINE WAVE..
end
% END FOR..
% CONCATENATE SINEZ ARRAY INTO ONE VARIABLE..
Wave = cell2mat(SineZ); % CONCATENATE VECTORS..
t_p = linspace(0, length(Wave), length(Wave)); % CREATE MATCHING TIME VECTOR..
% FILTER THE MELODY WITH THE LP FILTER..
MyOPfiltCREATE=filter(LPfiltX,Wave);
% PLAY MELODY IN FULL..
soundsc(MyOPfiltCREATE,Fs);
% **********************************************
% SAVE MELODY TO WAV..
% **********************************************
% --- Executes on button press in btSAVEWAV.
function btSAVEWAV_Callback(hObject, eventdata, handles)
% DECLARE GLOBAL VARIABLES IN FUNCTION..
global isMELODY; % DEFINE isMELODY AS CATCH FOR IF MELODY IS CREATED OR LOADED..
global Wave; % DECLARE VARIABLE FOR CONCATENATED MELODY OUTPUT SAMPLES..
global Fs; % DECLARE VARIABLE FOR SAMPLE RATE..
global answer; % DECLARE VARIABLE FOR TEXTBOX INPUTS..
global Folder_Path; % DECLARE VARIABLE SELECTED PATH / FOLDER FOR WAV FILES..
global MyOPfiltCREATE; % DECLARE VARIABLE FOR MELODY CREATION OUTPUT..
% GET USER VALUES FROM THE CREATE MELODY TEXT BOXES..
answer{1} = get(handles.edit1note,'String');
answer{2} = get(handles.edit2note,'String');
answer{3} = get(handles.edit3note,'String');
answer{4} = get(handles.edit4note,'String');
answer{5} = get(handles.edit5note,'String');
answer{6} = get(handles.edit6note,'String');
answer{7} = get(handles.edit7note,'String');
Answer_List = answer{1}; % SET NOE ORDER TO 1st TEXT BOX..
% FOR: LOOP THROUGH EACH TEXTBOX STRING..
for i = 2:7
Answer_List = strcat(Answer_List, answer{i});
end
% END FOR..
% SET FILENAME WITH NOTE ORDER LIST..
Answer_List = strcat('DASP_TestTones_', Answer_List);
% SET FILE FULL PATH..
SaveWav_Fullname = strcat(Folder_Path,Answer_List);
% SAVE MELODY AS WAV FILE..
% IF: IF NO AUDIO DATA INFORMATION..
if isempty(MyOPfiltCREATE)
msgbox('No Audio Data..');
return;
else
MySaveMelody = audiowrite(SaveWav_Fullname,MyOPfiltCREATE,Fs);
end
% END IF..
% **********************************************
Is not MyOPfilterCREATE the right type of data for this? Or is the Wave variable what I need to output in audiowrite? Or is it something completely different?
Thanks,
Paul..

Answers (1)

Jan
Jan on 21 Nov 2015
In the title you mention "input arguments", in the tags you write "output arguments". It would be important to post the complete error message. I guess, you mean the "outputs".
As you can read in the documentation of doc: audiowrite, this command does not reply any output. The error message tells this unequivocally also.
What do you expect as output?

Categories

Find more on Introduction to Installation and Licensing 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!