Está en la página 1de 17

Cdigo consola DJ

https://www.youtube.com/watch?v=0vW4KVFV__o

lc
% c
% c lear

[entrada fo]=audioread('6.wav');
[respuesta fo]=audioread('catedral.wav');
entrada=entrada(:,1);
respuesta=respuesta(:,1);
Emu1=conv(entrada,respuesta);
wavwrite(Emu1,44100,uiputfile({'*.mp3'},'guardar como'));
sound(Emu1,44100);

%
% %EMULADOR
%
% [y a]=audioread('6.wav');
% [h1 a]=audioread('plazache.wav');
%
% y= y(:,1);
% h1= h1(:,1);
% x= conv(y,h1);
% x= x(1:length(y));
% L= length(x);
% f= a*(0:(L/2))/L;
% X= fft(x);
% X_1= X(1:L/2+1);
% b= 1000;
% c= 4000;
% filtro(1:L,1)= 0;
% filtro(b:c,1)= 1;
% filtro(L-(c-b):L,1)= 1;
% Y=X.*filtro;
% x_1=ifft(Y);
% x_2=(x_1.*conj(x_1)).^0.5;
%
% for i=1:length(x_1)
% i f x_1(i) < 0
% x_2(i)=x_2(i)*(-1);
% e nd
% end
%
% sound(x_2,44100)
% subplot(3,1,1)
% plot(f,X_1);
% subplot(3,1,2)
% plot(x);
% subplot(3,1,3)
% plot(x_2);

%EMULADOR

[y a]=audioread('6.wav');
[h1 a]=audioread('catedral.wav');

y=y(:,1);
h1=h1(:,1);

Emu1=conv(y,h1);

%sound(Emu1);

F1=fft(Emu1);
%F1= F1(200:8000);
x=ifft(F1);
x_1 = (x.*conj(x)).^0.5;
sound(x_1/1000);
plot(x_1/1000);

%PROYECTO DJ

%Lectura seal de audio


[g a]=audioread('6.wav');
y=g(:,1);

ound(y,a);
% s
% p lot(y);

%5 Terminator
[x b]=audioread('4.wav');
% sound(x,b);
% plot(x(:,1))

%Longitud audio 1
r=length(y);

EZCLA
% M
% I gualar tamao de vectores

% if length(x)<r
% x1=zeros(r,1);
% x1(1:length(x),1)=x(:,1);
% end
%
% z=x1+y;
% sound(z,a);
%
% subplot(3,1,3)
% plot(z);
% title('Seal 1+2')
%
% subplot(3,1,1)
% plot(x1)
% title('Seal 1')
%
% subplot(3,1,2)
% plot(y)
% title('Seal 2')

%Tiempo de duracin
t1=size(y,1)/a;

%ELONGACIN DE LA SEAL

% el=2;
% lento = zeros(el*r,1);
% lento(1:el:el*r,1)=y;
%
% % frecuencia lento
% f= a/el;
%
% subplot(2,1,1)
% plot(lento)
% title('Seal elongada')
%
% subplot(2,1,2)
% plot(y)
% title('Seal original')
%
% sound(5*lento,a);

%COMPRESION DE LA SEAL

% co=2;
% sound(y(1:co:r),a);
%
% subplot(2,1,1)
% plot(y(1:co:r))
% title('Seal comprimida')
%
% subplot(2,1,2)
% plot(y)
% title('Seal original')

%INVERSIN

nv=y(end:-1:1);
% i
% s ound(inv,a);

%REPRODUCCIN CON DESFASE

%Izquierda

esfase_iz=300000;
% d
% v ec1=y(desfase_iz:1:r);
% s ound(vec1,a);

%Derecha

% desfase_der=300000;
%
% vec_des=zeros(length(y),1);
% j=0;
% for i=desfase_der:length(y)
% j=j+1;
% vec_des(i)=y(j);
% end
% sound(vec_des,a);

%ECO

% for i=2:6;
% sound(10*x,a);
% pause(t2-2.8)
% x=x*(1/i);
% end

%REBERVERACIN

% vec_t=zeros(length(x),1);
% for i=2:length(x);
% vec_t(i,1)=vec_t(i-1,1)+1/b;
% end
%
% for i=2:6;
% plot(vec_t,x);
% sound(8*x,b);
% pause(t2-3.1)
% x=x*(1/i);
% hold on
% end

%Grabar audio

