annotate aux/MS2LR.m @ 0:4fd284285159
Adding listening test plus some helpful functions and scripts.
author |
Brecht <b.deman@qmul.ac.uk> |
date |
Thu, 24 Apr 2014 23:53:31 +0100 |
parents |
|
children |
|
rev |
line source |
b@0
|
1 function y = MS2LR(x)
|
b@0
|
2 % LR2MS Converts stereo audio signal to MS (mid side).
|
b@0
|
3 %
|
b@0
|
4 % by Brecht De Man at Centre for Digital Music, 4 June 2013
|
b@0
|
5
|
b@0
|
6 if size(x,2) ~= 2
|
b@0
|
7 error('Function MS2LR needs a stereo audio input file.');
|
b@0
|
8 end
|
b@0
|
9
|
b@0
|
10 y = zeros(size(x));
|
b@0
|
11
|
b@0
|
12 % L = (M + S)/2, R = (M-S)/2
|
b@0
|
13 y(:,1) = (x(:,1)+x(:,2))/2; % left channel
|
b@0
|
14 y(:,2) = (x(:,1)-x(:,2))/2; % right channel
|
b@0
|
15
|
b@0
|
16 end |