Matlab - Escuchar_GUI

 
Vista:
sin imagen de perfil

Escuchar_GUI

Publicado por Carlos (1 intervención) el 09/05/2014 22:29:05
Hola amigos, por favor necesito ayuda en un programa
la idea es esta:
Realizar un programa que nos permita realizar lo siguiente:

* Botón para seleccionar un archivo donde quiera que este esté.

*Después de su lectura, mostrar la señal anterior en una gráfica de tiempo.

* Botón para escuchar.

* Amplificar o atenuar la señal mediante una barra de desplazamiento.

(si está entre 0 y 1: atenuación; si está mayor que 1: amplificación).

Cada vez que usemos la barra de desplazamiento, debe escucharse el sonido

con su amplitud ya cambiada (atenuada o amplificada)

bien el boton de buscar el archivo y el de graficar ese archivo en un axes ya lo tengo, pero mi problema es al rato de escucharlo, como hago para que por medio de otro boton (ESCUCHAR) reproduzca el sonido que tengo en la grafica???

este es el avanze de mi proyecto:

function varargout = proyecto_TDS_Valencia_Bosmediano(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @proyecto_TDS_Valencia_Bosmediano_OpeningFcn, ...
'gui_OutputFcn', @proyecto_TDS_Valencia_Bosmediano_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



% --- Executes just before proyecto_TDS_Valencia_Bosmediano is made visible.
function proyecto_TDS_Valencia_Bosmediano_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 proyecto_TDS_Valencia_Bosmediano (see VARARGIN)

% Choose default command line output for proyecto_TDS_Valencia_Bosmediano
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes proyecto_TDS_Valencia_Bosmediano wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = proyecto_TDS_Valencia_Bosmediano_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 Seleccion.
function Seleccion_Callback(hObject, eventdata, handles)
[nombrep, rutap]= uigetfile('*.wav','ABRIR AUDIO');
if nombrep==0
return;
else
[sp,Fs,nbit]= wavread([rutap,nombrep]);
end
helpdlg ('Archivo seleccionado correctamente','Mensaje de Aviso');
handles.sp=sp;
guidata(hObject, handles);





(necesito la ayuda para este boton)
% --- Executes on button press in Escuchar.
function Escuchar_Callback(hObject, eventdata, handles)
% hObject handle to Escuchar (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 Stop.
function Stop_Callback(hObject, eventdata, handles)
% hObject handle to Stop (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)


% --- Executes on slider movement.
function despl_Callback(hObject, eventdata, handles)
% hObject handle to despl (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 despl_CreateFcn(hObject, eventdata, handles)
% hObject handle to despl (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 button press in Salir.
function Salir_Callback(hObject, eventdata, handles)
% hObject handle to Salir (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcbf)



% --- Executes on button press in grafica.
function grafica_Callback(hObject, eventdata, handles)
% hObject handle to grafica (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
sp=handles.sp;
Canal_R=sp(:,1);
hp=subplot(2,1,1,'reemplazar',handles.axes1);
plot(hp,Canal_R);
title('Audio Canal Derecho');
xlabel('Muestras');
ylabel('Amplitud');
helpdlg ('Archivo cargado correctamente','Mensaje de Aviso');
handles.sp=sp;
guidata(hObject, handles);

espero su ayuda gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Escuchar_GUI

Publicado por Andres (9 intervenciones) el 10/05/2014 04:37:03
usa el comando sound(handles.sp) en el callback de Escuchar

1
2
3
4
5
6
% --- Executes on button press in Escuchar.
function Escuchar_Callback(hObject, eventdata, handles)
% hObject handle to Escuchar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
sound(handles.sp)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar