Thanks for the all the interesting responses. I did some thinking and a few
experiments, and I think the best way to do it would be to use an amplitude
modulated sine ( actually triangle ) wave at one have the nyquist, precisely
1/4 of sample rate. Here's why I think this:
At half nyquist, we have exactly four samples always per full wave. This
means any sample is either a peak ( our desired data ), or a zero. It also
means sine wave and triangles look exactly identical, and geometric
production of the wave as a triangle will work perfectly, while production
of the wave as a sine will get forced into a triangle shape. At the nyquist,
the wave is either all peaks or all zeros, so that's no good because most
digitial synthesis wave generators will start at 0 phase, meaning we get all
zeros and no data! We could force everyone to use nyquist with phase 90%,
but I think that makes things needlessly difficult to generate and
represent.
At frequencies other than half nyquist, we get long range distortions if a
sine wave is used, ( try it out, I never realized just *how* lame 48khz is
until trying this! ) but at half nyquist sines and tris are the exact same
so it should be easy for any app to generate these perfectly. The same holds
true for quarter nyquist, eight, etc, which could be optional for lower res
signals, but I can't think of any advantage to using lower than 1/4 sr. Pipe
up if you can please. I think the recomendation should be: "Use a triangle
if you are not absolutely positive the frequency calculation is perfect. If
you know it is precisely 1/4 sr, use a sine or a tri."
At half nyquist, it should also thus take only 2 samples to get the data,
and it seems to me ( though I'm no DSP programming expert by *any* stretch )
that this should make demodulating very simple. The needed control data can
be reached by a two sample sample-and-hold, or a conditional evaluation that
just checks whether the data is not 0, or an averaging equation on any power
of 2 samples range ( ie the average amp of four samples multiplied by two
gives us the control data. )
Our peak control rate is thus 1/4 sample rate, which is high enough for nice
sounding amplitude envelopes, and if less is needed the same frequency wave
can be either modulated or demodulated at a lower resolution. As long as the
window is a multiple of 2, we should get good accuracy.
Further, this would I think allow easy hardware integration as standard
sound cards can be used, again demodulation should be straightforward for
outboard gear ( easy microcontroller programming again with the 2 sample
sample and hold for example ) and we don't have to worry about telling
people to be careful with potentially dangerous DC signal.
And . . . we already have a plethora of gear and software that at the very
least allows automation of volume. This way that facility can be bastardized
to become whatever we want. This also looks nice in standard wave views, a
nice graphic view of the data is clear as a block of solid colour in most
viewers.
I am interested to hear any and all feedback of course.
Thanks,
Iain Duncan