HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: popatr on 2012-07-18 16:17:55

Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2012-07-18 16:17:55
I made this DSP and have been using it for months now to my satisfaction.  So, first off thanks to those who helped me figure some things out: mudlord, foosion, Yegor, and Zao, and others who made SDK, Documentation, and samples.  By no means does their help imply that they like my plugin or much less endorse it!

It is a DSP which is designed to switch effects based on the track being played.

Usage:
Sorry, documentation is not going to be great.  But basically:
1)add the dynamicDSP to your DSP chain.  It can be in among other DSPs, or even have multiple instances of itself in a chain but the way I use it is have a single instance of it as the sole DSP at the top level.
2)select and click configure to bring up the configuration window.
3)Enter a titleformat script in the large textbox at the top of the configure window, or use the one provided.  The script you enter should evaluate to a single word, which is the name of the DSP Chain you want to use for that track.  The titleformat will be run on each track as it is about to be played and provide the switching of chains.  It's OK if this script evaluates to a Chain name which does not exist or blank, in which case no DSP will be applied to that track.
4)enter a DSP chain name in the little textbox to the left of the "Add Chain" button then click that button.  The name will appear in the listbox just above.
5) doubleclick the chain name in the list box to bring up the configuration window for this Named chain.  It is the stock DSP config window, you should be familiar with how to use it.  Add DSPs and configure them, then click ok.
6)repeat steps 4-5 as many times as desired
7)click OK
8)click apply/ok

That's it.  If you use the stock titleformat script, you can just add a custom tag to any track called "TRACKDSP" with the value of the Named Chain you want to use.  When that track is played that chain will activate.

Other people may prefer to evaluate to a chain based on Genre tags or some other scheme which uses tags which already commonly exist in their tracks.  I do not provide any titleformat scripts and it's not a strong area of mine.  Feel free to create and share scripts which you like on this thread.  (That is, if anybody likes this component besides me)

Known Issues / Limitations
This component is sensitive to track changes but has gone to some lengths to avoid using the needstrackchangemark thingy which breaks gapless playback.  To the best of my ability to theorize or detect, gapless playback remains perfect IF the track currently playing and the track that is to follow evaluates to the same chain, or to no chain at all.
BUT, if they evaluate to different chains there is in my tests the tiniest audible dropout between the tracks as the old chain empties and the new chain takes its place.  I don't know how to avoid this so I don't intend to fix it.
A corollary to my decision to avoid needing the needstrackchangemark thingy is that I cannot guarantee that 100% of the samples of a track go through their intended chain.  Some may go through the previous chain so once again this is only an issue if the chain changes.  It was beyond my ability to detect this though.
But the final warning is that if you create a titleformat script which takes too long to evaluate then you could break gapless playback even if the chains do not change.  I have not tested the threshold on this nor do I have any recommendations to offer except to try it and see.  Using the titleformat I provide default, I could detect no flaw in gapless playback on Pink Floyd Dark side of the moon or a white noise sample I made copies of and played back to back.

License
I make no restrictions on what you can do with the the source code or component.

Warrantee/Support
None.  Use at your own risk.  I may consider fixing a bug or two if you find them but I don't spend much time here so if you find something bring it forward fast because I will probably stop visiting this thread regularly in a week or two.