grabacion=audiorecorder(44100,16,1);
msgbox('Grabando');
recordblocking(grabacion,2);
msgbox('Grabacion finalizada');
grabacion=getaudiodata(grabacion);
wavwrite(grabacion,44100,uiputfile({'*.wav'},'guardar como'));
[y a]=audioread('Hola.wav');
sound(Hola);

*******************
FILTRO ECO

load('cancion_preg.mat');
CANCION=fft(cancion);
f=linspace(0,Fs,length(CANCION));
Hjw=(1+((a*(1-b)).*exp((-j*D).*f)))./(1-((a*b).*exp((-j*D).*f)));
HECANCION=CANCION.*Hjw;
hecancion=real(ifft(HECANCION));
ht=real(ifft(Hjw));
t=linspace(0,Fs,length(ht));

****************************
%PROYECTO DJ

%Lectura seal de audio


[g a]=audioread('6.wav');
y=g(:,1);

sound(y,a);

%5 Terminator

[x b]=audioread('4.wav');
% sound(x,b);
% plot(x(:,1))

%Longitud audio 1
r=length(y);

% MEZCLA
% Igualar tamao de vectores

% if length(x)<r
% x1=zeros(r,1);
% x1(1:length(x),1)=x(:,1);
% end
%
% z=x1+y;
% sound(z,a);
%
% subplot(3,1,3)
% plot(z);
% title('Seal 1+2')
%
% subplot(3,1,1)
% plot(x1)
% title('Seal 1')
%
% subplot(3,1,2)
% plot(y)
% title('Seal 2')

%Tiempo de duracin
t1=size(y,1)/a;
T(1)=t1;
for i=2:r
T(i)=t1+T(i-1);
end
plot(T,y);
%ELONGACIN DE LA SEAL

% el=2;
% lento = zeros(el*r,1);
% lento(1:el:el*r,1)=y;
%
% % frecuencia lento
% f= a/el;
%
% subplot(2,1,1)
% plot(lento)
% title('Seal elongada')
%
% subplot(2,1,2)
% plot(y)
% title('Seal original')
%
% sound(5*lento,a);

%COMPRESION DE LA SEAL

% co=2;
% sound(y(1:co:r),a);
%
% subplot(2,1,1)
% plot(y(1:co:r))
% title('Seal comprimida')
%
% subplot(2,1,2)
% plot(y)
% title('Seal original')
%INVERSIN

% inv=y(end:-1:1);
% sound(inv,a);

%REPRODUCCIN CON DESFASE

%Izquierda

% desfase_iz=300000;
% vec1=y(desfase_iz:1:r);
% sound(vec1,a);

%Derecha

% desfase_der=300000;
%
% vec_des=zeros(length(y),1);
% j=0;
% for i=desfase_der:length(y)
% j=j+1;
% vec_des(i)=y(j);
% end
% sound(vec_des,a);

%ECO

% for i=2:6;
% sound(10*x,a);
% pause(t2-2.8)
% x=x*(1/i);
% end

%REBERVERACIN

% vec_t=zeros(length(x),1);
% for i=2:length(x);
% vec_t(i,1)=vec_t(i-1,1)+1/b;
% end
%
% for i=2:6;
% plot(vec_t,x);
% sound(8*x,b);
% pause(t2-3.1)
% x=x*(1/i);
% hold on
% end

%ENTREGA NUMERO 2:
trans_f=fft(y);
f(1)=0;
for i=2:length(T)
f(i)=f(i-1)+1;
end
plot(f,trans_f);
le=length(trans_f);
display(le);

*******************************
++++++++++++++++++++++++++++++

function varargout = proyecto2(varargin)

% PROYECTO2 MATLAB code for proyecto2.fig


% PROYECTO2, by itself, creates a new PROYECTO2 or raises the existing
% singleton*.
%
% H = PROYECTO2 returns the handle to a new PROYECTO2 or the handle to
% the existing singleton*.
%
% PROYECTO2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PROYECTO2.M with the given input arguments.
%
% PROYECTO2('Property','Value',...) creates a new PROYECTO2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before proyecto2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to proyecto2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help proyecto2


% Last Modified by GUIDE v2.5 12-Oct-2017 14:39:49

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @proyecto2_OpeningFcn, ...
'gui_OutputFcn', @proyecto2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before proyecto2 is made visible.


function proyecto2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to proyecto2 (see VARARGIN)

% Choose default command line output for proyecto2


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes proyecto2 wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = proyecto2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in A.


function A_Callback(hObject, eventdata, handles)

