%% archivo de audio estereo clearvars; clear all; close all; clc; %% lectura del archivo de audiodevinfo [x,fs] = audioread('MetalFatigue.wav'); Nt = length(x); %longitud archivo t = (0:Nt-1)/fs; %tiempo sound(x,fs); %sonido %x al ser un sonido estereo se comporta como matriz %que tiene Nt filas y 2 columnas (Nt X 2) %grafico figure(1) plot(t,x); title('metal fatigue'); xlabel('tiempo t(s)'); ylabel('presion sonora p(t) (Pa)'); legend('p(t)'); axis([ min(t), max(t), -1, 1 ]); grid on; box on; %separamos canales for n = 1:Nt xizq(n) = x(n,1); %primera columna xder(n) = x(n,2); %segunda columna end; figure(2) subplot(2,1,1) plot(t,xizq); title('metal fatigue canal izquierdo'); xlabel('tiempo t(s)'); ylabel('presion sonora p(t) (Pa)'); legend('p_{izq}(t)'); axis([ min(t), max(t), -1.5*max(abs(xizq)), 1.5*max(abs(xizq)) ]); grid on; box on; subplot(2,1,2) plot(t,xder); title('metal fatigue canal derecho'); xlabel('tiempo t(s)'); ylabel('presion sonora p(t) (Pa)'); legend('p_{der}(t)'); axis([ min(t), max(t), -1.5*max(abs(xder)), 1.5*max(abs(xder)) ]); grid on; box on; %generación de canal stereo f1 = 1000; f2 = 4000; %arreglos fila yizq = sin(2*pi*f1*t); yder = sin(2*pi*f2*t); %transposicion a columnas yizq = transpose(yizq); yder = transpose(yder); %arreglo matricial concatenando las columnas formamos una matriz de (Nt X 2) y = [yizq,yder]; sound(y,fs); audiowrite('miprimerstereo.wav',y,fs);