annotate util/SMALL_playAudio.m @ 239:71128ec3e532 ver_2.0_beta

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