Hallo,
I am working on a project where I am going to generate sounds using a Karplus-Strong string synthesis and I have encounted something I am unsure about.
The problem I need help with is that my algorithm generate a vector of N-size with a tone with a specific a frequency M, e.g. 2000 Hz, however, given sound depend on the sampling rate, let us say in my case 5000 Hz I want to make sure I am running with a specific sampling rate, but I am unsure how to make sure that the vector is sent out from a pin to a speaker with a specific sampling rate, so is there a way to do this?
Some other information regarding my project is that the board is either going to be a UNO R3 or a Zero and the vector to be played is fully calculated before hand.
For people not knowing what the Karplus-Strong synthesis is, it is noise that is delayed and filtered in the most simple version of the algorithm.
The low pass filter in my case is y[n] =ax[n] + (1−a)x[n−1]