




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
function varargout = MP3player(varargin)% MP3player MATLAB code for MP3player.fig% MP3player, by itself, creates a new MP3player or raises the existing% singleton*.% H = MP3player returns the handle to a new MP3player or the handle to% the existing singleton*.% MP3player(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in MP3player.M with the given input arguments.% MP3player(Property,Value,.) creates a new MP3player or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before MP3player_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to MP3player_OpeningFcn via varargin.% *See GUI Options on GUIDEs 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 MP3player % Last Modified by GUIDE v2.5 01-Nov-2014 21:41:05 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, MP3player_OpeningFcn, . gui_OutputFcn, MP3player_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before MP3player is made visible.function MP3player_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 MP3player (see VARARGIN) % Choose default command line output for MP3playerhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes MP3player wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = MP3player_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 structurevarargout1 = handles.output; function Path_Callback(hObject, eventdata, handles) % hObject handle to Path (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,String) returns contents of Path as text% str2double(get(hObject,String) returns contents of Path as a double % - Executes during object creation, after setting all properties.function Path_CreateFcn(hObject, eventdata, handles) % hObject handle to Path (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end % - Executes on button press in browse.function browse_Callback(hObject, eventdata, handles)global audio Y FSFileName,FilePath=uigetfile(*.MP3,Select the M-File);PathName=sprintf(%s%s,FilePath,FileName);set(handles.Path,string,PathName);mp3PathName=get(handles.Path,string);Y,FS=audioread(mp3PathName);audio=audioplayer(Y,FS); % hObject handle to browse (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 play.function play_Callback(, eventdata, handles)global audio FS Yaxes(handles.axes1);hold on;plot(Y, b); % plot audio datatitle(Audio Data);xlabel(strcat(Sample Number (fs = , num2str(FS), );ylabel(Amplitude);ylimits = get(gca, YLim); % get the y-axis limitsplotdata = ylimits(1):0.1:ylimits(2);hline = plot(repmat(0, size(plotdata), plotdata, r); % plot the marker% instantiate the audioplayer objectaudio = audioplayer(Y, FS); % setup the timer for the audioplayer objectaudio.TimerFcn = plotMarker, audio, gcf, plotdata; % timer callback function (defined below)audio.TimerPeriod = 0.01; % period of the timer in seconds % start playing the audio% this will move the marker over the audio plot at intervals of 0.01 splay(audio);% play(audio);% axes(handles.axes1);% plot(Y, b); % plot audio data% title(Audio Data);% xlabel(strcat(Sample Number (fs = , num2str(Fs), );% ylabel(Amplitude); % hObject handle to play (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 axes1_CreateFcn(hObject, eventdata, handles) % hObject handle to axes1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: place code in OpeningFcn to populate axes1 % - Executes on button press in pause.function pause_Callback(hObject, eventdata, handles)global audiopause(audio);% hObject handle to pause (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)global audiostop(audio);% 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 button press in resume.function resume_Callback(hObject, eventdata, handles)global audioresume(audio);% hObject handle to resume (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function plotMarker(. h0bject, . % refers to the object that called this function (necessary parameter for all callback functions) eventdata,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025人教部编版七年级语文上册大单元教学设计全册教案
- 2025年船用动力堆及配套产品合作协议书
- 2025年计算机系统服务项目提案报告模板
- 社区共治合作协议
- 展示道具行业知识培训课件
- 黑龙江公务员真题2025
- 2024年黑河嫩江市就业服务中心招聘真题
- 偏心轴机械加工工艺及磨外圆夹具设计
- TD-SCDMA基本原理(二)-鼎利培训
- 塑胶面层的施工方案(3篇)
- 设备维护方案(3篇)
- 护理操作管理课件
- 肉类加工间管理制度
- 2025年陕西、山西、青海、宁夏高考历史试卷真题(含答案解析)
- 2024-2025学年苏教版四年级下学期期末测试数学试卷(含答案)
- 动脉导管未闭封堵术的医疗护理
- 快递公司快递员管理制度
- T/CECS 10207-2022榫卯式钢管脚手架构件
- 师德师风警示教育课件
- 物业服务安全生产培训
- 华为员工合同协议书
评论
0/150
提交评论