CHANGSTAR: Audiophile Headphone Reviews and Early 90s Style BBS

Lobby => DIY => Topic started by: AstralStorm on July 15, 2013, 06:57:12 AM

Title: Advanced Crossfeed DSP
Post by: AstralStorm on July 15, 2013, 06:57:12 AM
I've decided to post a thread here in order to have your input on whether you like the home-made advanced crossfeed DSP written by yours truly.
Theme song: Project Pitchfork - Timekiller (http://www.youtube.com/watch?v=rY9eSzB-KbU) (Note: reissue is terribly compressed. :sadpanda: )


This crossfeed is special, as it is probably the only one that's linear for mono signals. (As linear as linear-phase FIR gets.)
Zero combing is possible for mono signals and it should be vastly lower for side signals as well thanks to phase linearity.

Based on an idea presented by Jan Meier in an offhand form here:
http://www.meier-audio.homepage.t-online.de/crossfeed.htm

Corda amps actually wing it, since they use passive filters and thus have phase issues, especially in mid/side splitting circuitry.
This one does not, so inverse phase signals are properly localized as well.
The defaults were tuned by ear for my head.

Currently it's available both in source code form, VST form (requires host to have its own controls, it doesn't have GUI) and Linux LV2, LADSPA; and Jack application forms, with either Qt, GTK UI or Windows UI. Yes, Jack works in Windows too. Some others are also possible on request.

The advanced crossfeed has been written in a computer language made by Julius O. Smith III (of Yamaha fame) and later enhanced by some other people. It is called Faust and compiles to various output plugins.

Source code is attached, feel free to mention any improvements you see fit. It's not recommended to patch the C++ code by hand, as it is generated from Faust.
I built it in Linux using MinGW with special options. It is a 32-bit VST dll, like most of them, and works well in Wine, e.g. George Yohng's VST bridge for Foobar2000.

Can't wait for your impressions and suggestions.
Title: Re: Advanced Crossfeed DSP
Post by: PelPix on July 15, 2013, 07:14:14 AM
Looking forward to testing this!  Let's see how it stacks up to hardware crossfeed and bs2b (which cites the same link by Meier and also says it's is as close as possible to linear phase)

Edit:

I like it!  Very natural.  Settings were quick to change to my ear layout and tastes!  Overall, great plugin.  No bugs to report, either!
Title: Re: Advanced Crossfeed DSP
Post by: ultrabike on July 15, 2013, 08:10:45 AM
From quick impressions default settings seem to move sound to the front relative to what I hear without it. The controls are also responsive. Good job!

(http://farm8.staticflickr.com/7282/9291717248_6f269c8b2b_c.jpg)

Didn't know about Faust. Looks like a cool route to make VST stuff. Code definitively looks weird.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 15, 2013, 08:22:19 AM
Looking forward to testing this!  Let's see how it stacks up to hardware crossfeed and bs2b (which cites the same link by Meier and also says it's is as close as possible to linear phase)

This is true, it's as close as possible given its design - in that it uses minimum phase first order IIR filters, that gives 60 degree phase shift at bass.
BS2b implements a Chu Moy's crossfeed - like Meier's first one published on Headroom, except with compensatory highs boost.

The first order IIR filters cause a bass boost and mild subbass distortion, as well as a relatively shallow wide dip in the knee range (depending on crossfeed frequency) in the central signal plus very minor high frequency combing.
The inverted bass cut is both due to the phase shift and requirement for more aggressive feeding due to lack of real ITD simulation - the filter delay acts as one and it's very short. BS2b doesn't specifically feed higher frequencies at all either, only the bass, but the IIR filter used has very low stopband rejection due to being first order, so a tiny amount of feeding is present.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 15, 2013, 08:59:19 AM
Didn't know about Faust. Looks like a cool route to make VST stuff. Code definitively looks weird.

