annotate util/SMALL_playAudio.m @ 59:23f9dd7b9d78

(none)
author idamnjanovic
date Mon, 14 Mar 2011 17:25:38 +0000
parents fc395272d53e
children 8e660fd14774
rev   line source
idamnjanovic@1 1 function SMALL_playAudio(SMALL)
idamnjanovic@24 2 %%%
idamnjanovic@24 3 %
idamnjanovic@24 4 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@24 5 % This file copyright 2009 Ivan Damnjanovic.
idamnjanovic@24 6 %
idamnjanovic@24 7 % This program is free software; you can redistribute it and/or
idamnjanovic@24 8 % modify it under the terms of the GNU General Public License as
idamnjanovic@24 9 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@24 10 % License, or (at your option) any later version. See the file
idamnjanovic@24 11 % COPYING included with this distribution for more information.
idamnjanovic@24 12 %
idamnjanovic@24 13 % Function gets as input SMALL structure and play the original and
idamnjanovic@24 14 % the reconstructed signal
idamnjanovic@1 15
idamnjanovic@1 16
idamnjanovic@8 17 SMALL.solver.reconstructed = SMALL.Problem.reconstruct(SMALL.solver.solution);
idamnjanovic@1 18 ch='';
idamnjanovic@1 19 while 1
idamnjanovic@1 20 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 21 request = sscanf(request,'%d');
idamnjanovic@1 22 switch request
idamnjanovic@1 23 case 1
idamnjanovic@1 24 fprintf('Original signal has %d sources.\n Which one do you want to hear?', size(SMALL.Problem.signal,2))
idamnjanovic@1 25 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 26 ch=input('','s');
idamnjanovic@1 27 ch=sscanf(ch,'%d');
idamnjanovic@1 28 if (ch>=1)&&(ch<=size(SMALL.Problem.signal,2))
idamnjanovic@1 29 soundsc(SMALL.Problem.signal(:,ch),8000);
idamnjanovic@1 30 end
idamnjanovic@1 31 case 2
idamnjanovic@1 32 fprintf('Number of channels in mixed signal is %d.\n Which one do you want to hear?', size(SMALL.Problem.b,2))
idamnjanovic@1 33 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 34 ch=input('','s');
idamnjanovic@1 35 ch=sscanf(ch,'%d');
idamnjanovic@1 36 if (ch>=1)&&(ch<=size(SMALL.Problem.b,2))
idamnjanovic@1 37 soundsc(SMALL.Problem.b(:,ch),8000);
idamnjanovic@1 38 end
idamnjanovic@1 39 case 3
idamnjanovic@1 40 fprintf('Reconstructed signal has %d sources.\n Which one do you want to hear?', size(SMALL.solver.reconstructed,2))
idamnjanovic@1 41 fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
idamnjanovic@1 42 ch=input('','s');
idamnjanovic@1 43 ch=sscanf(ch,'%d');
idamnjanovic@1 44 if (ch>=1)&&(ch<=size(SMALL.solver.reconstructed,2))
idamnjanovic@1 45 soundsc(SMALL.solver.reconstructed(:,ch),8000);
idamnjanovic@1 46 end
idamnjanovic@1 47 case 4
idamnjanovic@1 48 return;
idamnjanovic@1 49 end
idamnjanovic@1 50 end
idamnjanovic@1 51 end