annotate util/SMALL_playAudio.m @ 5:f44689e95ea4

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