audio file add in machine learning activity if occurs

1 view (last 30 days)
above URL;
% I am Trying to play sound *** if activity == 'Walking' ***, but it's not working.
% Also I tried using if strcmp(activity,'Walking'); both result fail
% Please help........below code
*****************************************************************************
%add below function in "Human_Activity_Learning.m"
[y, Fs] = audioread('Walking Playing.wav'); % 1 second audio file
walking_sound = audioplayer(y, Fs); % Global variable: walking_sound
**********************************************
% In "plotActivityResults.m" function, I added play function
try
for ii = 1:height(humanActivityTest)
mycell1 = fieldnames(mdl);
myclassifier1 = strcat('mdl.',mycell1(3));
activity = predict(eval(myclassifier1{:}),humanActivityTest{ii,1:end-1});
if activity == 'Walking'
predclr = [1 0 0];
play(walking_sound);
else
predclr = [0 0.7 0.3];
end

Answers (0)

Categories

Find more on Audio Processing Algorithm Design 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!