Not just VST, it has many "architecture" files. Including a command line application.
The language isn't precisely well known due to being quite new and very domain-specific. It feels in writing like Verilog for audio - you're designing a simplified electrical circuit in textual flow form with some math sprinkled on top.
PureData (also known as Pure) is slightly more widely known - it uses graphical flow forms, but does not have as nice UI and generator capabilities or C bindings. And of older ones, Max/MSP, which is more general and includes control and visuals, is commercial thus has a higher barrier of entry.

The main issue with it is that it's almost purely functional - there are very few stateful facilities (like a mutable buffer) and this makes some things look quite awkward.
Also makes some major algorithms unavailable except by C binding, which works excellent. There's also no support for oversampling yet, but there's work being done in this regard.
Of major unavailable algorithms, resampling or FFT is not possible, neither is thus fast convolution. There's no stdio or direct file access either. For those, C has to be used.
String handling is nonexistent - only very limited numeric substitution.

UIs are relatively spartan too, no nice controls like a spectrum analyzer or oscilloscope are included, but the basic buttons, checkboxes, entry fields, sliders and knobs are there. Of display controls, VU meters and LED are available.
Title: Re: Advanced Crossfeed DSP
Post by: ultrabike on July 15, 2013, 10:04:29 AM
This crossfeed is special, as it is probably the only one that's linear for mono signals. (As linear as linear-phase FIR gets.)
Zero combing is possible for mono signals and it should be vastly lower for side signals as well thanks to phase linearity.

The link looks interesting. Not sure if this is what they (CORDA guys) do, but I guess one could generate a left, center, right, or more channels from stereo, and use a different crossfeed approach for each (like almost-no or no crossfeed to the center channel).

Sorry, not sure what you mean by "...inverse phase signals are properly localized..." What inverse phase signals you mean?

This is true, it's as close as possible given its design - in that it uses minimum phase first order IIR filters, that gives 60 degree phase shift at bass.

From quick monkeying around, I think the phase shift depends on the location of the pole and the zeros. I think a lone pole at say 0.05 would give less than 3 degrees of phase shift. A lone pole closer to the unit circle, say 0.95, might result in more than 70 degrees (mostly at the stop band though). As a sanity check, a pole at 0 means no pole and therefore no phase shifts.

First order IIRs are sort of crude, but dunno if they are more than enough for crossfeed design.

The "standard crossfeed" (Meier link) seems to use a pole around 0.85 (or above) with about 60 degrees of phase shift of HF relative to LF. The "extended crossfeed" probably uses a pole around 0.5 (or maybe less) with about 30 degrees of phase shift...   

BS2b implements a Chu Moy's crossfeed - like Meier's first one published on Headroom, except with compensatory highs boost.

The first order IIR filters cause a bass boost and mild subbass distortion, as well as a relatively shallow wide dip in the knee range (depending on crossfeed frequency) in the central signal plus very minor high frequency combing.
The inverted bass cut is both due to the phase shift and requirement for more aggressive feeding due to lack of real ITD simulation - the filter delay acts as one and it's very short. BS2b doesn't specifically feed higher frequencies at all either, only the bass, but the IIR filter used has very low stopband rejection due to being first order, so a tiny amount of feeding is present.

A first order low-pass IIR should act as a clumsy bass boost deal but shouldn't cause subbass issues or combing on its own... Do you mean after left and right channel combination?

Not just VST, it has many "architecture" files. Including a command line application.
The language isn't precisely well known due to being quite new and very domain-specific. It feels in writing like Verilog for audio - you're designing a simplified electrical circuit in textual flow form with some math sprinkled on top.

The main issue with it is that it's almost purely functional - there are very few stateful facilities (like a mutable buffer) and this makes some things look quite awkward.
Also makes some major algorithms unavailable except by C binding, which works excellent. There's also no support for oversampling yet, but there's work being done in this regard.
Of major unavailable algorithms, resampling or FFT is not possible, neither is thus fast convolution. There's no stdio or direct file access either. For those, C has to be used.
String handling is nonexistent - only very limited numeric substitution.

UIs are relatively spartan too, no nice controls like a spectrum analyzer or oscilloscope are included, but the basic buttons, checkboxes, entry fields, sliders and knobs are there. Of display controls, VU meters and LED are available.

 :'(
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 15, 2013, 10:14:24 AM
A first order low-pass IIR should act as a clumsy bass boost deal but shouldn't cause subbass issues or combing on its own... Do you mean after left and right channel combination?

