Clear Filters
Clear Filters

Why is my program not being coverted into an application properly specifically the sound doesn't start playing in the converted program

1 view (last 30 days)
So I created a program that uses various sound manipulation functions. I want to convert this code into a MATLAB application using the MATLAB compier. The compiler actually converts the code into a program, but the program doesn't actually work because I doesn't play the sound or give the numeric output. I will add the ZIP file with the functions that I am using if that will help solve this problem. Thank you.

Answers (1)

OCDER on 4 Dec 2018
Seems like you are using relative paths. When using deployed application, the paths are different. Use absolute paths.
function haHAA = SongDetails
prompt = {'Enter Name of Song:', 'Enter Volume:', 'Enter Frequency:', 'Enter The Duration of Song:'};
title = 'Sound Information';
dims = [1 35];
definput = {'matlabaudio.flac','25','1','10'};
answer = inputdlg(prompt, title, dims, definput); = answer{1};
haHAA.vol = str2double(answer{2});
haHAA.freq = str2double(answer{3});
haHAA.time = str2double(answer{4});
%Check if your file name exists
if isempty(dir(
[filename, pathname] = uigetfile(, 'Find audio file');
if isnumeric %canceled file search
warning('Could not file the file name "%s". Use absolute path.',;
end = fullfile(pathname, filename); %Use full path.
Do the same for the other function
function [death] = SoundFunct(haHAA)
vol = haHAA.vol;
freq = haHAA.freq;
name =;
time = haHAA.time;
[volFinal, freqFinal] = audioread(name);
filepath = fileparts(name); %get the dir
filename = 'matlabaudio.flac'; %get the name. combine using fullfile
audiowrite(fullfile(filepath, filename),volFinal,freqFinal);
Also, I recommend changing RunFunction.m into a function
function RunFunction
haHAA = SongDetails;
death = SoundFunct(haHAA);
  1 Comment
Vijay Krishnamoorthy
Vijay Krishnamoorthy on 5 Dec 2018
Thank you for the help. I changed my code to fit with what you reccommended. However (even with runtime, matlab, and the compiler) the program still refuses to actually play the sound when compiled. Is there something that I am missing that needs to be downloaded to make the sound play?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!