Here you will find a B-Format to UHJ encoder. Input files must be
aiff format, 16 or 24 bit. Output is
a stereo aiff file at 16 or 24 bits.
Dither is added at both output resolutions.
Although the interface is basic, there are a lot of features, such as rotation, "Z-aiming", XY reversal, and detailed clipping detection.
Encoding speed is slow: Approximately 10% of real-time!
(on a 266MHz G3 Mac; 25% on an 800MHz Athlon).
A faster and more versatile version may be forthcoming!
Author: Michael Dunn, Cantares, email@example.com ,
This program is copyright Michael Dunn, Cantares, 2001.
You may use it for free if for personal/experimental purposes,
and/or for releases of up to 50 units total. A credit would be
appreciated, along with a copy of your CD (or ?).
Commercial and higher quantity users MUST contact me to arrange payment (charged on a sliding scale).
You may want to save this HTML file, as it's the only documentation for the program!
Build 34: Improves dither quality slightly, and fixes the Mac AIFF filetype bug. Also, the universal version now works!
Build 35: Accepts any sample frequency, sortof. "Z-aiming". Output filename now derived from input. Enhanced clip reporting. Rotation of soundfield.
Download UHJ Encoder (Mac version)
Download UHJ Encoder (Universal version (works on the Mac too, but doesn't have its Python association or icon...))
1. This program is written in Python. It should run on any machine that
has Python installed. You can find Python for a number of platforms at
The NumPy package is also required. This is typically included in the Mac distribution, but not usually in Windows (and other?) ones, so you'll need to download it separately, from
2. Before running the program, place it in its own directory, along with the 3(4) B-Format source files. The program will search for any files with W, X, or Y (and possibly Z) in their name, so make sure the filenames don't have any of these characters where they shouldn't be. The files it finds will be displayed at startup. The output filename is derived from the W filename.
3. Clipping detection is done by default. Many tracks (if they're not recorded too "hot") will encode at 0dB without clipping. If you've a bunch of tracks you want to keep at the same relative level, encode the loudest one first. If it clips, you can try lower gains until it works, and then use that gain for the remaining tracks too. Then again, clipping is not necessarily such a tragedy, and if you determine that it's happenning in an unimportant area (a non-musical transient, or applause say), you can disable the terminate-on-clip. If you do, a list of times representing blocks where clipping has occured will be displayed.
4. You are given the opportunity to input a W gain factor. On the off-chance you have files where W contains the true acoustic level (B-Format defines W to be 3dB lower than XYZ in terms of absolute acoustic level), you would input -3. Or, you can just use it to adjust for personal preference. Boosting W can result in a warmer, more mono, more ambient sound. Reducing it can make things sound leaner and more directional.
5. If the program seems slower than expected in Windows, close any other DOS windows. On the Mac, it runs fastest when it's the current window.
6. Previously, the sample rate was assumed to be 44.1kHz. Now, the output file is written with the same sample rate as the input. Encoding coefficients are not changed however, but as long as you're close to 44.1 (e.g., 48kHz), the difference in performance will be negligible. Even at 96kHz, you'd simply get degraded encoding quality below 40Hz. And, sample rates lower than 44.1 will scale just fine.
7. I've developed and incorporated a concept I call "Z-aiming". The idea came after I'd made a recording where the mic was located higher than I would have liked. The vertical angle from it to the performers was about 45°. To improve the directional quality of the recording, I thought of two possible solutions. First, the W level could simply be reduced by 3dB (and of course you can easily specify this when running the encoder). This matches it to the reduced X & Y gain at 45°. The problem here is that sounds from a shallower angle will then have excess X & Y level (and probably sound somewhat diffuse). Still, a useful technique in some cases. The second solution I came up with is a bit more powerful, and has been added to the encoder. It lets you specify an aiming angle (use + for above the mic, - for below), and emphasizes response in that direction by mixing Z into W, and adjusting the blend to match the XY levels as above. This is far from perfect, but often an improvement over doing nothing! Again, it suffers from XY pickup in the unwanted directions. All I can say is, try it if you think you need it, and see how it sounds. Since the derivation of this process was partly empirical, specifying a lower than actual angle might also help. You can also use Z-aiming for special effects. For example, aiming into the ceiling to get an ambient, diffuse sound!
Have fun, and let me know your experiences!
© 2001 Cantares