View Single Post
Old 11th January 2010, 19:13   #22
Major Dude
Join Date: Mar 2008
Location: Erlangen
Posts: 872
Reversing data transfer

I found that gmegabuf introduces a feature which might be quite useful: Since it can be read and written from all frame/wave/shape code sections, it allows the transfer of data "backwards", e.g. from the waves to the frames equations section, which was not previously possible via the q variables.

I used this to create a "true" volume variable. The standard bass, mid and treb variables are subject to automatic gain control (AGC) and do not reflect the real music volume. I often found this a pain because the preset never knows when there is a silent passage in the music. Luckily, AGC is not applied to the variables value1, value2 in the wave sections. Therefore I used wave 1 to generate a "true" volume by adding up all spectral components, and stored it in gmegabuf(1), which is accessible from the frames equations.

Attached a simple demo. The pink curve shows the traditional volume (bass+mid+treb, smoothed), the green curve is gmegabuf(1).

Play an average piece and both curves will be similar.

Then play a quiet piece and see how the pink curve slowly grows as AGC control opens up, as it always tries to adjust to a medium level. This has benefits of course but it means that the relation to loudness is lost. After a silence of a few seconds, the signal may even freak out completely. When a loud passage follows, the pink signal will shoot over until AGC control brings it back to average level.

Altogether you'll see that the green curve reflects the real volume much better. Similarly, you may now generate your own bass or treb, or other bandfiltered variables as you like, or generate separate variables for the left and right channel, simply by selection of spectral components in the wave equation.
Nitorami is offline   Reply With Quote