Direct form IIR faces some coefficient quantization issues at low frequencies, made worse by the division. in BS2b, this is relatively small, but can be audible if you boost the subbass some dB.
Instead, ladder form should have been used. Or if there's some saturation bits left, normalized ladder form with transformers. Alternatively, internal double precision.

The bass boost is due to the crossfeed itself and is not that large, this happens after channel combination.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 15, 2013, 07:16:09 PM
This crossfeed is special, as it is probably the only one that's linear for mono signals. (As linear as linear-phase FIR gets.)
Zero combing is possible for mono signals and it should be vastly lower for side signals as well thanks to phase linearity.

The link looks interesting. Not sure if this is what they (CORDA guys) do, but I guess one could generate a left, center, right, or more channels from stereo, and use a different crossfeed approach for each (like almost-no or no crossfeed to the center channel).

That's because they cannot write a crossfeed that handles front correctly?  ::) Mine doesn't do anything comb-like to the centered signal, other than perhaps increasing the volume and not crossing it.

For surround sound their approach can partially work. However, it's mostly ITD difference, different feed thresholds and different HRTF - especially the latter is beyond crossfeed... It's easy enough to do front-rear, but not more than this with crossfeed approach only.

Quote (selected)
Sorry, not sure what you mean by "...inverse phase signals are properly localized..." What inverse phase signals you mean?

Where one channel and the other are playing similar signal, but inverted phase. This is typically used for a cheap "wide stereo" effect.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on July 17, 2013, 01:52:44 PM
Tragic this doesn't work with yegor's wrapper
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 17, 2013, 01:56:37 PM
To make it work there, I would have to implement a faust architecture file for VSTs that provides UI.
Time consuming. The VST host should supply a generated interface if none is present. Yegor's does not.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on July 17, 2013, 02:55:57 PM
I just ran your crossfeed through a vst analyser and it revealed a smooth response up to 10khz with a grad rolloff to -10db at 20khz
B2SB has a a low pass that varies with cutoff freq, also relatively smooth
Crossfeeds such as headfit, isone and xnor's xfeed all exhibit a series of dips starting around 2~3khz.
Why are they different from b2sb and yours?
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 17, 2013, 06:10:55 PM
bs2b doesn't comb, but it has one or two dips in the center signal, around the knee frequency and twice it.
The other crossfeeds use FIR filters and do not compensate for delay. The center signal is mixed with a delayed version of itself, which causes comb filtering - the same effect is used in many flangers.
Mine has the delay compensated - the "dry" signal is also delayed the right amount. This small amount of delay should not be problematic. (80 samples, half the filter order)

This crossfeed shouldn't have any high end lowpass or anything - care to show me the output of the spectrum analyzer you used?
Did you use uncorrelated noise? if that's the case then yes, you will get some lowpass due to the side signals being mixed in.
Title: Re: Advanced Crossfeed DSP
Post by: donunus on July 17, 2013, 11:24:59 PM
This plugin doesn't work with vst for some reason. I tried it with jriver
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on July 18, 2013, 01:16:23 AM
This is an image of the frequency and phase responses of B2sb, Advanced crossfeed, Headfit respectively
http://i.imgur.com/Kvxtbwb.jpg?1
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 18, 2013, 03:28:01 AM
Ok, that was 4th order Lagrange-interpolated fractional delay messing things up. Setting it to 5 or 3 fixes amplitude and phase.  :)p5
Also removed unnecessary fractional delay offset - I've misunderstood one of the descriptions. Only Thiran allpass-interpolated delay needs an offset, and a much larger one.
I'll release a corrected version soon, once I measure with a less clunky tool than Baudline.

According to Baudline, phase is linear as is amplitude and the measurement works, as there's an 80+ sample group delay. I get sawtooth in phase (looks more like blips) when I enable the antialiasing on input.

