Need help with Volume Slider Function(arguments)
4 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I've been trying to code an audio player for wav files throught the Matlab GUI.
Currently stuck on the volume slider function.
Is my conversion right? What arguments should I use for guidata?
Asking because it has different arguments than the function below I found online.
MY CODE SO FAR FOR THE VOLUME SLIDER:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/948929/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/948934/image.jpeg)
MY CODE FOR THE STATE BUTTON(PLAY/PAUSE):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/948939/image.jpeg)
FUNCTION I FOUND ONLINE:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/948944/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/948949/image.jpeg)
Thanks in advance
9 个评论
Geoff Hayes
2022-9-8
% SoundVolume(volume) sets the system speaker sound volume. The volume
% value should be numeric, between 0.0 (=muted) and 1.0 (=max).
So you would call the function from the command line or from code as
SoundVolume(0.5)
or some other value (between 0 and 1) that would change the volume.
采纳的回答
Jakub Devera
2022-4-1
You should be able to get the volume
Volume = app.VolumeSlider.Value;
It is a public property.
I am not sure what you want to achieve by the last line guidata, but this is not used in App Designer as @Geoff Hayes menitoned in the comment.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!