samedi 20 février 2016

having issues figuring out if statement

i need to figure out how to add an if..elseif..elseif statement to play different sound files based on the user input value

disp('Press A to play automatic speech program')
disp('Press any other key to manually control what to say')
input('Enter your selection:')

disp('1 - Check out whats new    5 - Irritate me         9 - Game show buzzer')
disp('2 - PacMan death           6 - About time         10 - The price is wrong') 
disp('3 - Buy one get one free   7 - Hard drive crash   11 - Final Countdown')
disp('4 - Hasta la vista         8 - Ms Pacman death    12 - Goodbye')


disp('Press 12 to say goodbye or enter the voice number to play a voice:')

if 1
    [y,Fs] = audioread('check_out_whats_new.wav');
    sound(y,Fs)
end

if 2
    [y,Fs] = audioread('pacman_death.wav');
    sound(y,Fs)
end

Aucun commentaire:

Enregistrer un commentaire