matlab 音频编辑器,在Matlab中使用App Designer可以进行实时音频处理吗?

我想用Matlab中的应用程序设计器编写一个简单的音频过滤应用程序。一个人应该能够加载音频文件,按播放和改变参数,如输入增益,截止频率等,而文件正在播放。

我只是不知道如何能够实时更改参数并更新相应的变量,以便人们能够听到过滤器是如何更改的。

这是我现在写的代码:

classdef EulerFilter < matlab.apps.AppBase

% Properties that correspond to app components

properties (Access = public)

UIFigure matlab.ui.Figure

CutoffKnobLabel matlab.ui.control.Label

CutoffKnob matlab.ui.control.Knob

PlayButton matlab.ui.control.StateButton

end

properties (Access = public)

inputGain % input Gain

CutoffHz % cutoff frequency in Hz

end

methods (Access = public)

function play(app)

% setup file stream

frameLength = 256;

fileReader = dsp.AudioFileReader(...

'Sun Behind CloudsDry.wav',...

'SamplesPerFrame',frameLength);

deviceWriter = audioDeviceWriter(...

'SampleRate',fileReader.SampleRate);

% code snippet

% porcessing of frames

while ~isDone(fileReader)

% code snippet

end

release(fileReader);

release(deviceWriter);

end

end

methods (Access = private)

% Code that executes after component creation

function startupFcn(app)

app.inputGain = 1;

app.CutoffHz = 22000;

end

% Value changed function: PlayButton

function PlayButtonValueChanged(app, event)

value = app.PlayButton.Value;

play(app);

end

% Value changing function: CutoffKnob

function CutoffKnobValueChanging(app, event)

%display(event)

changingValue = event.Value;

app.CutoffHz = changingValue;

end

end

% App initialization and construction

methods (Access = private)

% Create UIFigure and components

function createComponents(app)

% Create UIFigure

app.UIFigure = uifigure;

app.UIFigure.Position = [100 100 640 480];

app.UIFigure.Name = 'UI Figure';

% Create CutoffKnobLabel

app.CutoffKnobLabel = uilabel(app.UIFigure);

app.CutoffKnobLabel.HorizontalAlignment = 'center';

app.CutoffKnobLabel.Position = [159 322 37 22];

app.CutoffKnobLabel.Text = 'Cutoff';

% Create CutoffKnob

app.CutoffKnob = uiknob(app.UIFigure, 'continuous');

app.CutoffKnob.Limits = [10 22000];

app.CutoffKnob.MajorTicks = [10 1000 5000 22000];

app.CutoffKnob.ValueChangingFcn = createCallbackFcn(app, @CutoffKnobValueChanging, true);

app.CutoffKnob.Position = [155 367 45 45];

app.CutoffKnob.Value = 22000;

% Create PlayButton

app.PlayButton = uibutton(app.UIFigure, 'state');

app.PlayButton.ValueChangedFcn = createCallbackFcn(app, @PlayButtonValueChanged, true);

app.PlayButton.Text = 'Play';

app.PlayButton.Position = [60 40 100 22];

end

end

methods (Access = public)

% Construct app

function app = EulerFilter

% Create and configure components

createComponents(app)

% Register the app with App Designer

registerApp(app, app.UIFigure)

% Execute the startup function

runStartupFcn(app, @startupFcn)

if nargout == 0

clear app

end

end

% Code that executes before app deletion

function delete(app)

% Delete UIFigure when app is deleted

delete(app.UIFigure)

end

end

end

它主要是Matlab为图形用户界面生成的函数。我添加了一些属性,其中包含输入增益、截止值等的值,以及执行信号处理的play()函数。

我可以运行应用程序,按下播放按钮,听到正在播放的音频文件,但当我改变截止频率,例如,没有改变。我想这是因为当按下play按钮时,我在回调函数中执行play()函数,因此在另一个按钮完成之前,不能执行切断旋钮时的回调函数。

当我第一次更改参数,然后按播放,一切都是正确的,除了我不能改变参数时,文件正在播放。

