diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/aux/MS2LR.m	Thu Apr 24 23:53:31 2014 +0100
@@ -0,0 +1,16 @@
+function y = MS2LR(x)
+% LR2MS Converts stereo audio signal to MS (mid side).
+% 
+% by Brecht De Man at Centre for Digital Music, 4 June 2013
+
+if size(x,2) ~= 2
+    error('Function MS2LR needs a stereo audio input file.');
+end
+
+y = zeros(size(x));
+
+% L = (M + S)/2, R = (M-S)/2
+y(:,1) = (x(:,1)+x(:,2))/2; % left channel
+y(:,2) = (x(:,1)-x(:,2))/2; % right channel
+
+end
\ No newline at end of file