"samplerate" question (environment)

Take a look at the Arduino AudioZero library which uses a timer and an interrupt to feed data at a fixed rate to a DAC.