PDA

View Full Version : Record meters...



bertie
07-08-2004, 02:32 PM
hi Bob :)

About record meters.... :)

How did you manage to make record meter in SAWStudio to react so realtime is like using a real mixing desk recording meters.

Non of the famous DAW's i tried don't have that instant reaction in record meters except one CoolEdit Pro. So i'm confused :confused:

CoolEditPro is I believe written in C++ and SAWStudio in assembly so where is the trick :confused: Is it on what programming language you use or else...?

Bertie (lifetime SAWStudio user)

AudioAstronomer
07-08-2004, 02:36 PM
Cooledit are not "realtime" persay... they still suffer a latency which is more noticable than saw's for sure....

I would like to know the basic of how you do it too ;) It's a neat trick whatever you're doing because no other daw can do it so well... especially the PLAYBACK meters which are much more accurate than other daw's as well (with a few minor exceptions that are just as accurate in the time domain)

Bob L
07-08-2004, 06:37 PM
All the SAW programs use a special built-in timing thread, made available to the native plugin api also, that allows for perfect meter timing. This has been in my api for almost 10 years.

The real design problem actually takes this form... in order to output audio on a PC, you first have to get the disk data and process and mix it and send it to the soundcard, ahead of time, in order for the soundcard to play it back x number of ms later... depending on the size of the buffers you pre-sent.

If you look at the meters on most systems, they are actually early, not late. The amount of timing error is dependent on the size of the buffers. Only a short time ago, buffer sizes below 2048 were quite rare without glitches (SAWPro required 2 buffers at 16,384 size on a good NT machine for a total of 32,768 samples), and the meter data, in most programs and plugins, was usually collected and displayed as the buffers were processed... ahead of time by the amount of the buffer size and number of buffers.

The meters look off visibly to the eye, because you are hearing the audio later, out of time with the display... transients never lined up and therefore the meters get very latent and confused looking very quickly.

DX and VST plugins were always a mess, and meters were useless on them, in my opinion. They have to process the data as the buffers are pre-prepared ahead of time. The display was usually handled at the same time, thereby being off from the audio data you were hearing.

If the meter data is actually late on a certain app, then it is probably attempting to delay the output by some guessed amount, in many cases, and is still not necessarily in control of the exactness of the meter display timing.

Things have only gotten better recently because of the lower buffers sizes in the ASIO driver, and now SAWStudio's MME driver handling.

The meters in most apps are still off... but by a smaller amount now, to where it is not as useless, and even works ok to the untrained eye.

SAW uses this special Time-Critical timing thread that is in very close sync with the actual audio output. This same thread is used for the video and Midi sync in SAWStudio.

The trick is simple... You process the meter data at the time the buffers are pre-sent, but you simply keep a sample position reference and cache the finished meter data. Then, when the timing thread comes around, you look at the current timing position and match the output of the meter data with the exact current audio playback position given in the timing thread.

This keeps meter data precisely accurate with what you are hearing.

You can see some sample code if you are interested by downloading my Plugin API and looking at the sample plugin code to see how its done.

Bob L

mghtx
07-08-2004, 07:57 PM
Wow, what an explaination. Thanks.

I agree with Robert on the playback meters. After seeing Saw in action, when I went back to finish some stuff in Cubase SX I was floored. I quess I just didn't take notice of it. Sonar 2 isn't as bad as Cubase. The Sonar 3 demo is pretty good too. But Saw's meters are far and away the best. It is like a real console. Amazing.

AudioAstronomer
07-08-2004, 07:59 PM
Hrm.. most other daw are certainly late on the meters... When the project gets bigger in some of them the meters get much much worse.... especially with higher cpu the meters just die. blech. Nuendo's (and pthd) meters are the closest I know of... but close doesnt count when you got perfect in front of you.