frequency shift slider in real time
8 views (last 30 days)
i have the following code that reads an audio file, adds a frequency (the bold line) to the file and plots it , my question is the value of the added frequency comes from a slider (changingvalue), after changing the value the plot is plotted , how can i plot as im changing the value kinda like in real time.
changingValue = event.Value;
app.RPMGauge_2.Value = changingValue;
sample = 44100;
[y,Fs] = audioread("Sound and 1000 new.wav");
dt = 1/sample;
StopTime = 20;
Nsamps = length(y);
t = (1/sample)*(1:Nsamps);
A = 0.017;
xfreq = A*sin(2*pi*changingValue*t);
xfreq(t>StopTime) = 0;
xfreq = xfreq';
mix = y + xfreq;
y_fft = abs(fft(mix));
y_fft = y_fft(1:Nsamps/2);
f = Fs*(0:Nsamps/2-1)/Nsamps;
rumin diao on 8 Sep 2022
if you add a slider in appdesigner:
you can get the current slider number by "app.Slider.Value" . "app.Slider" is the name and "Value" is the property.
you can see: Slider Properties for more information.