view util/SMALL_playAudio.m @ 2:257c289bf11d

(none)
author idamnjanovic
date Fri, 05 Mar 2010 12:23:57 +0000
parents 7750624e0c73
children 33850553b702
line wrap: on
line source
function SMALL_playAudio(SMALL)
  % Ivan Damnjanovic 2009
  % Function gets as input SMALL structure and play  the original and
  % the reconstructed signal


ch='';
while 1
    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');
    request = sscanf(request,'%d');
    switch request
        case 1
            fprintf('Original signal has %d sources.\n Which one do you want to hear?', size(SMALL.Problem.signal,2))
            fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
            ch=input('','s');
            ch=sscanf(ch,'%d');
            if (ch>=1)&&(ch<=size(SMALL.Problem.signal,2))
                soundsc(SMALL.Problem.signal(:,ch),8000);
            end
        case 2
            fprintf('Number of channels in mixed signal is %d.\n Which one do you want to hear?', size(SMALL.Problem.b,2))
            fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
            ch=input('','s');
            ch=sscanf(ch,'%d');
            if (ch>=1)&&(ch<=size(SMALL.Problem.b,2))
                soundsc(SMALL.Problem.b(:,ch),8000);
            end
        case 3
            fprintf('Reconstructed signal has %d sources.\n Which one do you want to hear?', size(SMALL.solver.reconstructed,2))
            fprintf('Enter a number between 1 and %d', size(SMALL.Problem.signal,2))
            ch=input('','s');
            ch=sscanf(ch,'%d');
            if (ch>=1)&&(ch<=size(SMALL.solver.reconstructed,2))
                soundsc(SMALL.solver.reconstructed(:,ch),8000);
            end
        case 4
            return;
    end
end
end