我尝试过以下方法,但没有成功:

在play()函数的while循环中调用回调函数,但我不知道需要传递哪个参数

事件

(Matlab总是告诉我它不知道缺少命令或参数)或者这是否有用

在runStartupFcn()中执行play()函数,但此函数在显示图形用户界面之前执行,这当然是无用的

据我所知,我不能在其他地方添加函数

所以现在的问题是:我能让应用程序实时工作吗?

我期待着你的回答!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/440479.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【牛客 - 157E】青蛙(floyd最短路,建图)

题干&#xff1a; 链接&#xff1a;https://ac.nowcoder.com/acm/contest/157/E 来源&#xff1a;牛客网 题目描述 有一只可爱的老青蛙&#xff0c;在路的另一端发现了一个黑的东西&#xff0c;想过去一探究竟。于是便开始踏上了旅途 一直这个小路上有很多的隧道&#xff0…

php移动端url,什么是PC和移动端URL路径规范化

什么叫PC和手机端URL途径规范性在网址百度搜索引擎提升的全过程中&#xff0c;会牵涉到途径方位的难题。网址中的同一个网页页面只相匹配一个网站地址。一个规范化和简易的网站地址有利于检索和捕捉客户的记忆力&#xff0c;回绝好几条途径&#xff0c;偏向同一个网页页面&…

【牛客 - 157D】插排树(dfs,树形dp)

题干&#xff1a; 链接&#xff1a;https://ac.nowcoder.com/acm/contest/157/D 来源&#xff1a;牛客网 一年一度的山东省oi夏令营又开始了&#xff0c;每到这个季节&#xff0c;山东的oier们都会欢聚这里&#xff0c;一起学&#xff08;tu&#xff09;习&#xff08;fe&…

【北航】Bella 姐姐发辣条(贪心)

题干&#xff1a; 题目描述 Bella 姐姐又来回国发辣条啦。 所有集训队的小朋友按照训练成绩站成一排&#xff0c;从左到右为成绩从低到高排列。每个人都对和蔼的 Bella 姐姐有两个要求&#xff1a; 我至少需要 AiAi 根辣条。 我要比我左边的小朋友恰好多 BiBi 根辣条&#…

【蓝桥杯官网试题 - 历届试题】小朋友排队(逆序数,树状数组)

题干&#xff1a; 问题描述 n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列&#xff0c;但是每次只能交换位置相邻的两个小朋友。   每个小朋友都有一个不高兴的程度。开始的时候&#xff0c;所有小朋友的不高兴程度都是0。   如果某个小朋友第一次被要求交换…

matlab的diray在哪,matlab笔记

matlab笔记 目录 P5第一章——matlab 概述与格式 P10eps 浮点相对精度inf 无穷大i 或 j 虚数单位pi 圆周率nan 非数nargin 函数输入变量数目nargout 函数输出变量数目realmax 最大正实数realmin 最小正实数real( ) 实部imag( ) 虚部abs( ) 绝对值angle( ) 复数的相位角**matlab…

【CodeForces - 190E】Counter Attack (补图bfs,卡常,dsu)

题干&#xff1a; 无向图中给定n个顶点&#xff0c;m条不存在的边(除了这m条边&#xff0c;其余都存在)&#xff0c;求图的连通分量&#xff0c;及每个连通分量的大小。 解题报告&#xff1a; https://codeforces.com/blog/entry/4556 AC代码&#xff1a; #include<cstd…

denison php,Parker / Denison丹尼逊柱塞泵首相系列相关说明

派克Dension首相系列柱塞泵经过专门设计&#xff0c;可在要求流量可变&#xff0c;高压和高速的行业中使用。凭借无与伦比的连续psi额定压力和灵活的设计&#xff0c;它们确保了可靠性。首相系列具有卓越的设计和简化的维护&#xff0c;可提供可提高性能的高压可变活塞泵。低进…

【HDU - 6119】小小粉丝度度熊 (区间合并,尺取,思维)

