I made a TimeBalance plugin

Discussion in 'Effects and the DSP' started by Tril, Jun 2, 2005.

  1. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I made a TimeBalance plugin. It adjusts four delays using two sliders. You can use it to position the "center" of the sound elsewhere than in the middle of the speakers. For example in a car, the driver is not located in the middle of the vehicle at the same distance from all the speakers. Using this plugin, you can delay the signals going to the four speakers to give the impression to the person sitted in the driver seat that the center of the soundstage is right in front of him rather than to his right behind him. You can also use it for small changes (trimming) to improve spatial imaging.

    I'm not sure it works 100% so try it out and comment about it. If you are in the middle of the speakers and move the sound to the left, it's normal to have the impression that the sound is moving to the right. Once you move yourself to the left enough, the sound will center itself.

    The coordinates are centered in the middle of the speakers.

    The delay of each speaker is displayed as debug text. It was not required to know them to setup the plugin so I did not include them in the interface. If I want to know what is the delay of each speaker, I use DebugView.

    This version is removed because the new version is better.


    ==================================================

    New version below. It is much better than the last one. This new plugin is called TimeBalanceV2.

    There are two modes. The Basic mode and the Advanced Mode.
    • In Basic mode you enter the distances between the listener and the speakers.
    • In advanced mode, you enter the coordinates of the speakers and of the listener. The avanced mode has the advantage that you can move the listener without having to readjust all the other sliders.
    Advanced Mode :
    Around the sliders of the listener, there are five distances displayed in blue. These are the distance between the listener and the five speakers.

    Between the sliders of the speakers, the are six distances displayed in yellow. These are the distanced between the speakers.

    All these distances are displayed to help adjusting the sliders.

    How to use the plugin is simple. You connect the inputs and the outputs to the plugin. You adjust all the sliders by using measurements taken in your listening environnement.

    I added a save button on the upper-left corner. That creates a new plugin called "TimeBalanceV2 Light" that uses the settings that were used when the button was clicked. It uses less ressources because it uses only what is necessary for the settings selected.

    Example :
    You adjust the plugin to your liking, press the save button, press ok, unload "TimeBalanceV2" and replace it "TimeBalanceV2 light". That way you leave more iTram free for other plugins.

    There are three files in the zip file. Simply uncompress the three files in the same folder and register the kxl file. The two kxs files are the two skins of the plugin. You only have to place them in the same folder as the klx file for them to work.

    Note : I have removed the download links for this plugin since it is now installed by the kX drivers install package.

    I made an example of what I use with a picture (from an old version of the plugin, the interface has changed a lot since then) :
    http://pages.globetrotter.net/samaust/Files/TimeBalanceTril.png

    Warning : Do not execute the .kxs files. If you do, the skin from my plugin will be used on all kx plugins thus creating problems. If you do it by mistake, execute the file kxskin.kxs and the situation will return to normal. This file is situated in the system32 folder of the computer (C:\WINDOWS\system32\kxskin.kxs in Windows XP).
     
    Last edited: Oct 16, 2007
  2. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Sounds interesting. Normally (i.e. with a car stereo), you would use Balance and Fader (i.e. volume differences) to center the image, but with this, you should be able to make it seem as if the speakers themselves are in different locations, etc. I will have to give it a try :)
     
  3. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    For best results it may be necessary to use another plugin for volume difference together with this plugin. I haven't experimented much yet.

    My computer speakers are too close together to test correctly all the range of the plugin so I can't test completely it with my current setup. The speakers are also closer to one end of the room than the other. I have a suboptimal testing environnement.

    There is some waste of iTram. I reserved a bit more than necessary to make sure it did not go over. I did not know exactly before coding and trying the plugin how much iTram would be necessary because of rounding/truncation in the calculations, etc. I'll correct that later to conserve ressources.

    It's nice to be able to use C++ instead of only Dane. I was able to use negative and positive values on the sliders instead of only positive. The range can also be changed more freely.
     
  4. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    My current setup is bad (for testing such a plugin) as well. I gave it a try, but with my current setup I could not really tell that the effect was doing much. You may also want to recommend optimal kx settings that should be used with this plugin, as I think some of Surrounders settings would be in direct contrast with your plugin. What settings are you using when testing, 4.0 - Quadro?
     
  5. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I made the plugin for uipe and the sound system in his/her car.My current setup is not using the default plugins. I only load what I need.

    I have four speakers but I almost never use sound encoded for 4 or more channels. My front speakers are 2.1 but not with a separate subwoofer channel. There is a crossover in the speakers. The front speakers are not even 1 meter apart because they are on the desk. The back speakers are very old and very cheap computer speakers. Definitely not the best but better than none.

    My back speakers are usually a copy of the front speakers. This setup with four speakers gives an impression of depth compared to only using the front speakers. That's why I use it.

    I suppose you could use 4.0 - Rear=Front in surrounder and connect fL, fR, sL, sR to inFL, inFR, inRL, inRR. You could also use 4.0 - Quadro and connect fL to both inFL and inRL, connect fR to inFR, inRR. It would do the same thing.

    Other setups can be used too. I would recommand to experiment a bit.
     
  6. uipe

    uipe New Member

    Joined:
    May 26, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Again and again THANKS :D

    Tomorow if possible I will take my car to a Sound Quality Car installer so that he can help me configure my sound using this really cool plugin ;)

    I will post my install than

    TRIL I AM YOUR BIGGEST FAN :D
     
  7. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    Don't be too disappointed if it does not live up to your expectations. I hope it will be good enough for your needs.

    If you have experience with alpine digital time correction. You could try to compare with this plugin and tell us if it is better/worse/equal/different.

    EDIT :
    I think I messed up on the equations. I was too eager to finish the plugin as soon as possible. I'll take the time to think about it more. I'll make some drawings to help visualize what should happen and I'll correct the code. The link wil be back in a few days.

    Sorry for the inconvenience.

    I hope uipe will see this before going to his sound quality car installer.
     
    Last edited: Jun 3, 2005
  8. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    Plugin updated with some corrections to the equations. See link in first post. It should now work better.

    I also resized the iTram to use only the ressources required.

    I'm not sure this plugin does the job perfectly because it does not use the positions of the speakers. For now it will do the job somewhat but I would like to make a plugin in which you enter the position of all the speakers and the position of the "center". The delays would be closer to what they should be to achieve great results. I'm thinking about having a graphical interface in this new plugin. It would display the position of the speakers and the position of the "center". I won't make it soon but it is now in my TODO list of personnals projects.
     
    Last edited: Jun 3, 2005
  9. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    Cool, I'll test it out for ya.. I have been doing the same thing for awhile with the center channel. As my center channel was sitting alot closer to me than my L/R channels., So I would use the Simple delay Plugin to "move it Back" acoustically anyway. Works. I Will try this out later. Your idea about the GUI would be very good. Being able to set the L/R or Center channels using the delays would be quite handy...I'll help you do the graphics if you like..not sure how but I will be willing to help...
     
  10. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I should make it 5 channels. I used 4 before because I have four speakers.

    What is the usual distance between speakers? I need to know that to know what would be the maximum delay of the plugin. I would appreciate if at least a few people tell me how far apart their speakers are from each others.

    The graphics will wait. I can program it right away without graphics and the effect will work. The graphics would only be a plus. The only thing I'm missing is the distance between speakers.

    My rear speakers are about 2m away from my front speakers and my front speakers are only 0,7m apart because that's the width of the desk. The rear speakers are 0,7m from each other too.

    sqrt(2^2+0,7^2) = 2.119 m in diagonal (FR to RL or FL to RR).
    48000 [samples/s] * 1/340 [s/m] * 2.119 [m] = 300 samples

    With the position of my speakers, the maximum delay I would need is around 300 samples. I have 5 channels.

    300 [samples/channel] * 5 [channels] = 1500 samples

    I would need in total 1500 samples of delay.
     
  11. uipe

    uipe New Member

    Joined:
    May 26, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Sorry for the late anser but I have been having some things in faculty, so only next week will I have time to take an aftertoon just to tune my install.
     
  12. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    My speaker setup is very non typical, so my layout really wouldn't help you (i.e. my rear speakers are not behind me, etc).
     
    Last edited: Jun 5, 2005
  13. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    Uipe, I'm writing another plugin where you input the position of the speakers and of the listener. It should be more precise and give a better effect. Think of the current plugin as a prototype design which can be improved.

    I'm wasting ressources. I was using a fixed write adress and changing the read adress to change the delay. In the next plugin, I'll change the write and the read address. I don't see why it should not be possible. There will be less waste that way.

    I'll use a square of 5m by 5m as the maximum distance for now. It should be enough for almost anyone.
     
  14. bobo1on1

    bobo1on1 New Member

    Joined:
    Oct 13, 2003
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    I have used this type of solution for quite some time, my right speaker is 50 centimeters further away than my left speaker, so I used a simple delay of 72 samples to correct the difference in time.
    The difference with and without the delay is huge, with the delay the sound is actually coming from the center , without the delay all the voices are coming from the left.

    How do I use this plugin? When I try to register it it says its an invalid plugin.
     
  15. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    It's compiled for 3538. I suppose you are using an older version of the drivers and that's why it does not work.

    I'll post a new version of the plugin later today. It works a lot better. It is functionnal right now but I want to improve the interface a little before posting it. It needs a lot of iTram to work for different speakers placements. To use less resosurces, you could use it for calculating the delays and write your own delay plugin with those delays.

    It works really well. When listening to music, previously the singer voice seemed to come from a large area. Now, it sounds more as if it comes from a single point. Impressive difference.:)


    I have an idea. Russ or any other programmer could tell me if it is a good idea or if it's stupid. My plugin calculates the delays and set the read and write adresses. I could add an export(save) button to the plugin. Pressing the button would write a dane plugin using the delays calculated by my plugin.

    That way, you adjust your system with my plugin that uses a lot of iTram. When satisfied, you press the export button. It writes to disk a dane file with the correct delays. You register that new plugin. You unload the ressource hog plugin and load the new plugin that only uses the necessary ressources.

    I know that I would personnally find that useful and that I would use it. Dane files are only txt files so it should not be too hard. Is the code that calculates guid in the SDK?
     
  16. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Sounds like a good idea to me. There are Windows Platform SDK functions for generating GUID's, i.e. CoCreateGuid, UuidCreateSequential, UuidCreate, etc. See the MFC sample GUIDGEN for example source code.

    -Russ
     
  17. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    New version available. See first post. Don't bash too much on the interface, I'm not an artist.;)
     
  18. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    I was thinking about it, and one of the problems with my options dialog is the need for per instance settings (because of the type of plugins I was using with it). But with this plugin, I imagine there would be no need for muliitple instances of it (at the same time on the same computer), and thus you could use methods similair to what I did with the options dialog with this plugin, but without the problems (because you would be saving the settings for future use). It would work similair to exporting .da files but you would not need export anything, and this way all your controls can still be C++ controls, etc. Let me know what you think, and I will post some of the details.

    -Russ
     
    Last edited: Jun 6, 2005
  19. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I don't understand what you want to do. From my point of view, I don't need it for that plugin. I don't see where you option dialog window would fit. Please tell me what you wanted to do with it.

    Depending on the positions of the speakers and of the listener, the total amount of delay (iTram that is used) needed for all the speakers can vary. I had to set iTramsize at the maximum value that can be obtained with a 5 by 5 m square. Exporting the code with the exact iTramsize needed for a current setting is the best solution I've thought about so far.

    If I don't add that export function to the plugin, it's easy to do it manually. You setup the plugin, right-click on it and click Edit. You can then save the dane plugin by clicking save. But you have to change the name and the guid. It's easy to do manually so maybe I don't really need to write that export function.
     
  20. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    You are right, it is easy enough to edit the microcode, but with a .kxl plugin, you would have to redo it everytime you reboot (or if you save it as a .da you lose the C++ controls), etc. I do not mean for you to use the options dialog, just similar methods of automatically manupulating the microcode based on saved settings.
    i.e.
    You save the settings in the registry, and the next time the plugin is loaded, it reads thoses settings, calculates the optimal iTramSize, etc, and uses that value when it loads the microcode.

    Again, it is just an idea.

    -Russ
     
    Last edited: Jun 6, 2005

Share This Page

visited