Spectrum analyzer possible in DSP?

Discussion in 'Effects and the DSP' started by TheKezReturns, Jan 18, 2009.

  1. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    SA.minus updated

    source code
    kxl binary

    Changes:
    * added settings status window (F2)
    * added different "band curve" modes (Ctrl+B, see details below)
    * fixed missing "infinite hold" (Crtl+I) command
    * added "always on top" toggle (Ctrl+A)
    * fixed other minor bugs
    * some source code clean-up

    I also included the colour schemes posted here in the kxl package (i hope it's OK i did it without asking first, kick me if it's not)

    Note this version is incompatible with the settings saved within kxmixer by previous SA.minus versions - so if you value your current settings make sure to save them as default (or [0...9]) preset before installing this update.

    "Band curve" mode details:
    The "band curve" mode (more correctly to be named as "band separation" but that sounds awful to me) is a combination of the two SA settings - the "band intersection" (which is simply a filter band width defined as the level at neighbour bands crossover frequency) and the "band leak compensation" (which is a sort of "magic" peak data postprocessing used to reduce the effects of the interband crosstalk :duh:). Well, basically speaking, these modes determine the accuracy and (as a secondary effect) the smoothness/sharpness of the peak display. See this table for a quick "band curve" mode comparison.
    For a compatibility with the previous versions, the default mode is "I" (band intersection -6dB, band leak compensation off), though the most precise one (and hence recommended) is the "Mode IV" (band intersection -3dB, band leak compensation on). Note that the "band leak compensation" significally affects perceived peak display dynamics so (with the option turned on) you will likely need to increase visible level range by 15...25dB (and probably decrease peak decay speed a little).
     
    Last edited: Feb 22, 2009
  2. babinosman

    babinosman New Member

    Joined:
    Mar 20, 2008
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    0
    thanksssssssssss
     
  3. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    I'd like to have a play with the source code but I'm a little clueless about the last two things

    * Link to kxapi.lib and gdiplus.lib
    * Compile as non-MFC and non-unicode dll

    I downloaded the SP2 SDK and added the folders to inculdes and libs directories.
    But I don't know how to 'Compile as non-MFC and non-unicode dll'
    I get this at the moment.
    '
     
  4. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    it looks like you're trying to compile it with something earlier than vc2005 (vc6, vc2003, DDK?) - please use something newer (any version of vc2005 or higher (including "express") or WDK will do the trick).
    Although for vc2003 or DDK you would fool it with:
    Code:
    inline void trace(...) {}
    instead of
    Code:
    #define trace(...) __noop
    but i'm not sure if they have other incompabilities (i suspect they have, particulary vs. kX SDK itself).

    * Link to kxapi.lib and gdiplus.lib
    * Compile as non-MFC and non-unicode dll
    - this depends on the building sytem you use (IDE? Driver Kit?)
     
    Last edited: Feb 24, 2009
  5. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    Ok thanks Max, will dload vs express and try that.

    And regarding the filter coefficients, would it be easy enought o calculate some new ones for a different frequency range. I'd like to have an option to 'zoom in' on the lower part of the spectrum, maybe 20-300, as this is generally where it's extra helpful to have visual feedback.

    When you say
    is that because of the current set of coefficients or is there some sort of limitation to what frequencies we can measure accurately with this method?

    Sorry if any of these questions sound naive, but I'm a 'lean as you go' kind of guy and generally learn as much as I need to know to get the job done and stop there.

    I'd also like to implement the following features-

    - An option to have the exact frequency of the band the mouse is hovering over displayed somewhere on the graph in a large font. could have peak hold level too.

    - Hotkey to enlarge / shrink the graph label font - saved with the preset.

    - Shift clicking on a band would enable / disable it's frequency label on the graph. -saved with preset.

    - Maybe a turbo mode for when you don't care about the cpu hit and want impress your friends :) I take it it's throttled at the moment?

    - And for something really adventurous.... big part imagination this one but I'm just gonna put it out there...


    Hold down a key and the analyzer starts taking an long term average of the bands and stores those values when the key is released, similar to the learn function of the many eq matching plugins out there.
    Hold another key down and another average is taken, this time compared with the stored values and overlayed on (or replacing) the graph with bars stretching between the two average readings. A positive or negative difference could be indicated somehow, perhaps different colours or arrow heads.
    I think this would be very helpful in determining quickly... 'is my mix too bright overall.. is there enough / too much sub... did I scoop the midrange toomuch' - relative to your favorite productions. Ofcourse all the rules of an eq matching plugin would apply here. ie. music of the same genre with much the same elements and sampling the eq over say 4 bars of chorus when all instruments are 'in'.

    Although I have the intention of having a go at making these additions myself, I'll most likely do so very slowly. I generally only boot xp when I really have to these days and even then I still havent managed to successfully compile the source!
    So if anyone want to beat me too it, I certainly won't be offended.

    What a great community. Just weeks ago I was jealous of this guys rme analyzer, now we have better one
     
  6. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    Re: SA.minus updated

    very nice band curve modes, max. your baby becomes a professional audio tool. :)

    stylus
     
  7. TravelRec.

    TravelRec. Alternative Audioproductions

    Joined:
    Sep 8, 2003
    Messages:
    1,710
    Likes Received:
    3
    Trophy Points:
    0
    Hi MaxM.

    thank you very much for upgrading the tool - it´s fantastic! As a suggestion: it would be very fine if the analyzer would have a drop-down menu or similar (right click with the mouse thingie) for faster access and a better overview to the active/not active settings.
     
  8. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    Sorry to be such a newb and all but trying to complie in vc++ express gives me this.

    I have added kx SDK includes and libs and SP2 SDK libs and includes for gdiplus.

    Code:
    1>------ Build started: Project: Sa+, Configuration: Debug Win32 ------
    1>Compiling...
    1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
    1>kxl.cpp
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(334) : warning C4005: '__reserved' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1956) : see previous definition of '__reserved'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(341) : warning C4005: '__checkReturn' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1957) : see previous definition of '__checkReturn'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(344) : warning C4005: '__typefix' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1958) : see previous definition of '__typefix'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(349) : warning C4005: '__override' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1959) : see previous definition of '__override'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(350) : warning C4005: '__fallthrough' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1968) : see previous definition of '__fallthrough'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(351) : warning C4005: '__callback' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1960) : see previous definition of '__callback'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(352) : warning C4005: '__in' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1753) : see previous definition of '__in'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(353) : warning C4005: '__out' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1762) : see previous definition of '__out'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(354) : warning C4005: '__inout' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1781) : see previous definition of '__inout'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(356) : warning C4005: '__out_ecount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1763) : see previous definition of '__out_ecount'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(357) : warning C4005: '__in_ecount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1754) : see previous definition of '__in_ecount'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(358) : warning C4005: '__inout_ecount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1782) : see previous definition of '__inout_ecount'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(359) : warning C4005: '__out_bcount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1764) : see previous definition of '__out_bcount'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(360) : warning C4005: '__in_bcount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1755) : see previous definition of '__in_bcount'
    1>c:\program files\microsoft platform sdk for windows xp sp2\include\specstrings.h(361) : warning C4005: '__inout_bcount' : macro redefinition
    1>        g:\visual studio c++ express\vc\include\sal.h(1783) : see previous definition of '__inout_bcount'
    1>c:\documents and settings\kez\desktop\src\sa.options.h(224) : warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\stdio.h(358) : see declaration of '_snprintf'
    1>c:\documents and settings\kez\desktop\src\sa.options.h(231) : warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\stdio.h(358) : see declaration of '_snprintf'
    1>c:\documents and settings\kez\desktop\src\sa.options.h(239) : warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\stdio.h(358) : see declaration of '_snprintf'
    1>c:\documents and settings\kez\desktop\src\sa.h(331) : warning C4996: 'swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.
    1>        g:\visual studio c++ express\vc\include\swprintf.inl(85) : see declaration of 'swprintf'
    1>c:\documents and settings\kez\desktop\src\sa.h(347) : warning C4996: 'swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.
    1>        g:\visual studio c++ express\vc\include\swprintf.inl(85) : see declaration of 'swprintf'
    1>c:\documents and settings\kez\desktop\src\sa.h(352) : warning C4996: 'swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.
    1>        g:\visual studio c++ express\vc\include\swprintf.inl(85) : see declaration of 'swprintf'
    1>c:\documents and settings\kez\desktop\src\kxl.cpp(230) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\string.h(157) : see declaration of 'strncpy'
    1>c:\documents and settings\kez\desktop\src\kxl.cpp(233) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\string.h(157) : see declaration of 'strncpy'
    1>c:\documents and settings\kez\desktop\src\kxl.cpp(256) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\string.h(157) : see declaration of 'strncpy'
    1>c:\documents and settings\kez\desktop\src\sa.h(676) : warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1>        g:\visual studio c++ express\vc\include\stdio.h(358) : see declaration of '_snprintf'
    1>        c:\documents and settings\kez\desktop\src\sa.h(666) : while compiling class template member function 'void sa::View<Plugin,InfoTool>::updateInfo(void)'
    1>        with
    1>        [
    1>            Plugin=Plugin,
    1>            InfoTool=InfoTool
    1>        ]
    1>        c:\documents and settings\kez\desktop\src\kxl.cpp(130) : see reference to class template instantiation 'sa::View<Plugin,InfoTool>' being compiled
    1>        with
    1>        [
    1>            Plugin=Plugin,
    1>            InfoTool=InfoTool
    1>        ]
    1>        c:\documents and settings\kez\desktop\src\kxl.cpp(120) : while compiling class template member function 'PluginWindow<Plugin>::PluginWindow(Plugin *,int *)'
    1>        with
    1>        [
    1>            Plugin=Plugin
    1>        ]
    1>        c:\documents and settings\kez\desktop\src\kxl.cpp(322) : see reference to class template instantiation 'PluginWindow<Plugin>' being compiled
    1>        with
    1>        [
    1>            Plugin=Plugin
    1>        ]
    1>c:\documents and settings\kez\desktop\src\sa.h(678) : error C2065: 'colorsKey' : undeclared identifier
    1>c:\documents and settings\kez\desktop\src\sa.h(678) : error C2228: left of '.subKey' must have class/struct/union
    1>Build log was saved at "file://c:\Documents and Settings\Kez\Desktop\src\Debug\BuildLog.htm"
    1>Sa+ - 2 error(s), 26 warning(s)
    
     
  9. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    hehe, well, MS likes problems like this. It's just the vc2008 incompatible with the XP Platform SDK.
    see Microsoft Windows SDK Blog : Using Visual C++ 2008 Express with the Windows SDK (detailed version)
    E.g. you need to use the Vista (or Server 2008) PSDK or the PSDK included with the "vc2008 express" itself.

    p.s. That's not so newb stuff in fact, sometimes it looks like they intentionally mix up IDE/PSDK things to push ".net" (well, at least for "express" versions).
     
    Last edited: Feb 28, 2009
  10. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    for consistency, i just have updated the sources to give less cryptic errors/warnings for screwed cl/crt/psdk configuration. (stuff like _CRT_SECURE_NO_WARNINGS, newer crt swprintf etc.)
     
  11. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    The SA.minus sources updated to kX SDK v46:
    sa.minus.src.latest.zip

    The sources archive for the kX SDK v45 is updated too -
    lately Eugene found that the previous archive contained one invalid header file which would cause the compiled plugin to crash. The fixed version is sa.minus.src.latest.45.zip

    (No new binaries.)
     
    Last edited: May 3, 2009
  12. TravelRec.

    TravelRec. Alternative Audioproductions

    Joined:
    Sep 8, 2003
    Messages:
    1,710
    Likes Received:
    3
    Trophy Points:
    0
    Thank you Max M. - once again!
     
  13. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    Hey max, I thought I'd have another stab at this as I found an old pc that I've turned into a dedicated sa+ box :cool:
    I still can't manage to compile it successfully.
    do you think I'd have alot better luck if I installed vista?

    In the meantime, if you get a spare moment, could you please turn the polling interval into a paraemter we can change with a hotkey or something. Seeing as my new sa+ box isn't doing anything else, it may as well be working real hard at being an analyser.
    Cheers.
     
  14. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    >I still can't manage to compile it successfully.

    give more details about errors you get now.
    (according to build output ("error in specstrings.h bla-bla-bla") you posted above, it seems you just have installed and trying to use incompatible (with each other) compiler (IDE) and Platform SDK)

    >do you think I'd have alot better luck if I installed vista?

    nope.
    (just don't get confused by Platform SDK "title", i.e. the title "Windows XYZ Platform SDK" do not mean that you need the XYZ and you can't use this SDK in earlier OS. I.e. whatever Platform SDK of this decade is compatible with the XP (these days at least). So what you need to pay attention to is the "IDE" vs. "Platform SDK" compatibilty, e.g.: if your IDE comes with PSDK - use the one; if IDE comes with several PSDKs (or asks wich one to install) - use the default one (no matter what title that one has)). something like that.
    Try to start with some "hello word" program (just #include "stdio.h" + #include "windows.h" + main + printf) to check IDE/PSDK consistency.

    >could you please turn the polling interval into a paraemter we can change with a hotkey or something.

    I'm afraid i cannot do that. As this will negatively affect the code (too wide/bloating variable spread) with pretty (to my opinion) questinoable benefit.
    Currently the polling is hardcoded to 48ms, which is ~20Hz screen update rate, which is... well, whatever.
    In other words: lack of time + my personal bias of the option -> "it's up to you" ;)
     
    Last edited: Jul 26, 2009
  15. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    Ok thanks, I'll try again when i get some time and post errors if any.

    Ok it just doesn't seem quite as realtime and smooth as some vst plugin varieties but I guess it's ok and totally useable the way it is. If I can get it to compile I might have a play. Perhaps just a 'turbo' mode that halves to 24ms or something. Do you still think that would negatively affect the code?
     
  16. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    >it just doesn't seem quite as realtime and smooth as some vst plugin varieties

    well, it's a long story actually - in fact, i doubt this perception has something to do with polling rate (maybe one just need to tweek decay time to fit personal favours? ;) - well, we'll know for sure when you get "turbo" version). Unfortuntely as this all all depends on how we define the stuff behind "real-time" and "smooth" words - it's hard to give some fair comments.
    Maybe if you'd mentioned what specific vst analyzer you compared to - i could give more tech. details (for example: "real-time" - for instance most of FFT based analyzers actually have higher latency (e.g. the time between the moment signal changes and the moment you see that change) due to FFT algo nature - no matter what drawing rate it has))...
    Well, in other words - from algorithmic point of view - it's more likely that it could be something aside of more brute polling.
     
  17. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    Ok sorry max 48ms is plenty. I was running sa+ window maximized and when I shrunk the window suddenly it was smooth as silk. Maybe this old box just can't handle it (p3 733Mhz + Sis graphics).
     
  18. TheKezReturns

    TheKezReturns New Member

    Joined:
    Apr 25, 2005
    Messages:
    118
    Likes Received:
    1
    Trophy Points:
    0
    I lowered screen res to 800x600 and set processor Processor scheduling to Background services and that seemed to speed it up a bit.
     
  19. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Re: Îòâåò: Spectrum analyzer possible in DSP?

    I think the kX SDK incompatibilities have more to do with kxgui (MFC).
    SA.minus compiles fine for me with VC 2003/kX SDK 3548 with the default (directory) includes (i.e. the $(VCInstallDir) stuff)... plus the kX includes of course.

    Yeah, I usually have to resize the SA.minus window so that it is about half it's default width/height, otherwise it uses a little too much CPU for my old beast (though it does not really affect the drawing speed, etc.).
     
    Last edited: Aug 3, 2009
  20. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: Spectrum analyzer possible in DSP?

    >SA.minus compiles fine for me with VC 2003/kX SDK 3548...

    good, that's because i added
    Code:
    #if _MSC_VER >= 1400
        #define trace(...) __noop
    #else
        inline void trace(...) {}
    #endif
    
    my comment was for earlier code version which won't compile with VC2003 because of "__noop" (typically i try to avoid non-standard extensions but the __noop is too sweet)
     
    Russ likes this.

Share This Page

visited