Home > SUpDEq-v5.0.0 > evaluation > supdeq_listen.m

supdeq_listen

PURPOSE ^

% SUpDEq - Spatial Upsampling by Directional Equalization

SYNOPSIS ^

function output = supdeq_listen(HRIRs_sfd,testSignal,AzEl,playback)

DESCRIPTION ^

% SUpDEq - Spatial Upsampling by Directional Equalization

 function output = supdeq_listen(HRIRs_sfd,testSignal,AzEl,playback)

 This function convolves any arbitrary test signal with an HRIR for the 
 given azimuth (az) and elevation (el). The output will be played back
 automatically by default.

 Output:
 output        - Convolution result of test signal and HRIR in time domain 

 Input:        
 HRIRs_sfd     - Struct with Spherical Harmonic coefficients 
                 (SH-Coefficients) for the left (Hl_nm) and right (Hr_nm) 
                 channel/ear, absolute frequency scale f, 
                 transform order N, and FFToversize
 testSignal    - Mono test signal
 AzEl          - Spatial sampling point (Q x 2 matrix), where the value 
                 is the azimuth and the second the
                 elevation (both in degree).
 playback      - Play the result with soundsc - true/false
                 Default: true
 fs            - Sampling rate
                 Default: 48000

 Dependencies: -

 (C) 2018 by JMA, Johannes M. Arend
             TH Köln - University of Applied Sciences
             Institute of Communications Engineering
             Department of Acoustics and Audio Signal Processing

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% SUpDEq - Spatial Upsampling by Directional Equalization
0002 %
0003 % function output = supdeq_listen(HRIRs_sfd,testSignal,AzEl,playback)
0004 %
0005 % This function convolves any arbitrary test signal with an HRIR for the
0006 % given azimuth (az) and elevation (el). The output will be played back
0007 % automatically by default.
0008 %
0009 % Output:
0010 % output        - Convolution result of test signal and HRIR in time domain
0011 %
0012 % Input:
0013 % HRIRs_sfd     - Struct with Spherical Harmonic coefficients
0014 %                 (SH-Coefficients) for the left (Hl_nm) and right (Hr_nm)
0015 %                 channel/ear, absolute frequency scale f,
0016 %                 transform order N, and FFToversize
0017 % testSignal    - Mono test signal
0018 % AzEl          - Spatial sampling point (Q x 2 matrix), where the value
0019 %                 is the azimuth and the second the
0020 %                 elevation (both in degree).
0021 % playback      - Play the result with soundsc - true/false
0022 %                 Default: true
0023 % fs            - Sampling rate
0024 %                 Default: 48000
0025 %
0026 % Dependencies: -
0027 %
0028 % (C) 2018 by JMA, Johannes M. Arend
0029 %             TH Köln - University of Applied Sciences
0030 %             Institute of Communications Engineering
0031 %             Department of Acoustics and Audio Signal Processing
0032 
0033 %%
0034 function output = supdeq_listen(HRIRs_sfd,testSignal,AzEl,playback)
0035 
0036 if nargin < 4 || isempty(playback)
0037     playback = true;
0038 end
0039 
0040 if nargin < 5
0041     fs = 48000;
0042 end
0043 
0044 %Get HRIR according to AzEl
0045 [hrir(:,1),hrir(:,2)] = supdeq_getArbHRIR(HRIRs_sfd,AzEl,'DEG');
0046 
0047 %Convolve HRIR with test signal (FFT convolution)
0048 NFFT = length(hrir) + length(testSignal) - 1;
0049 testSignal = [testSignal,testSignal];
0050 output = ifft(fft(hrir,NFFT) .* fft(testSignal,NFFT));
0051 
0052 %Play back if intended...
0053 if playback
0054     soundsc(output,fs);
0055 end

Generated on Wed 30-Nov-2022 14:15:00 by m2html © 2005