I think I’ve found a bug in the Piezo driver at [url]http://code.tinyclr.com/project/18/piezo-speaker/[/url]
In the 2nd Play method overload, which takes an array of frequencies and an array of durations:
public void Play(int[] freqs, int[] durations_mSec)
{
if (freqs.Length != durations_mSec.Length)
throw new ArgumentException("Arrays must be of the same length.");
for (int i = 0; i < freqs.Length; i++)
{
Play(freqs[i], durations_mSec[0]);
}
}
the looping code that calls into the other Play overload uses the integer 0 rather than i inside the loop. As a result, the code will always use the first duration_mSec value in the array, rather than the one that corresponds to the current loop iteration. I think the correct line should be:
Play(freqs[i], durations_mSec[i]);