MATLAB: How to combine to arrays to play at the same time

combining two arrays

So I have two arrays. One is melody made through MATLAB, the other one is recorded techno music and converted into array.
Now my question is how to combine them to play at the same time, if someone can help ?
Best

Best Answer

If they are the same length and have the same sampling frequency ‘Fs’, you can concatenate them, then play them:
song = [MATLAB_Melody(:) Techo(:)];
slund(song, Fs)
The first vector, that I named ‘MATLAB_Melody’ here, will play out of the left speaker, and ‘Techno’ will play out of the right speaker.