% Script to call function sound_magandphase_mush
% This script is turned into a function for the final sound out convolution
% process.

function[sound_effect_out,fs]=sound_magandphase_mush_script

[x1,fs] = audioread('Trombone.wav'); %First sound file
[x2,fs] = audioread('Xylophone.wav'); %Second sound file
[x3,fs] = audioread('Viola1.wav');  %Third sound file

fs = 44100; %Sampling frequency
n1 = 128; %Hop size for analysis in samples
WLen = 1024; %Window length in samples
w1 = hann(WLen); %Window type

%Options can be chosen for different combination of cr (magnitude) and
%ct (phase) of the three input sounds.
%cr=1=mag of sound 1 x mag of sound 2 x mag of sound 3
%cr=2=mag of sound 1 x mag of sound 2
%cr=3=mag of sound 2 x mag of sound 3
%cr=4=mag of sound 1 x mag of sound 3
%cr=5=mag of sound 1
%cr=6=mag of sound 2
%cr=7=mag of sound 3

%ct=1=phase of sound 1 x phase of sound 2 x phase of sound 3
%ct=2=phase of sound 1 x phase of sound 2
%ct=3=phase of sound 2 x phase of sound 3
%ct=4=phase of sound 1 x phase of sound 3
%ct=5=phase of sound 1
%ct=6=phase of sound 2
%ct=7=phase of sound 3

cr=3;
ct=4;

%Call the function for the magnitude and phase hybridization effect
[sound_effect_out]=sound_magandphase_mush(x1,x2,x3,n1,WLen,w1,cr,ct);

