Mercurial > hg > smallbox
view util/SMALL_playAudio.m @ 9:28f2b5fe3483
(none)
author | idamnjanovic |
---|---|
date | Mon, 22 Mar 2010 15:04:14 +0000 |
parents | 33850553b702 |
children | fc395272d53e |
line wrap: on
line source
function SMALL_playAudio(SMALL) % Ivan Damnjanovic 2009 % Function gets as input SMALL structure and play the original and % the reconstructed signal SMALL.solver.reconstructed = SMALL.Problem.reconstruct(SMALL.solver.solution); ch=''; while 1 request = input('\nWhat do you want to hear? \n 1. Original signal \n 2. Mixed \n 3. Reconstructed signal \n 4. Quit player\n','s'); request = sscanf(request,'%d'); switch request case 1 fprintf('Original signal has %d sources.\n Which one do you want to hear?', size(SMALL.Problem.signal,2)) fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2)) ch=input('','s'); ch=sscanf(ch,'%d'); if (ch>=1)&&(ch<=size(SMALL.Problem.signal,2)) soundsc(SMALL.Problem.signal(:,ch),8000); end case 2 fprintf('Number of channels in mixed signal is %d.\n Which one do you want to hear?', size(SMALL.Problem.b,2)) fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2)) ch=input('','s'); ch=sscanf(ch,'%d'); if (ch>=1)&&(ch<=size(SMALL.Problem.b,2)) soundsc(SMALL.Problem.b(:,ch),8000); end case 3 fprintf('Reconstructed signal has %d sources.\n Which one do you want to hear?', size(SMALL.solver.reconstructed,2)) fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2)) ch=input('','s'); ch=sscanf(ch,'%d'); if (ch>=1)&&(ch<=size(SMALL.solver.reconstructed,2)) soundsc(SMALL.solver.reconstructed(:,ch),8000); end case 4 return; end end end