题干&#xff1a; 度度熊喜欢着喵哈哈村的大明星——星星小姐。 为什么度度熊会喜欢星星小姐呢&#xff1f; 首先星星小姐笑起来非常动人&#xff0c;其次星星小姐唱歌也非常好听。 但这都不是最重要的&#xff0c;最重要的是&#xff0c;星星小姐拍的一手好代码&#x…

matlab 多径 时变 信道 冲击响应,无线信道—时变冲激响应

图1无线信道的作用可以分成大尺度效应和小尺度效应。大尺度的效应就是改变了信号的平均功率&#xff0c;即B点的功率是A点的1/L。因此可以将图1等效成图2图2其中C点的平均功率等于B点的平均功率。L的数值可根据传播模型确定。影响接收机性能的只是信噪比&#xff0c;因此&#…

matlab中均线交易策略,【每日一策】Matlab量化交易策略之 均线选股策略

策略名称&#xff1a;均线选股策略策略说明&#xff1a;对沪深300全市场扫描买入条件&#xff1a;1 短均线大于长均线2 最近N个交易日短均线大于长均线的次数满足某个阈值3 当前交易日的长均线值处于某个高位出场条件&#xff1a;止损&#xff1a;价格跌破入场价的一定百分比止…

【POJ - 3160】Father Christmas flymouse(Tarjan缩点,DAG最长路)

题干&#xff1a; After retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ends such as cleaning out the computer lab for training as extension of his contribution to the team. When Christmas came, flymouse played Father Ch…

docker php 乱码,如何解决docker安装zabbix5.0界面乱码

如何解决docker安装zabbix5.0界面乱码&#xff1f;zabbix图形界面乱码如下&#xff1a;解决&#xff1a;docker部署zabbix-web和源码安装zabbix-web一样&#xff0c;字体都是存储在/usr/share/zabbix/assets/fonts/1、从windown拷贝simkai.ttf(楷体)文件到docker的zabbix-web里…

【POJ - 1330】Nearest Common Ancestors(lca,模板题)

题干&#xff1a; A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8 is the root of the tree. Node x is an ancestor o…

java redis 流水线,Redis系列(1) —— 流水线

写在前面去年下半年&#xff0c;出于学习Redis的目的&#xff0c;在看完《Redis in Action》一书后&#xff0c;开始尝试翻译Redis官方文档。尽管Redis中文官方网站有了译本&#xff0c;但是看别人翻译好的和自己翻译英文原文毕竟还是有很大的不同。这一系列文章之前发布在GitB…

【HDU - 6187】Destroy Walls(思维,最大生成树)

题干&#xff1a; Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area. Since it was not convenient, the new king wants to destroy some of these walls, so he can arrive anywhere from his castl…

mseq matlab,Matlab生成M序列

版权声明&#xff1a;本文为CSDN博主「laomai」的原创文章原文链接&#xff1a;https://blog.csdn.net/laomai/article/details/24342493找了好多代码&#xff0c;这个步骤详细可以傻瓜操作&#xff0c;存着备用~实验环境为matlab2013b1、首先编写一个mseq.m文件,内容为:functi…

【HDU - 6185】Covering(矩阵快速幂优化二维dp,高斯消元,轮廓线dp打表)

题干&#xff1a; Bobs school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt when playing happily on the playground, rich boy Bob decided to cover the playground using his carpets. Me…

Java工厂构造函数参数,javascript 面向对象之构造函数、工厂方式、字面量

什么是面向对象编程面向对象的英文全称:Object Oriented Programming , 简称OOP首先我们要先了解面向过程的编程思想, 就是代码从上到下都没有封装的意思&#xff0c;某写代码裸露在外、没有模块化、代码杂乱无章的写法. 并且还不好维护&#xff0c;也不便于后期二次修改面向对…

【HDU - 6186】CS Course(按位与,按位或,按位异或的区间统计,二进制拆位)

题干&#xff1a; Little A has come to college and majored in Computer and Science. Today he has learned bit-operations in Algorithm Lessons, and he got a problem as homework. Here is the problem: You are giving n non-negative integers a1,a2,⋯,ana1,a2,…