comparison util/SMALL_playAudio.m @ 1:7750624e0c73 version0.5

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