using knob to adjust audio frequency
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
How can I use a knob to adjust the frequency of audio such as the handel.mat sound
0 Commenti
Risposte (1)
Walter Roberson
il 1 Dic 2025 alle 3:21
Use uiknob with the 'ValueChangedFcn' option to call a callback function that stores the new frequency.
Beyond that will depend on whether you want continuous frequency change or discrete frequency change.
If you want discrete frequency change, then you can use audioplayer stop() method, then set the SampleRate property, and then play() -- but this will restart the audio from the beginning, and will play the audio only once per invocation of play(). [Note: it just might be possible to resume() after setting the SampleRate property... not sure.]
If you want continuous frequency change, then you would use https://www.mathworks.com/help/audio/ref/audiodevicewriter-system-object.html . I do not know what happens if you change the SampleRate while you are playing.
You might possibly need to set the SampleRate somewhat high, and then resample() the soundwave from the chosen frequency to the chosen SampleRate; some buffer management would be needed to be able to switch frequencies in mid playing.
0 Commenti
Vedere anche
Categorie
Scopri di più su Audio I/O and Waveform Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!