[g a]=audioread('2.mp3');
y=g(:,1);

sound(y,a);
plot(y);

% hObject handle to A (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in B.


function B_Callback(hObject, eventdata, handles)

[x b]=audioread('1.mp3');
sound(x,b);
plot(x(:,1))

% hObject handle to B (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in C.


function C_Callback(hObject, eventdata, handles)

% Igualar tamao de vectores


[g a]=audioread('2.mp3');
y=g(:,1);
[x b]=audioread('1.mp3');
r=length(y);
if length(x)<r
x1=zeros(r,1);
x1(1:length(x),1)=x(:,1);
end
z=x1+y;
sound(z,a);

subplot(3,1,3)
plot(z);
title('Seal 1+2')

subplot(3,1,1)
plot(x1)
title('Seal 1')

subplot(3,1,2)
plot(y)
title('Seal 2')
% hObject handle to C (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in D.


function D_Callback(hObject, eventdata, handles)

% ELONGACIN DE LA SEAL
% Frecuencia
a=44100

% lee audio1
[g a]=audioread('2.mp3');
y=g(:,1);
% lee audio2
[x b]=audioread('1.mp3');
% longitud audio1
r=length(y);
el=2;
lento = zeros(el*r,1);
lento(1:el:el*r,1)=y;

% frecuencia lento
f= a/el;

subplot(2,1,1)
plot(lento)
title('Seal elongada')

subplot(2,1,2)
plot(y)
title('Seal original')

sound(5*lento,a);
% hObject handle to D (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in E.


function E_Callback(hObject, eventdata, handles)

msgbox('Dejde de ser marica')


% hObject handle to E (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% % --- Executes on button press in F.


function F_Callback(hObject, eventdata, handles)

%COMPRESION DE LA SEAL

[g a]=audioread('2.mp3');
y=g(:,1);
% lee audio2
[x b]=audioread('1.mp3');
% longitud audio1
r=length(y);
a=44100;
co=2;
sound(y(1:co:r),a);

subplot(2,1,1)
plot(y(1:co:r))
title('Seal comprimida')

subplot(2,1,2)
plot(y)
title('Seal original')

% hObject handle to F (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in G.
function G_Callback(hObject, eventdata, handles)

[g a]=audioread('2.mp3');
y=g(:,1);

%INVERSIN

inv=y(end:-1:1);
sound(inv,a);

subplot(2,1,1)
plot(y(end:-1:1))
title('Seal invertida')

subplot(2,1,2)
plot(y)
title('Seal original')

% hObject handle to G (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in H.


function H_Callback(hObject, eventdata, handles)

[g a]=audioread('2.mp3');
y=g(:,1);

%Derecha

desfase_der=50000;
r=length(y);
vec_des=zeros(r,1);
j=0;
for i=desfase_der:length(y)
j=j+1;
vec_des(i)=y(j);
end
sound(vec_des,a);
% hObject handle to H (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in edit1.


function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(~, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% --- Executes on button press in I.


function I_Callback(hObject, eventdata, handles)

%Izquierda
a=44100;
[g a]=audioread('2.mp3');
y=g(:,1);
r=length(y);
desfase_iz=30000;
vec1=y(desfase_iz:1:r);
sound(vec1,a);
plot(vec1);

% hObject handle to I (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in J.


function J_Callback(hObject, eventdata, handles)
a=44100;
[x b]=audioread('1.mp3');

t2=size(x,1)/a;
%ECO
i=0;
for i=2:6;
sound(10*x,a);
pause(t2-2.8)
x=x*(1/i);
end

% hObject handle to J (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in K.


function K_Callback(hObject, eventdata, handles)
%REBERVERACIN
a=44100;
b=44100;
[x b]=audioread('1.mp3');

t2=size(x,1)/a;

vec_t=zeros(length(x),1);
for i=2:length(x);
vec_t(i,1)=vec_t(i-1,1)+1/b;
end

for i=2:6;
plot(vec_t,x);
sound(8*x,b);
pause(t2-3.1)
x=x*(1/i);
hold on
end

% hObject handle to K (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of K

% --- Executes on slider movement.


function slider2_Callback(hObject, eventdata, handles)
set(handles.Elongar,'el',x)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider

% --- Executes during object creation, after setting all properties.


function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.


if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on mouse press over axes background.


function axes4_ButtonDownFcn(hObject, eventdata, handles)
set(handles. )
% hObject handle to axes4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

También podría gustarte