annotate util/SMALL_playAudio.m @ 8:33850553b702

(none)
author idamnjanovic
date Mon, 22 Mar 2010 10:56:54 +0000
parents 7750624e0c73
children fc395272d53e
rev   line source
idamnjanovic@1 1 function SMALL_playAudio(SMALL)
idamnjanovic@1 2 % Ivan Damnjanovic 2009
idamnjanovic@1 3 % Function gets as input SMALL structure and play the original and
idamnjanovic@1 4 % the reconstructed signal
idamnjanovic@1 5
idamnjanovic@1 6
idamnjanovic@8 7 SMALL.solver.reconstructed = SMALL.Problem.reconstruct(SMALL.solver.solution);
idamnjanovic@1 8 ch='';
idamnjanovic@1 9 while 1
idamnjanovic@1 10 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');
idamnjanovic@1 11 request = sscanf(request,'%d');
idamnjanovic@1 12 switch request
idamnjanovic@1 13 case 1
idamnjanovic@1 14 fprintf('Original signal has %d sources.\n Which one do you want to hear?', size(SMALL.Problem.signal,2))
idamnjanovic@1 15 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 16 ch=input('','s');
idamnjanovic@1 17 ch=sscanf(ch,'%d');
idamnjanovic@1 18 if (ch>=1)&&(ch<=size(SMALL.Problem.signal,2))
idamnjanovic@1 19 soundsc(SMALL.Problem.signal(:,ch),8000);
idamnjanovic@1 20 end
idamnjanovic@1 21 case 2
idamnjanovic@1 22 fprintf('Number of channels in mixed signal is %d.\n Which one do you want to hear?', size(SMALL.Problem.b,2))
idamnjanovic@1 23 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 24 ch=input('','s');
idamnjanovic@1 25 ch=sscanf(ch,'%d');
idamnjanovic@1 26 if (ch>=1)&&(ch<=size(SMALL.Problem.b,2))
idamnjanovic@1 27 soundsc(SMALL.Problem.b(:,ch),8000);
idamnjanovic@1 28 end
idamnjanovic@1 29 case 3
idamnjanovic@1 30 fprintf('Reconstructed signal has %d sources.\n Which one do you want to hear?', size(SMALL.solver.reconstructed,2))
idamnjanovic@1 31 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 32 ch=input('','s');
idamnjanovic@1 33 ch=sscanf(ch,'%d');
idamnjanovic@1 34 if (ch>=1)&&(ch<=size(SMALL.solver.reconstructed,2))
idamnjanovic@1 35 soundsc(SMALL.solver.reconstructed(:,ch),8000);
idamnjanovic@1 36 end
idamnjanovic@1 37 case 4
idamnjanovic@1 38 return;
idamnjanovic@1 39 end
idamnjanovic@1 40 end
idamnjanovic@1 41 end