I'll measure using REW, as it produces nice graphs.
Edit: Attached. The measurement is correct, as shown by the IR - it looks like a Kaiser-windowed signal, which it is.
Its builtin image tool doesn't work, so screenshots it is.

Whoops, measured up to 200 Hz. Fixed!

Links:
http://www.baudline.com/index.html
http://www.hometheatershack.com/roomeq/

dounus: Doesn't work, or doesn't have a configuration UI? Not working would be a bug either on their end or less likely here, while lack of UI is an issue on their end - a VST host should synthesize UI when none is present.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 18, 2013, 04:20:14 AM
New version, should fix at least the frequency response, probably more. No need to tweak the settings.

More variants available on request, such as Jack Audio Connection Kit app for Windows, CoreAudio sources or v3 VST.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on July 18, 2013, 04:38:34 AM
Thanks for that  :)p1
Title: Re: Advanced Crossfeed DSP
Post by: firev1 on July 18, 2013, 04:52:57 AM
Ok, that was 4th order Lagrange-interpolated fractional delay messing things up. Setting it to 5 or 3 fixes amplitude and phase.  :)p5
Also removed unnecessary fractional delay offset - I've misunderstood one of the descriptions. Only Thiran allpass-interpolated delay needs an offset, and a much larger one.
I'll release a corrected version soon, once I measure with a less clunky tool than Baudline.

According to Baudline, phase is linear as is amplitude and the measurement works, as there's an 80+ sample group delay. I get sawtooth in phase (looks more like blips) when I enable the antialiasing on input.

I'll measure using REW, as it produces nice graphs.
Edit: Attached. The measurement is correct, as shown by the IR - it looks like a Kaiser-windowed signal, which it is.
Its builtin image tool doesn't work, so screenshots it is.

Whoops, measured up to 200 Hz. Fixed!

Links:
http://www.baudline.com/index.html
http://www.hometheatershack.com/roomeq/

dounus: Doesn't work, or doesn't have a configuration UI? Not working would be a bug either on their end or less likely here, while lack of UI is an issue on their end - a VST host should synthesize UI when none is present.

