I want to increase/decrease volume of audio file using the slider,is it necessary to run audio data from slider?
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Madhav Sapkota
am 12 Dez. 2018
Kommentiert: Walter Roberson
am 14 Dez. 2018
global filename;
[y,Fs] = audioread(filename);
slider_val = get(hObject, 'Value');
if slider_val == 0
x = y/5; % Decrease volume
player = audioplayer(x, Fs);
play(player,[1 (get(player, 'SampleRate')*3)]);
elseif slider_val == 1
x = y*5; % Increase volume
player = audioplayer(x, Fs);
play(player,[1 (get(player, 'SampleRate')*3)]);
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 12 Dez. 2018
You should use the Audio Systems Toolbox. At each point you would fetch a batch of samples and multiply them by the current slider value, and queue them to be played as audio.
Creating a separate audio player for each batch of sounds is too much overhead, and there is no feasible way to update the sound samples of an audioplayer once it is built.
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!