Download
fb2k-component (https://dl.dropboxusercontent.com/u/92066158/foo_dynamicdsp.fb2k-component)
source (https://dl.dropboxusercontent.com/u/92066158/DynamicDSPsource.zip)

Building
A release build is provided in the download above but if you want to build from source, note that you need to download the  boost libraries, specifically releated to boost::bind, and you must add a new include directory to your VC setup.

You also need WTL but I think that's common for foobar components.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: NullString on 2012-07-18 18:06:07
Thanks!! I'll give it a spin
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: romor on 2012-08-16 20:42:37
Thanks for making this component
I needed it to control some misbehaved tracks automatically, and searching this forum seems like a lot of users requested such feature. And there it is
There is also similar possibility with foo_yac (http://www.hydrogenaudio.org/forums/index.php?showtopic=82745) if user doesn't mind creating impulses, which is a bit more involved...

I wanted to use specific setting from certain VST plugin through Yegor's VST component, and guess what - it works perfectly, as saved DSP chain preset remembers even state from "external" VST plugin. Don't know if this is feature of VST component or foobar, i.e. if other VST component will behave like this.

Some notes:
1. Don't drop the archive in component preferences because foobar won't pick the component, rather extract DLL file and drop instead.
2. Something I didn't find intuitive - if I define some chains inside Dynamic DSP, they will be reset if component is removed from foobar DSP chain. Solution  - after defining chain(s) inside Dynamic DSP, save it as foobar DSP chain preset.
3. Gap thingy isn't show stopper for me, but if someone with more knowledge in foobar DSP can assist as source code is provided, it would be even greater

Cheers
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: romor on 2012-08-16 22:46:05
I noticed an issue however with VST component, it's reported here: http://www.hydrogenaudio.org/forums/index....mp;#entry805537 (http://www.hydrogenaudio.org/forums/index.php?showtopic=84947&st=350&p=805537&#entry805537)
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2012-08-20 21:18:13
I noticed an issue however with VST component, it's reported here: http://www.hydrogenaudio.org/forums/index....mp;#entry805537 (http://www.hydrogenaudio.org/forums/index.php?showtopic=84947&st=350&p=805537&#entry805537)


I'll try it, thanks for your report.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2013-03-01 21:55:21
works great  gives some possibilities missing in certain plug ins.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: WilB on 2013-03-01 23:38:27
Since my media files are already replay gained, I find this plug-in useful for loading the EBU R128 Compressor and applying replay gain on the fly selectively for radio streams so that all radio streams and media library tracks are of similar sound level.

The EBU R128 Compressor automatically matches to the ReplayGain standard 89 dB using the standard R-128 algorithm and a reasonable look-ahead. I use a titleformat script of $if($strstr(%path%,'://'),Radio,). The Radio chain contains the EBU R128 Compressor. See also http://www.hydrogenaudio.org/forums/index....=0&p=823073 (http://www.hydrogenaudio.org/forums/index.php?showtopic=99159&st=0&p=823073)
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Dynamic on 2013-03-04 18:45:28
I took the liberty of making WilB's version work for any source without ReplayGain information (which still includes radio streams but also files without RG, such as the Windows 7 sample music MP3 files) and posted it in that other thread, excerpting the key info here.
Code: [Select]
$if($or($strstr(%replaygain_album_gain%,' dB'),$strstr(%replaygain_track_gain%,' dB')),,R128Comp)


I then set up the Chain called R128Comp to contain just the EBU R128 Compressor DSP from mudlord's foo_dsp_effects bundle.

Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Dynamic on 2013-03-06 02:37:53
I made a mistake. In the previous post, it was the EBU R128 Compressor from kode54's foo_r128_norm.dll (http://www.foobar2000.org/components/view/foo_r128norm) that I used. No ReplayGain matched compressor is in foo_dsp_effects bundle.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Dynamic on 2013-03-07 10:34:18
kode54 made a good point about the use of Dynamic DSP in that other thread I referred to.

Normally you should put Dynamic DSP at the top of the list of DSPs so that upon track changes it doesn't force a whole bunch or previous DSPs to flush their buffers (especially those with a 10 second lookahead like kode54's EBU R128 Compressor). There will be certain times that the order is important, though, and it might be necessary to put other DSP first.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2013-04-08 20:29:28
I got small problem with this plugin. I had to reinstall foobar. I kept all configuration files from previous istall and placed them into my new installation. Everything was configured and was working as it was before, except foo_dynamicdsp. It missed all the chains that were added to its configuration dialog. Fortunately I saved them just as regular DSP chains so I could easily import them into foo_dynamicdsp. Anyway I was very baffled when several of my files were playing without shifted playback rate... It took some time to perform investigation... Is it possible that it will be fixed and plugin configuration was fully preserved in some .cfg file?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2013-04-25 21:44:35
I'm gratified to find that some people are finding dynamicDSP useful.  I kept meaning to look into romor's report earlier, but I've just always been so busy.  Now I have a new baby and have even less time.  I wish I could give a more hopeful answer.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2013-04-27 14:31:44
(...) Now I have a new baby and have even less time.  (...)


Hahaha  I can fully understand what you are talking about  . Additionally I got bad news for you - be prepared that within next several years you'll have less and less time  . Critical time is when your baby will have around 2 years... Be prepared for war 

For some operations dynamicDSP is the best what could be ever invented. It cuts necessity of creating new components that have very tiny and rarely used functionality (like my proposal of plugin that lets inverse phase of chosen audio channels based on tags) and bothering other developers for adding new functionalities to their components (like my request for mudlord and his dsp_effect/Playback Rate Shift plugin).
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2013-05-01 21:45:57
I found that even changing DSP chain causes that dynamicDSP "forgets" it's configuration... Or removing it from DSP chain...
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Gnx on 2013-05-02 08:50:51
EpicForever, see post #3
Something I didn't find intuitive - if I define some chains inside Dynamic DSP, they will be reset if component is removed from foobar DSP chain. Solution  - after defining chain(s) inside Dynamic DSP, save it as foobar DSP chain preset.


and many thanks to popatr for this component which didn't hope anymore
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Denma Panter on 2013-06-14 00:04:09
I added [Downmix channels to stereo] and [Convert mono to stereo] to this DSP and tried it.
But Those DSP is already like the true bypass.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: pablof on 2013-09-28 17:11:15
I'm gratified to find that some people are finding dynamicDSP useful.

A big thankyou for your plugin, popatr.

I am using it with this script:

Code: [Select]
$if($or($strcmp(%channels%,'stereo'),$strcmp(%channels%,'mono')),SOXEstereo192,SOXMulti96)

...to resample stereo audio to 192Khz and multichannel audio to 96Khz using SoX.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: bdport67 on 2014-01-22 19:45:03
Need some assistance for a basic script for Dynamic dsp.
Not a programmer and cant seem to wrap my head around the scripting language.

I just need a simple script that will run "mp3chain" only on mp3 files.

anyone care to assist?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: BenB on 2014-01-22 21:46:27
You shouldn't need a script. Just add a TRACKDSP tag to your mp3 files with the value of "mp3chain" (or is there some reason you can't use the default script [%trackdsp%]?).
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: d125q on 2014-01-22 22:34:25
Why suggest an additional tag? Just use $if($strcmp(%__codec%,'MP3'),mp3chain)
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: BenB on 2014-01-23 01:15:12
Because it's the default and bdport67 doesn't understand scripting. There's no need to make something more difficult than it has to be.

And, if bdport67 wants to use additional chains in the future, he/she should come ask for scripts for those chains instead of using a simple script (that won't need any future modification whatsoever) that utilizes a tag which can have any value (chain) that's needed?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Rollin on 2014-01-23 13:33:01
I just need a simple script that will run "mp3chain" only on mp3 files.

Titleformat script: [%codec%]
And change chain name from mp3chain to mp3
(http://image.bayimg.com/a811bc77c0b4d97ee7ee58e7f7efce540f5d6892.jpg)
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: bdport67 on 2014-01-23 15:38:17
Thanks guys for the responses.
I will try to get this to work.

My problem it seems is that I dont understand the default scripts.
Im not a programmer or a script writer so Im lost without assistance.

Which you guys provided...thanks much
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: WilB on 2014-03-23 18:54:28
I have just noticed this issue ( http://www.hydrogenaudio.org/forums/index....st&p=861288 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=104379&view=findpost&p=861288) ) which seems to specifically occur when Dynamic DSP is used to load the EBU R128 compressor. In essence playback stops 4 sec from the end of the track if there is no following track. If just the EBU R128 compressor is used alone without Dynamic DSP all seems fine. So it seems the issue is with Dynamic DSP. Any chance of a fix?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2014-04-03 22:25:49
I have just noticed this issue ( http://www.hydrogenaudio.org/forums/index....st&p=861288 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=104379&view=findpost&p=861288) ) which seems to specifically occur when Dynamic DSP is used to load the EBU R128 compressor. In essence playback stops 4 sec from the end of the track if there is no following track. If just the EBU R128 compressor is used alone without Dynamic DSP all seems fine. So it seems the issue is with Dynamic DSP. Any chance of a fix?


I have modified dynamicdsp to better handle EBU R128 and hopefully any other dsp with long buffering.
This new release means I will be looking for you guys to tell me if I've introduced any new problems.  I'll check here pretty frequently for a while.  Unfortunately I didn't/don't have time to handle other requests people have/may make.

To real FB2K developers out there: if enough people care about this plugin you should really make an official component that's better than this one.

Here's it is:
dynamicdsp (https://dl.dropboxusercontent.com/u/92066158/foo_dynamicdsp.fb2k-component)
source (https://dl.dropboxusercontent.com/u/92066158/DynamicDSPsource.zip)

I don't seem to have permission to edit my original post, so I can't fix the links there.  If any admin will do it for me it would be appreciated.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: WilB on 2014-04-03 22:42:08
Thanks for doing this so promptly.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2014-04-04 16:33:12
ps, in the past I have looked into why the component crashes when launched from view/dsp.  I have been unable to figure it out.

The bizarre thing is that when I test with the debugger attached, foobar does not crash, so it doesn't help to step through.  What does happen in debug mode is that the chain configure window comes up blank with no dsps in the chain.  If anyone has insights into the problem this is one issue I'd be very glad to fix.  Although I almost wonder if there is a problem in the framework?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2014-05-01 20:21:08
After using this plugin for some time I need to ask some question about the way it works...
The question is - does Dynamic DSP insert content of its internally configured DSP chain and lefts rest of chain intact or just... replaces whole chain with the one programmed inside Dynamic DSP?

My normal DSP Chain looks like this:
Dynamic DSP
Skip Silence
Downmix multichannel to stereo
Playback Rate Shift - most of time just set to 100% (unaltered playback rate)
Skip Track

Dynamic DSP is used to occasionally change playback rate on selected tracks. I created additional DSP chains that are used for configuring Dynamic DSP plugin. In general they are copies of my normal regular DSP chain with removed Dynamic DSP and adjusted playback rate via Playback Rate Shift plugin. And I started thinking if this isn't source of my occasional problems with Skip Track component. Initially for some reason I thought that this is obvious that Dynamic DSP must fully replace original DSP chain - that's why all chains used by DDSP are nearly copies of my main chain. But now I wonder if don't cause that for some files (tagged to trigger DDSP) my DSP chain looks like this:

Skip Silence
Downmix multichannel to stereo
Playback Rate Shift - set somewhere between 95 and 107%
Skip Track
Skip Silence
Downmix multichannel to stereo
Playback Rate Shift  (unaltered playback rate)
Skip Track

And I don't care for double Playback Rate Shift occurrence but about Skip Silence and especially about Skip Track...

Popatr - your answer, as the creator of this plugin will be much appreciated.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2014-05-02 21:25:18
After using this plugin for some time I need to ask some question about the way it works...
The question is - does Dynamic DSP insert content of its internally configured DSP chain and lefts rest of chain intact or just... replaces whole chain with the one programmed inside Dynamic DSP?

My normal DSP Chain looks like this:
Dynamic DSP
Skip Silence
Downmix multichannel to stereo
Playback Rate Shift - most of time just set to 100% (unaltered playback rate)
Skip Track

Dynamic DSP is used to occasionally change playback rate on selected tracks. I created additional DSP chains that are used for configuring Dynamic DSP plugin. In general they are copies of my normal regular DSP chain with removed Dynamic DSP and adjusted playback rate via Playback Rate Shift plugin. And I started thinking if this isn't source of my occasional problems with Skip Track component. Initially for some reason I thought that this is obvious that Dynamic DSP must fully replace original DSP chain - that's why all chains used by DDSP are nearly copies of my main chain. But now I wonder if don't cause that for some files (tagged to trigger DDSP) my DSP chain looks like this:

Skip Silence
Downmix multichannel to stereo
Playback Rate Shift - set somewhere between 95 and 107%
Skip Track
Skip Silence
Downmix multichannel to stereo
Playback Rate Shift  (unaltered playback rate)
Skip Track

And I don't care for double Playback Rate Shift occurrence but about Skip Silence and especially about Skip Track...

Popatr - your answer, as the creator of this plugin will be much appreciated.


Dynamic DSP does not replace the whole chain.  If I understand your setup, then your illustration of DSP chain with duplicates is a correct understanding of what would happen when dynamic dsp triggers as you have it setup.  How you set it up is up to you, but two ideas come to mind:

Main chain looks like this:
Skip Silence
Downmix multichannel to stereo
DynamicDSP
Skip Track

DynamicDSP setup:
chain named faster:
playback Rate Shift: 107%

chain named slower:
playback rate shift: 97%

In this case Dynamic DSP becomes a playback rate shift AND that's ALL it controls.  Every other effect comes from the normal chain.

ALternate setup:
Main chain looks like this:
DynamicDSP

DynamicDSP Setup:
(titleformat script (forgive psuedocode): if %trackdsp% then %trackdsp% else "Default")

chain named "Default":
Skip Silence
Downmix multichannel to stereo
Skip Track

chain named "Slower":
Skip Silence
Downmix multichannel to stereo
playback rate shift 97%
Skip Track

chain named "faster":
Skip Silence
Downmix multichannel to stereo
playback rate shift 107%
Skip Track

Remember, you can put more than one dynamicDSP in a chain with different jobs.  You can even put dynamicdsp inside itself.
my main chain looks something like this right now:
main effect
main effect
Dynamic DSP <-this one does drastic things to tracks labeled as poorly recorded speech
Dynamic DSP <-this one shifts playback rate
main effect
main effect

The main effects apply to ALL tracks including those which trigger dynamic DSP
The Dynamic DSPs can trigger independently or together depending on how the tracks are tagged.  They each do their own job not knowing what else is going on in the chain.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2014-05-03 09:33:13
Excellent answer !! Thank you !!

EDIT:
I decided to do it in this way:
Code: [Select]
Main chain looks like this:
Skip Silence
Downmix multichannel to stereo
DynamicDSP
Skip Track

DynamicDSP setup:
chain named faster:
playback Rate Shift: 107%

chain named slower:
playback rate shift: 97%

as I need to have quick access to Playback Rate Shift plugin under normal circumstances (not triggered) - for example when I just want to play with playback rate on particular track. Hiding "Default" chain inside Dynamic DSP would be inconvenient in this case. Anyway - that's still great idea of setup.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: wiregrind on 2015-02-26 17:24:05
I've been using this plugin a lot, it's great for automatically setting different low-pass filters to chiptune songs.

I'm basically necro-ing the thread but I'd like to be able to use values like "Less than" in the plugin, for example a chain that is triggered by any song with a Sample Rate Lower than 44100 Hz. I'm not sure if it's possible with the current version, is there any code to make this work?
It would be really useful, because it's hard to edit custom DSP tag info in chiptune / non-standard files.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2015-03-03 16:18:09
I've been using this plugin a lot, it's great for automatically setting different low-pass filters to chiptune songs.

I'm basically necro-ing the thread but I'd like to be able to use values like "Less than" in the plugin, for example a chain that is triggered by any song with a Sample Rate Lower than 44100 Hz. I'm not sure if it's possible with the current version, is there any code to make this work?
It would be really useful, because it's hard to edit custom DSP tag info in chiptune / non-standard files.


$ifgreater(%sameplerate%, 44099, , 'lowratechain')

Put that where you currently see [%trackdsp%]
That should work.  As titleformat lets you do if,then,else etc, you should be able to accomodate very complicated setups.
Here is the titleformat reference:
http://wiki.hydrogenaud.io/index.php?title...25samplerate.25 (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.25samplerate.25)
Dig into that, put on your programmer's hat, and create a script that names the chain you want.  It's possible.  And nobody can tell you exactly what script will serve your purposes except you.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: popatr on 2015-03-03 17:27:55
if you want to use trackdsp tag if present but fall back to samplerate logic, you could do this:

$if2([%trackdsp%],$ifgreater(%samplerate%,44099,,lowbitratechain))

but to reiterate you can do A LOT if you can puzzle it out.  One thing I do, is create a custom playlist column which I title "DSP" and put my dynamicdsp titleformat script as the "pattern".  Actually in my column, I surround my script with - chars because spaces at the beginning and end are unfortunately important, and the - chars help me determine that I've got no trimming issues.  So in the playlist you can see which chain your script names for each song.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2015-04-12 16:31:33
Hi,

I really like this component and I use it for some time now.
Recently, I began to experiment with the source code and added some features that I missed and I decided to share the result with you. I'm a passionate C++ developer, but I'm new to foobar2000 development, so don't expect miracles especially because the SDK documentation is quite limited. I mainly learned from examples provided by the SDK and here in the forum.
My component should be compatible with the original component, so you can just upgrade and all your scripts and chains should continue to work (except if you use the semicolon character in one of your chain names, see below). However, to be safe you may consider to backup your foobar200 AppData directory.

Changes (for users)
- Some GUI improvements (preview text box, added button to copy a DSP chain, ...)

- Added ability to activate more than one DSP chain at the same time by using the semicolon as separator character. For example, if your script evaluates to "Equalizer;Crossfeed", and you have a chain named "Equalizer" and another named "Crossfeed", then both will be applied. The order matters! In the example "Equalizer" will be applied first and "Crossfeed" second.
This feature is optional. You can turn it off, if you want to use the semicolon as regular character again.

- Added ReplayGain Scanner mode that takes a given DSP present into account. The motivation is that if you have different DSPs per track and some of the DSPs change the volume of your track, this may lead to loudness inequalities. With this new mode, you are first prompted to choose a DSP present, then the chosen DSP present will be applied to the tracks before they are forwarded to the build-in ReplayGain Scanner. [Requires ReplayGain Scanner component to be installed] You can access this mode via. the "ReplayGain" context menu > "Scan ... (plus DSP)".

- Updated to latest SDK, therefore requires foobar200 1.3 or later.

- Fixed crash if you call the configuration dialog from "View" > "DSP".*

Changes (for developers)
- Upgraded project to Visual Studio 2013 Update 4 and SDK 2015-01-15
- Replaced boost::bind by std::bind (C++11 feature)

Credits
- popatr for his great component and for sharing the source code.
- kode54 for sharing the source code of his [a href='index.php?showtopic=86404']R128Scan[/a] component from which I borrowed some code [only some GUI mechanics, not the algorithm]

Warranty
None. My component is provided "as-is", use at your own risk. Nevertheless feel free to post about any issues you have with my component.

[a href='index.php?showtopic=108904']Download[/a]

___
*
Quote
ps, in the past I have looked into why the component crashes when launched from view/dsp. I have been unable to figure it out.

If you launch the component from View > DSP, it will run in a different thread (different from the main thread), so you'll need a main_thread_callback for specific functions that will otherwise crash foobar. I had a forum discussion recently about a similar issue: http://www.hydrogenaud.io/forums/index.php?showtopic=108705 (http://www.hydrogenaud.io/forums/index.php?showtopic=108705)
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: eahm on 2015-05-08 18:31:42
Mario66, first of all thank you for the component, I don't use it much but it can be really useful one day.

Second, I don't think you should call it v2, it's not the second version of the same component made by the same developer, it's a mod, a different version. I think "Dynamic DSP Plus or +", "Dynamic DSP Mod" or "Dynamic DSP M66" would work better.

Anyone?
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2015-05-09 13:10:52
You are right. "Dynamic DSP Mod" would have been a better name that "Dynamic DSP v2" to avoid confusion.

Unfortunately I can't edit any of my posts or change any of my uploaded files any more. But I will consider your advice in the future.
Title: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: MindsMirror on 2015-10-07 23:35:32
Thank you popatr and Mario66 for these components. Not long ago I was looking for a component that did exactly this but didn't find one. I took another look today and found this.

I am using it in my headphone DSP chain to mix some older stereo albums and tracks to mono, and to change the gain of the center channel which is too loud in some of my 5.1 channel tracks.

I also think the replaygain scan with DSP is a great addition. I mix my 5.1 channel audio to stereo, so with the DSP applied the peak value is now useful. Also the tracks with the modified gain now have accurate replaygain values.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Coreda on 2016-03-07 04:23:04
Is there a way to check / indication of which effects are active for the currently playing track? If not I'd love to see such a feature added.

Would be ideal if a custom title formatting function could be added, so the user can check via their own title formatting in the status bar, etc. Have actually been looking for such a feature (https://hydrogenaud.io/index.php/topic,105933) for a while.

As it is now I can't tell if an effect is active by looking at the DSP sub-menu or by checking the Dynamic DSP window (apart from double-checking the script function evaluates correctly).
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Coreda on 2016-03-22 10:44:39
Have noticed that a VST plugin called FNequalizer (as bundled in this skin (http://markeight.deviantart.com/art/DarkOne-Equalizer-Default-UI-add-373522520) for the plugin) doesn't save the settings via Dynamic DSP. Each time the EQ is the same flat curve after re-opening the configuration.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Isabelxxx on 2016-03-22 12:53:25
Is there a way to check / indication of which effects are active for the currently playing track? If not I'd love to see such a feature added.
The mod version has a preview function, you can play anything you want and check if it triggers the script, but that's all..

Agree about your request for new features for custom title formatting, but that should be also suggested to the main developers of foobar.

Currently you can do it manually adding to the status bar formatting the same "logic" you put in the DSP.
i.e.
DSP:
Code: [Select]
[%trackdsp%]
Status bar:
Code: [Select]
$if(%trackdsp%, DSP used: %trackdsp%)

Obviously  with complex code you then have the possibility that the DSP is not really working but your status bar says the opposite or things like that... that's where new functions really related to DSPs would be useful.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Coreda on 2016-03-22 13:10:16
The mod version has a preview function, you can play anything you want and check if it triggers the script, but that's all..

Do you have a link to the modded version? The one Mario66 posted above has a broken download link.

Agree about your request for new features for custom title formatting, but that should be also suggested to the main developers of foobar.

Currently you can do it manually adding to the status bar formatting the same "logic" you put in the DSP.
i.e.
DSP:
Code: [Select]
[%trackdsp%]
Status bar:
Code: [Select]
$if(%trackdsp%, DSP used: %trackdsp%)

Obviously  with complex code you then have the possibility that the DSP is not really working but your status bar says the opposite or things like that... that's where new functions really related to DSPs would be useful.

By the example above did you mean to check if the formatting returns the correct value, or to display if the DSP is active? If the latter it doesn't appear to work for me. Would be great though to have an additional title formatting option that would return which effects were currently active.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Isabelxxx on 2016-03-22 20:35:41
I mean to put the same code in both the Dynamic DSP and the statusbar. That was my example, obviously it will not work for you. Adjust it!

I check for a tag in the files to use that "tag" DSP.

Then I check in the status bar the same so it will add that info if it uses any "tag" DSP.

There is no real relation between the status bar and dsp obviously, I can not check any other DSP status only those I "choose" by explicitly applying the same logic in the status bar formatting and the Dynamic DSP script.
But my code is only activated when those triggered DSPs are working so it achieves what you want.

EDIT: Post here the code you use in the script and the DSP names you use and I could suggest you how to apply the same.
But the limit as you have noted it's there: you can not know the state of a DSP outside Dynamic DSP chains.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Coreda on 2016-03-23 04:53:50
I check for a tag in the files to use that "tag" DSP.

Then I check in the status bar the same so it will add that info if it uses any "tag" DSP.

I understand what you mean now, and yeah I originally adjusted your example to match my own formatting. Essentially the concept is since you know that a Dynamic DSP preset will always be applied to certain audio files the formatting checks and returns true if it matches the same function as the one set in Dynamic DSP (eg: if the effect is applied to the album 'Hardcore History' it will return 'DSP used: Hardcore History', assuming that's what the function returns).

Guess I was expecting something different in my previous post but I can confirm it works ;)

Thinking about it the formatting could get considerably long to check all the various Dynamic DSP functions. Probably why it's leaner using a custom tag instead.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2016-03-26 11:26:32
Hi,
I would suggest:
[$if(%trackdsp%, DSP used: %trackdsp%)]                    (where %trackdsp% is the titleformatting expression used in Dynamic DSP's config window, accordingly to custom configuration)

Adding those [ and ] causes, that when no DSP is used, there will be no additional chars/spaces in status bar. You can also change it to:
$if(%trackdsp%, DSP used: %trackdsp%, no Dynamic DSP processing applied)

That will give clear message :)
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2016-03-26 16:51:32
By the way, the download links are still online at the "Uploads - (fb2k)" subforum. Just the link in my posting here is broken for some reason.

New link: https://hydrogenaud.io/index.php/topic,108904.0.html
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2018-04-21 22:59:39
Dynamic DSP v2.1

I made another update to the component which I wanted to share with you.

The component now can make the DSP dependent on the output device through new variables. This is especially useful if you often switch between headphones and speaker and you have some crossfeed DSP for your headphones (e.g. foobar2000 component "Meier Crossfeed", a must-have for headphone users IMHO.).

Basically, it introduces the following variables:

Then you can use these, for example, as follows:
Code: [Select]
$ifequal($strstr(%windows_output_device_name%,Headphones),0,,Crossfeed;)
[%dsp%]

In this example, we add "Crossfeed" to the DSP list if the substring "Headphones" can be found in %windows_output_device_name%, see Foobar2000:Title Formatting Reference (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference)

Secondly, the titleformat script textbox now supports multiline, where line breaks have no effect. They are ignored. This makes it easier to write human-readable scripts.

Furthermore, I now finally added a proper license and copyright notice to the component. In the spirit of popatr's "I make no restrictions on what you can do with the the source code or component", the component is now licensed under MIT which is basically the same with a few obvious restrictions (give credis if redistribute, provided "as-is").

P.S. Component requires Windows Vista or higher (sound device API) and foobar2000 1.3.5 or higher (read foobar2000 output device name).

If you experience any regressions, let me know!

Download (https://hydrogenaud.io/index.php/topic,108904.msg956095.html#msg956095)
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2018-05-23 13:31:13
I noticed some bug related to Dynamic DSP. I am not able to determine if it's really Dynamic DSP plugin fault or main app fault - so there is also separate thread for main app.

I noticed that ReplayGain settings seem to be leaked into "Dynamic DSP" subsection of of "Tools" section in Advanced Preferences. I am using Dynamic DSP version 2.1 in foobar 1.4 beta 14. This is how it looks like (see attached picture):
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2018-05-27 13:36:48
@EpicForever: That's by design.  Dynamic DSP has it's own ReplayGain scanner where you can apply a DSP before the gain is computed (see 2.0 changelog). Although it has the same look and feel than the regular ReplayGain scanner, all the mechanics except the core algorithm itself are implemented from scratch. (including it's own setting branch)

It would be more elegant to just use the same settings, I know. But the ReplayGain scanner is an optional component itself and I am not sure whether you can just access it's setting though another component. If anyone knows more about this, let me know.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Peter on 2018-05-28 12:30:16
The recommended way of interacting with foo_rgscan is to use replaygain_scanner API published in the SDK, which lets you feed audio chunks to its scanning algorithm and pull track/album results.
If you wish to use your own lowlevel code, you want to provide separate settings as well, as otherwise you'd have to rely on the user having foo_rgscan installed, and possibly break with a future foo_rgscan update changing the layout of settings for some reason.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2018-05-28 18:05:11
The recommended way of interacting with foo_rgscan is to use replaygain_scanner API published in the SDK, which lets you feed audio chunks to its scanning algorithm and pull track/album results.

Thanks for clarifying! That's exactly how it's done at the moment, then I won't change it.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Rollin on 2020-08-31 19:55:51
It seems that version by @Mario66  is incompatible with fb2k 1.6.  It is not possible to open configuration window for DSPs inside of chain.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Priest_1 on 2020-08-31 23:55:11
It seems that version by @Mario66  is incompatible with fb2k 1.6.  It is not possible to open configuration window for DSPs inside of chain.

foo_dynamicdsp v1  
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: 2tec on 2020-09-01 00:02:21
Interesting ... I think someone used this name before. See here https://hydrogenaud.io/index.php?topic=108904.0

wouldn't foo_dsp_dynamic be a more conventional name? I don't think it's taken.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Priest_1 on 2020-09-01 00:05:56
SOURCE
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Priest_1 on 2020-09-01 00:08:10
Interesting ... I think someone used this name before here https://hydrogenaud.io/index.php?topic=108904.0

wouldn't foo_dsp_dynamic be a more conventional name? I don't think it's taken.

This is last version of this plugin.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2020-09-05 10:59:29
OK. It seems someone wanted to be helpful, but was too lazy to explain what he has done.

In this thread we have version 1 of Dynamic DSP posted in response to non working report.
In the following thread:
https://hydrogenaud.io/index.php?topic=108904.0  there is version 2.1 of Dynamic DSP component, which seems to be latest / nave the highest version number. And is not working as it should in foobar 1.6.

So which one is really the latest? Which one is supposed to work in foobar 1.6? What was the purpose of giving sources of the component?
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Priest_1 on 2020-09-06 02:31:25
OK. It seems someone wanted to be helpful, but was too lazy to explain what he has done.
In this thread we have version 1 of Dynamic DSP posted in response to non working report.What was the purpose of giving sources of the component?
It seems that version by @Mario66  is incompatible with fb2k 1.6.  It is not possible to open configuration window for DSPs inside of chain.


Maybe someone of developers help us and create compatible verse for F2K v1.6.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Mario66 on 2020-09-25 14:37:10
Hi all,

sorry for the inconvenience. I do not actively develop this extension any more.

But I noticed that this issue is caused by my bugfix I introduced to fix an issue with this DSP called in a different thread than the main thread.

My solution I can offer to you is to revert to the old behavior which did not have this fix incorporated.
Then you can not call this DSP from context menu "View" > "DSP" > "Dynamic DSP". This will lead to a crash because of running in a different thread.
Instead you can only use this DSP inside the preference dialog of foobar2000. But here at least the DSP is fully functional again.

I created a version 2.1.1 of this DSP with all the new features but the main thread fix reverted to the old version:
https://hydrogenaud.io/index.php?topic=108904.msg988324#msg988324
This should work for foobar2000 1.6 with the limitation described above.

If anyone knows a better way to fix this, feel free to update the addon.

For those who are interested, my solution to fix the threading issue looked like the following:
Code: [Select]
class CMyDSPPopup : public CDialogImpl < CMyDSPPopup > {
  [...]
  void OnConfigureDSP(UINT itemNum, int id, CWindow wnd) {
    int selectedItem = chainsList.GetCurSel();
    if (selectedItem != LB_ERR) {
      WCHAR str[MAX_PRESENT_NAME_LEN];
      chainsList.GetText(selectedItem, str);
      pfc::string8 name = ConvertWchar(str);
      // Call dsp configuration popup in main thread
      m_mthelper.add(this, name);
    }
  }
  callInMainThreadHelper m_mthelper;
public:
  void inMainThread(const pfc::string8& chainName) {
    dsp_chain_config_impl *chain = chainsMap[chainName];
    // Set this->m_hWnd as parent, otherwise the user will be able to close this window
    // but leave the DSP popup open => crash
    static_api_ptr_t<dsp_config_manager>().get_ptr()->configure_popup(*chain, this->m_hWnd, chainName.toString());
  }
  friend class callInMainThread;

Now I just reverted it to:
Code: [Select]
 void OnConfigureDSP(UINT itemNum, int id, CWindow wnd) {
    int selectedItem = chainsList.GetCurSel();
    if (selectedItem != LB_ERR) {
      WCHAR str[MAX_PRESENT_NAME_LEN];
      chainsList.GetText(selectedItem, str);
      pfc::string8 name = ConvertWchar(str);
      // Call dsp configuration in current thread (bugfix for fb 1.6)
      dsp_chain_config_impl *chain = chainsMap[ConvertWchar(str)];
      static_api_ptr_t<dsp_config_manager>().get_ptr()->configure_popup(*chain, NULL, name.toString());
    }
  }

I have no clue why the fist version suddenly stopped working.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: EpicForever on 2020-10-08 21:00:12
@Peter - maybe you will be able to judge or check if this is some plugin developer's mistake or is it some bug/regression in newest foobar or its API?
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: palash on 2022-03-13 22:14:19
Hope someone trying to figure out how to make Titleformat script works could find my example helpful.
According to %genre% of current file it switches to appropriate Chain ("Audiobook", "None", "Course", and otherwise "Default2"). And you can simply add your own conditions.

Code: [Select]
$if2([%trackdsp%],
$if($strstr(%genre%,Audiobook),Audiobook,
$if($strstr(%genre%,Psycho),None,
$if($strstr(%genre%,Club),Club,Default2)
)
)
)

Although could anyone explain why $if((%genre% HAS Audiobook),Chain1,Chain2) doesn't work properly so I had to rack my mind to find out working code: $if($strstr(%genre%,Audiobook),Chain1,Chain2) ?
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: palash on 2022-04-04 19:04:46
Although could anyone explain why $if((%genre% HAS Audiobook),Chain1,Chain2) doesn't work properly so I had to rack my mind to find out working code: $if($strstr(%genre%,Audiobook),Chain1,Chain2) ?

I found answer in other thread made by @shakey_snake   :
The TITLE FORMATTING syntax is a separate type of input from the SEARCH QUERY syntax. One handles formatting strings, the other handles searches. Basically, Title formatting syntax has $functions() $and(%objects%) while search queries have expressions AND values. You'll notice the two have separate help pages in foobar2000.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: palash on 2022-04-04 19:08:50
How to make Crossfader works properly inside "Dynamic DSP" chain?
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: kode54 on 2022-04-05 09:05:52
The answer is you probably don't, since Dynamic DSP changes chains across tracks.
Title: Re: Dynamic DSP v2
Post by: Cannonaire on 2023-07-08 02:05:28
I see this was last updated in 2020. Any chance for a 64 bit version?
Title: Re: Dynamic DSP v2
Post by: Sergey77 on 2023-09-02 19:47:43
^Useful component. The current version is not stable with fb2k v2.1
Is it possible to update it?
Developers, please pay attention, there are even source codes here:
https://hydrogenaud.io/index.php?topic=108904.msg988324#msg988324
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-03 02:38:41
@Cannonaire @Sergey77

Here is a recompile of the original sources with the latest SDK.

 foo_dynamicdsp v2.1.1.1 x86 32-bit & 64-bit.zip  (187.39 KB)



Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Chibisteven on 2023-09-03 04:40:08
@Cannonaire @Sergey77

Here is a recompile of the original sources with the latest SDK.

[attachurl]26933[/attachurl]

BUG: None of my chains from the 32-bit version show up in the 64-bit version.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-03 05:06:52
BUG: None of my chains from the 32-bit version show up in the 64-bit version.

The 32-bit config could not be ported straight away to the 64-bit version.
And old bug requires to write some sort of importer.


Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Chibisteven on 2023-09-03 05:17:17
BUG: None of my chains from the 32-bit version show up in the 64-bit version.

The 32-bit config could not be ported straight away to the 64-bit version.
And old bug required to write some sort of importer.

Is there any way to import chains across different processor architectures?  Because it be a little crazy to have re-do tons of different chains across different presets for different processor architectures.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-03 05:32:44
If you are still planning to use both platforms the bug has been fixed in 2.1.1.1 and both versions should be compatible now.
I will never use and importer personally, but I will try to find a solution... it just takes time.
Cheers!
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Sergey77 on 2023-09-03 07:08:32
@da yuyu , thanks a lot!

The component adds for fb2k new advantages for managing DSP.
For example, I managed to create the necessary personal settings of DSP for radio streams, multi-channel audio, Youtube items and everything else:
Code: [Select]
$if($strcmp(%directoryname%,'www.youtube.com'),Youtube,$if($strstr(%path%,'mkv'),Movie,Other))
Now the DSP setting selection works automatically. This is amazing!
I hope this component will find support for further development.

Please note:
The following sequence will cause fb2k to crash:
1. Open the Dynamic DSP settings window
2. Open the Chains Settings window
3. Click "Ok" and close the Dynamic DSP settings window (the DSP Settings window is open)
4. Then click "Ok" and close the DSP Settings window - fb2k crashes and creates of crash report.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Chibisteven on 2023-09-03 09:44:52
@da yuyu , thanks a lot!

The component adds for fb2k new advantages for managing DSP.
For example, I managed to create the necessary personal settings of DSP for radio streams, multi-channel audio, Youtube items and everything else:
Code: [Select]
$if($strcmp(%directoryname%,'www.youtube.com'),Youtube,$if($strstr(%path%,'mkv'),Movie,Other))
Now the DSP setting selection works automatically. This is amazing!
I hope this component will find support for further development.

Please note:
The following sequence will cause fb2k to crash:
1. Open the Dynamic DSP settings window
2. Open the Chains Settings window
3. Click "Ok" and close the Dynamic DSP settings window (the DSP Settings window is open)
4. Then click "Ok" and close the DSP Settings window - fb2k crashes and creates of crash report.

Interesting.  Tried this myself.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-03 10:45:36
@sergey77 @Chibisteven

Also I believe the Refresh preview button used to work.
But I am not sure.

This release should fix that crash.
Updated the change log and added dark mode.

I will post sources and binary to the Upload section when I find some time...

 foo_dynamicdsp v2.1.1.2 x86 32-bit & 64-bit.zip  (397.40 KB)
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Sergey77 on 2023-09-03 11:04:17
Please check the attached version of the component.
No changes here.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-03 11:24:26
Ouch... please try downloading it again.
Thanks for reporting !
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: Sergey77 on 2023-09-03 11:36:54
Incredible! The component looks like new!
@da yuyu , thank you very much.
Please consider placing it in a repository. So that these components are no longer lost.
Title: Re: Release: Dynamic DSP: gives custom effect chains for individual tracks
Post by: da yuyu on 2023-09-13 02:03:52
A new release is available (v2.1.1.3 (https://hydrogenaud.io/index.php/topic,108904.msg1032683.html#msg1032683))

This is the last 'Dynamic DSP' release before I rename the component.

Chains can now be saved to the <profile>/configuration/foo_dynamicdsp.exp file.
Copy it to other fb2k configuration folders and it will be used as default by fresh component installations.

Change log:
- Export/Import chain configurations.
- Fix 32/64 bits config compatibility.

Known issues (x64):

- v2.1.1.2 x64 WILL BE RESET after installing this update.