Does not work with JRMC at all(shows a failed installation message. Need to test it in Audition, which should work.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on July 18, 2013, 04:58:11 AM
Perhaps JMRC requires the plugin to have GUI. Could happen.

Pity REW doesn't have crosstalk measurements. I'll have to wing them.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 05, 2013, 04:13:30 PM
Ok, I'll be implementing a version with a different, parabolic mid/side scheme, where if the side signals are in opposite phase or near it, they won't crossfed.

This should be the ultimate fix against the inverse phase issue - as in inverse phase signal disappearing due to cancellation. (Currently it disappears perfectly, unlike in BS2b, where it disappeared in a peaky way.)
In real speakers that doesn't happen for side signals, only the center ones.

Further improvements will involve simulating a speaker's polar response and more advanced crossfeed equalization (not a single bank), as I now have an access to a good mechanical FEM model of the head and can reduce it to a few non-linear-phase filters. (not minimum phase)
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 06, 2013, 08:50:07 AM
Here's the new version with a changed function for mid-side mapping.
Now it doesn't make inverted tracks sound like they're in a barrel.
The soundstage has a more correct shape as well.

Not validated for linearity, but should be, as the equalization and delays are unchanged.

You will have to adjust the Center Focus control up. The default is now 50, but I personally like 80 more.
I will add a GTK+ (for Windows) UI soon enough for all those waiting with baited breath.
Center Focus == 1 is broken, working on it.

Waiting for comments on this version.

Theme song is now: Magnus "SoulEye" PĂ„lsson - [PPPPPP] 02 - presenting vvvvvv
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 06, 2013, 11:01:28 AM
Another edition with a new control called Directionality, which kinda governs how much the speakers are toed in and spread. High values will turn the speakers almost into headphones. Zero is almost the old behavior with the inverse phase correction.

It's not really percent, but I forgot to change it to "exponent". I have to put an antilog there to make it linear.
This equation emulates the rotation of the speakers over a half-circle very well.

The mid and side equations are fixed to not "clip" - it was actually dropouts, not clipping.

Sounds much more like an incremental improvement over the previous one. Mainly much less 3-blob effect and no "barrel" sound on inverted phase tracks.

Dedicated to sucky mixes like this one: Megadeth - [Peace Sells...But Who's Buying? (Remastered) #11] Peace Sells (Randy Burns Mix)
And also good hard panned music like this: Clutch - [Jam Room #10] Release the Kraken

EDIT: Updated defaults.

A different setup simulating more of a near field monitor feel, would be like on the attached pic. Highly recommended, I'm considering switching the default to this.

The next "preset" simulates an anechoic chamber. Extremely analytic, but will work very well after adding some reverb. Also preserves almost all bass slam. (Updated cutoff frequency. Was too low, which made certain guitars fly off the scene.)
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 06, 2013, 05:25:16 PM
Bugfix release: messed up the now non-symmetric mid function for the right channel inverted sound. Hard to hear, but fixed now.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 06, 2013, 11:29:10 PM
Comments: the anechoic preset sounds (spatially) like very near field speakers, not just anechoic chamber. Very similar spatially to my local desktop 70 W RMS Unitra Tonsil Space '86 non-bass reflex 3-ways, 60 degrees spread, 1.25m from center of head. In fact, has better subbass on these Sony MH1 IEMs (but worse highs).
That without eq; I don't have the eq curve on me for the modded version. They're not perfectly linear of course, just reasonably neutral with subbass boost.

The speakers start to roll at 60 Hz (-3 dB), but extension up is impeccable and neutrality is top notch, within 2 dB, no wide peaks or combing. Could be improved further by polyfill replacement and fixing the old suspension, which worsens bass THD somewhat I bet. Very fast and controlled sound, like many closed box designs.
They look like this: http://archiwumallegro.pl/unikat_czarne_unitra_tonsil_space_86_oryginal-1023345693.html

Superb polyamide tweeters. Mids are good, bass is decent. My pair doesn't have the domes damaged, but instead the woofer suspension got worn. HDF front, plywood sides, thick LDF back. Woven fabric low density fill inside. Mine were also extra hot glue sealed.
Front cover is poo and rolls off the extension up - it is also rather unnecessary, unless you have small kids around. I've been guilty of putting my fingers once or twice into the domes - they're stiff polyamide foil. Mids and bass are heavily processed lacquered cellulose.

Crossover is 2nd order Butterworth symmetric, not sure about frequencies. As this is a late, improved cross model, I'd bet on 1.5k and 4.5k crosses. (If not, I'd fix them to this.)

Bass: Tonsil GDN 20/40/14
http://www.e-tonsil.pl/index.php?p45,gdn-20-40-14
Mids: Tonsil GDM 10/60/4
http://www.e-tonsil.pl/index.php?p63,gdm-10-60-4
Highs: Tonsil GDWK 7/50/19
http://www.e-tonsil.pl/index.php?p76,gdwk-7-50-19

All are still being made by Tonsil and used now in "mid-range" low power stage monitors.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 15, 2013, 10:30:52 PM
Ok, this v3 is broken. As in, it has huge amounts of nonlinear distortion for central signals. :gross:
I cannot use a nonlinear transform in the linear signal space. I've checked out some simple polar transform and it worked quite well for moving the sound source around, with some tweaking that could do for v4. I can apply any nonlinear function in that space and the signal does not get any change of magnitude.
The problematic part is keeping mono signals linear phase.

I will rerelease v2 with a different center control scheme first, easier to understand.
Just so you know, the values for the time delay should be on the order of 140-240 us for a typical head and typical speaker angles.
I can change this to angle + head width control instead if you prefer.

The improved control scheme makes my most realistic preset sound like a high quality speaker setup in an anechoic chamber. Specifically, there's some degree of front-back confusion which is not possible to fix without introducing faux reverberation or head tracking.

One thing with v2 is that inverse phase signals do not get the center boost and will sound quieter. I'm sure this is the correct behavior - speakers also cut such inverse phase signal - but I really get reports that it cuts bass too much on some tracks - which it does like any crossfeed. Some people probably forgot how speakers sound.
Title: Re: Advanced Crossfeed DSP
Post by: donunus on August 16, 2013, 11:02:59 AM
so what is the best version with the most realistic sounding default setting that i can try right now? Can you give us a link?
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 17, 2013, 04:44:44 PM
New version. Still called v3, because the previous one was terrible. Feel free to ignore the old one.

Changes:
- Reverted to previous (v2) mid-side handling. Newer one was terrible with regards to nonlinear distortion.
- Added "Bypass" functionality for simple AB testing.
- New control scheme for ITD, hopefully much easier to use and understand. Uses Lord Rayleigh's spherical head approximation, but fine tuning is also available.
Tuning seems unnecessary for lower speaker spread angles.
- Changed center focus to center boost. Typical speaker setups have less than 6 dB center summing due to directionality and other imperfections. Typical pan-pots use 3 dB summing law. The defaults simulate a good setup, 4.5 dB center summing.
- New and improved defaults.

TODO:
- Maybe try polar panning instead of ITD panning?
- Maybe try to implement a distance control. Would require settings for humidity, temperature and another lowpass filter. Of course, this control would affect center sound, by design.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on August 18, 2013, 04:47:33 AM
A suggestion for an added feature:

Could you add a left/right toggle?
You could turn off the right channel so the left is isolated for crossfeed proccesing for easier tweaking.
That way you could tweak the "left speaker" emulated and compare with a real left speaker easily.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 18, 2013, 09:40:08 PM
I'll add a balance control, that should be more useful in case someone has a broken pair of headphones or IEMs; or has uneven seal. You could set the balance to one side only for tweaking purposes.

The next step is implementing a specialized UI. I'm considering a few options, but it'll likely be using wxWidgets for portability.
It will take a while to properly implement.
Title: Re: Advanced Crossfeed DSP
Post by: poladise on August 21, 2013, 03:04:13 PM
Tried the latest adv_xfeed_v3. Excellent work. Best crossfeed plug I've heard, but is there any way of editing the default parameters before it loads? I use the VST adapter for foobar and it loads and applies your plugin, but cant display a GUI.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on August 21, 2013, 03:17:05 PM
There will be for all hosts once I've written the target UI. (Designed for e-paper displays, not too spiffy.)
This might also include a Foobar2000 native DSP.

For now, you need a host which provides the GUI. For foobar2000, George Yohng's host works.
Linky: http://www.yohng.com/software/foobarvst.html
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on November 11, 2013, 05:04:12 PM
Here's some sneak peek of the new version, using lots of FFT, UI designed for touch access and a tiny LCD screen.
(targetting 480x244 px at 4", resistive touchscreen)

About Simple screen - the icons are placeholders and that display will be draggable. The list will contain typical reverb types.
About Eq screen: the dotted fields will contain a nice draggable-touchable curve (incl. scrollbars most likely, I'm thinking on how to implement zoom) and the list will have some operations to apply to the graph, like smoothing, sharpening, reducing to only negative dBFS, reset, copy and so on.
The checkboxes are tristates - you can enable, disable or use an automatically derived eq. (either an average or a copy of the other side)

The app will have true distance computation, but I'm wondering if I should expose the silly things like temperature and humidity, which do affect the sound at higher distances.

All of this will be written in Python - w/ Cython, Numpy, Scipy, perhaps Matplotlib, PyMusic (for Portaudio) and perhaps some ctypes VST wrapper like PyVST or my own in Cython.
Not Faust anymore, as it's more suckage than it's worth and nobody knows it anyway.
I haven't decided on the reverb engine, we'll see after I have some performance figures. Might be block-based convolution reverb even where you can provide your own IR samples. Full HRIR upload is not excluded either.

ITD will also be FFT-based with frequency-dependent fractional delay, filter designed using least squares for each band separately. (minmax gives wiggles and is way harder to write)
Thinking 256-point FFT is enough, block-based to reduce delay to 32 samples even.
Probably 32-bit float computation only, due to ARM NEON/Intel SSE limitations - I'll probably have to write a bunch of ops in C or assembly anyway to speed up numpy and scipy.
Title: Re: Advanced Crossfeed DSP
Post by: slaine on November 24, 2013, 02:54:03 AM
This looks very promising. Does this mean we can you the other VST plugin for foobar rather than George Yohng's?

Looking forward to seeing if this results in a more realistic stereo effect! Thanks.
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on November 24, 2013, 09:24:23 AM
Yes, though VST is not the primary target as of first release, I'll add the support.
(JACK is the primary target, you can make that work in Windows system-wide too. There's also ASIO to JACK bridge, so it can be used in any ASIO-supporting application, such as VSTHost.)

The tricky part will be making it not look like poo on Windows, since it's GTK+ 3.
I'm not sure if the center channel should be separately equalizable and am considering replacing that with a balance control instead. What do you think?

I'll also need nice reverb stereo impulse responses. Right now I can use the "Hamburg home" freely available ones, but I'm not sure about bundling them - will add some free TAP Reverb generated ones at the very least.

The trickiest part right now is implementing Mel-weighted least squares for the EQ and ITD, drawing that and dragging the curve along. I also have to add a biquad-alike to make it simpler to use given limited input on the target mobile device and if using keyboard. (I have 4 to 7 physical buttons but also a touchscreen - except touchscreen is terrible for fine adjustments.) The actual derived eq will be drawn as well, as it does not have to necessarily exactly match what you have drawn for various mathematical reasons.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on December 22, 2013, 11:25:03 PM
The GUI is coming along nicely, how's the progress going?
Judging from the screenshots, is this being designed as an iOS/android app?

About the true distance computation, are you referring to modelling:
-   Distance signal delay by speed of sound
-   Distance gain loss
-   Absorption of high-frequencies in air
-   Stereo width manipulation
-   Distance based early reflections
(http://www.tokyodawn.net/proximity/)


Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on December 23, 2013, 10:14:37 PM
The progress is slow, since I had a hard crunch at work. (Related field too, so I do not exactly like to work on it after hours.) It will get done though, there's nonzero progress.

I'm currently trying to implement a good enough algorithm for (approximate) linear phase equalization.
It will either be plain FFT (or probably even sliding DFT) graphic equalizer with time delay equalization, synthesized least squares FFT/sliding DFT or non-uniform FFT with optimized band choices.
If you know how to make NUDFT sliding in O(N) sense, I'd love to hear about it.

First I tried IIR optimization for given time domain and frequency domain results, but this turned to be impossible - two of the algorithms produced unstable or acausal results in specific conditions.

The other problem was that there is no way to make the UI work with a small screen and a required large number of bands for direct input even with a touchscreen, so I want to do it with cosine-shaped parametric bands.
(Cosine is better for NUFFT, but theoretically anything can be used for least-squares, including biquads.)
This also needs some work for real time plotting, I've almost figured that part out.

By distance I meant:
- air frequency absorption (essentially an equalizer)
- crossfeed and ITD (larger distance = different feeding)
- stereo width (lower)

Maybe:
- early and diffuse reflections in case of synthetic reverberation, but the plan was to use captured IRs instead

Gain loss is unnecessary to tune I think and hard to do so, unless you have SPL-calibrated headphones.
That's why there's a separate gain knob.
The distance assumes that default position is binaural - this has to be tuned by the user, as weirdly equalized headphones can mess this up.

The advanced screens have additional tunables, e.g. separate humidity (controlling HF absorption), temperature (controlling speed of sound), ability to load any complex or real HRIR (4-channel), directly tweakable interaural time delay curves.

I will also need to figure out a way to make those more advanced settings usable for a layman, perhaps via some kind of wizard for equalization and ITD tuning.
Title: Re: Advanced Crossfeed DSP
Post by: happywheels on December 24, 2013, 01:38:21 AM
What was the rationale behind deciding to use linear-phase eq rather than a minimum phase eq?

I have found that with laymen, sine-wave testing is a no go... they find it very fatiguing and excruciating when the headphones have terrible peaks. When you try to fix the peak, they say 'oh when i listen to music it sounds fine'.

More often then not, even when they decide to equalize, the results are not that great and sometimes downright wrong.
I would recommend hiding the equalizer from the normal user.

Like you said, for the ITD tuning you could do a simple wizard, "move the sound until it sounds like its coming from 45deg etc".
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on December 25, 2013, 10:03:53 AM
By minimum phase you mean constant minimum phase FFT, yes? Otherwise, IIR phase discontinuities interfere with ITD, causing cancellation artifacts and phase reversal in bass, breaking some kinds of electronic music.
I could do minimum phase FFT, but I'm not sure it is any better - perhaps optimized preringing FFT, so 66% postringing FFT.
Do remember that headphones are minimum phase themselves, so it's better to not have to much additional postringing.
The effect is nearly inaudible anyway.

Direct equalization is part of advanced options, you know. It is 4-channel. I'm considering breaking up the app into multiple windows at this point. The simple ones will be for the selector/wizards and simple spatial and reverb controls.

The real way of tuning EQ for users would be a list of headphones, assuming good quality control and measurement conditions, the results should be good. Only minor additional tuning should be necessary.

Wizard-like tuning also works - I've seen Samsung do something like this with AdaptSound - you get a series of sine tones that should be equal loudness - the problem with that specific implementation is low resolution, but if we know the headphone in question, it is easy to pick the critical bands requiring tuning for a fast tuneup.

Obviously, 3k-8k region is the most important for spatial positioning. And instead of sine tones, which are very annoying in this range, I can use medium-Q bandlimited noise.
Peak width and position searching could be also done with slow exponential sweeps, asking the user to click a button when the tone gets louder or quieter than comparison tone - of course it takes a relatively long time, but then the results are much better. First run rough EQ, then refine the peaks.

I might consider also doing SPL "calibration" by using binaural samples and channel imbalance correction. (Stereo equalization is excellent for imaging and simple most of the time.)
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on December 25, 2013, 01:56:10 PM
A suggestion for an added feature:

Could you add a left/right toggle?
You could turn off the right channel so the left is isolated for crossfeed proccesing for easier tweaking.
That way you could tweak the "left speaker" emulated and compare with a real left speaker easily.

Oh, I forgot about this feature, I'll add such an option in the advanced settings of the new version.

Now then, the wizard will just do about that, after channel balance correction, it will ask you to place the source first in front - then at the "right" angle for 60 degrees and symmetric.
Title: Re: Advanced Crossfeed DSP
Post by: datder on December 28, 2014, 07:03:04 PM
 :-DD Any updates on this Astral?
Title: Re: Advanced Crossfeed DSP
Post by: AstralStorm on December 29, 2014, 12:20:31 PM
Not yet, got really busy with my job and frankly forgot to add the twiddles. I'll add them and do a full rerelease incl. better documentation. (directional pattern, resonance/anti-resonance)

The frequency and phase equalizer is being written too - since I cannot trust CAPS fully, as it is single precision and minimum phase only with programmable crossfeed curves - sane defaults off elliptic + cone nose head model.

New engine is done, but UI is not. Currently "available" are adjustable-phase least squares and cepstral minimum phase FIR eqs are in with partitioned convolution. I'll add SQP IIR and optimal IIR (both adjustable phase) in a second.
Title: Re: Advanced Crossfeed DSP
Post by: DooberKnob on March 21, 2015, 05:36:57 AM
Keeping my eye out for the final release. This looks great.
Title: Re: Advanced Crossfeed DSP
Post by: Thad E Ginathom on March 21, 2015, 12:47:13 PM
Just caught up with this thread. Yes, it looks very interesting, and I wonder if AstralStorm will get back to us on this.

I'm a Linux user, usually using DeaDBeeF as my player, either direct to ALSA or through JACK. My second-string player is Aqualung, which  can use LADSPA plugins.

Even although I have Unix systems management experience, that was a long time ago and I am not (and wasn't then) a programmer of any sort beyond a little shell. ./configure, make, and make install is about as far as I go in any serious src directory.