Sound Board optimization revisited

While the underlying audio routing architecture in WriteLog has not changed since it was updated to use the Windows Core Audio APIs in Windows Vista, the dialogs and test procedures available in WriteLog have been improved since the blog post two years ago advising how to optimize WriteLog’s sound board setup. This discussion here is based on the updates in WriteLog version 12.18.

OneSoundBoardPerRadioConfig.png

On this screen, you indicate to WriteLog:

  • Which sound output device is wired to each transmitter.
  • Which sound input device is cabled for audio from each receiver.
  • What sound input device has your microphone connected.
  • What sound output device has your headphones connected. WriteLog routes the Rcvr audio to the Headphones device.
  • The sound device used by WriteLog’s Audio Review is the Windows default sound board and cannot be changed from this dialog.

Exclusive mode devices versus Shared mode devices

Normally you will want to accept the default check box settings for which devices are accessed by WriteLog in exclusive mode. The dialog puts a message at the bottom of its page if you have changed the Allocate Exclusively from its default. Restore the Allocate Exclusively settings using the Defaults button and the message will disappear.

WriteLog uses the Windows Core Audio APIs. They can attain lower latency (less time delay from input of a sound to output of it) with the Allocate Exclusively checked on. However with that setting—and this is especially important for receiver audio—other sound-processing packages cannot read the receiver audio concurrent with WriteLog. Digital decoders like MMTTY will need this capability. By default, WriteLog uses Allocate Exclusively for all sound access except receiver audio. A constraint for shared mode allocation is that WriteLog must comply with the sample rate set in the Advanced Tab/Default-Format in the Windows Sound Control Panel.

Transmit audio, in contrast, need not be Shared Mode in WriteLog, even for sound board modulators, because WriteLog allocates those devices only for the duration of a transmission, and only one program is going to transmit at a time.

Subreceiver audio

This button is useful if your radio has stereo output with the subreceiver audio always on the Right channel, but is silent if the subreceiver is off. (The FT-1000MP constant-level rear panel audio jack is an example.) With Auto detect subreceiver audio turned on, WriteLog monitors the signal power in the right audio channel and if its very low compared to the left, WriteLog duplicates the left channel to the right so you hear the main receiver in both ears rather than silence in your right ear when the subreceiver is off. You can tweak WriteLog’s power detection parameters in writelog.ini.

Test your setup

The Test button brings up this dialog.

OneSoundBoardPerRadioTest.png

Click on any check box and the Test dialog routes audio from the input device specified by the row to the output device specified by the column. Any audio that is flowing when you move a slider (i.e. if you have any check box on) then the WriteLog audio flow is immediately adjusted to use that changed slide value. You can hear if there is a problem.

The Shared Mode Rates displayed are diagnostic. It simplifies experimenting with setup changes if you use the Windows “Playback devices” and “Recording devices” control panels to set all the sound devices used by WriteLog all to one shared-mode sample rate. Making them match avoids the “no compatible format” messages on attempts to route audio from a capture device to a playback device. WriteLog can internally do some format conversions; those that involve interpolating or decimating sample rates that are a small integer factor of each other.

For all the sliders, moving all the way to the left gets WriteLog’s internal default, which is for minimum latency. There are devices, however, that WriteLog might service fast enough on your PC hardware to avoid distortion. Sliding to the right extends the buffering (which also increases delay) and will help reduce audible artifacts that can happen when, for example, WriteLog switches audio between Split and Normal. WriteLog needs to be enough audio in memory to fade out the old channel and fade in the new one on a given ear. Lower buffering reduces the delay, but also reduces the time available to accomplish those fades. A faster fade gives a louder artifact.

WriteLog cannot change the Shared Mode Rate for a device. Instead, use the Windows Control Panel, Sounds. Go to the Recording taband find the “Advanced” setting. While there, if you are considering the device for receiver audio, also note if the number of channels is 1 (monophonic). With only one channel, monophonic input, a dual-receive radio feature will be missing from WriteLog. WriteLog needs two channel decoding from the sound board in order to route the main receiver into the Left headphone and the subreceiver into the Right headphone.

Tuning for minimum latency

For devices allocated in Shared Mode, most of the performance parameters are built into the Windows audio engine. WriteLog has no tuning parameters for Recording Shared Mode devices (which is WriteLog’s default for your receiver audio.) It has these two tuning parameters for Playback Shared Mode Devices: the minimum and maximum buffered audio length in milliseconds. Those two are displayed as Playback buffer msec.

For devices allocated in Exclusive Mode WriteLog uses the same Playback buffer msec max setting as for Shared Mode to determine the overall buffer length it maintains on a playback device. For each Exclusive mode device there is a second parameter: the size of the buffer used to transact audio with the sound board device driver. They are called capture buffers for a recording device, playback buffers for a playback device. The device driver specifies a minimum size (corresponding to minimum latency) but that small size means WriteLog has to service the device more often, which might require more CPU cycles than available. The slider controls labeled Capture buffers and Playback buffers direct the WriteLog to use larger buffers, but that increases latency.

The range of buffer size is a multiple from one through five of the minimum buffer size. The leftmost position of each bar gives the least buffering (and least latency) but some sound devices cannot run reliably at their minimum latency setting. Move the slider to the right if the audio output is distored.

This Test panel routes the audio immediately on clicking any of the the check boxes. Click the Both button under phones and on the Mic row, for example, to route mic audio to the headphones and hear the result in real time. For the left and right receiver audio devices, the same test works: just route the left or right receive audio to your headphones and adjust the slider bars to the left for low latency, and move them to the right if you get distortion.

If you hear distortion using this Test panel, it is not immediately obvious whether the problem is coming from the Record side or the Playback side. You have to try moving the sliders for each.

For the audio devices labeled Xmt, you probably don’t hear the audio directly from this test dialog although this panel routes the audio to the appropriate device as soon as you click the check box. You’ll need to plug headphones into the appropriate sound output, in order to listen to the playback device under test.

The button in the lower right changes its label to show diagnostic metrics for your settings as you click it. Click on the Shared Mode Rates button to cycle the dialog labels through the list of rates (48000 Hz) in the example above, the Buffer Frame Count, and the Initialized Period as displayed here. The buffer size displays are zero until the device is activated by clicking one of the check boxes.

OneSoundBoardPerRadioBufferFrameCount

The Buffer Frame Count is the number of samples in a single sound device buffer. The Windows driver for the sound board sets the minimum size of the buffer (selected by the left-most slider setting). WriteLog can only increase the size in integer multiples of the driver’s minimum.

OneSoundBoardPerRadioPeriod

The Initialized Period is defined to be the Buffer Frame count devided by the sample rate. However, WriteLog simply displays here what the sound board driver says its period is, in micro seconds.