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 could add a checkbox to turn on/off automatic volume control. I'm lacking knowledge on how the volume should be adjusted.

    There is a loss of volume caused by the difference in the length the sound travels in the air between the speakers and the listener (If the speakers are not all at an equal distance to the listener). I need to know how much a sound signal is attenuated by a distance in air at about 20C (dB/meter or something). I know the distance so I can calculate the dB loss caused by the propagation of sound throught the air. I then need to figure out what scaling fraction to use with that dB loss.

    I see a problem with that approach. The sound produced by the speakers has a volume control. To reduce the volume by a specific amount of dB (what you hear, not the signal that comes out of the sound card) at two different speaker amplifications you would use two different volume scaling fractions.

    Not sure if this is correct.

    Please explain how/why the SPL sliders should be used.

    Maybe my thinking is incorrect. What I know is that I don't know how to do the automatic volume control with my current knowledge.

    I can do the programming as long as I know what I need to calculate, what are the equations,etc.

    Feel free to share any knowledge that can be useful. Links to webpages providing useful information are welcome.
     
  2. aspectus

    aspectus New Member

    Joined:
    Aug 3, 2005
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    My SPL slider comment was more of a musing than anything else. Now that I read your post I can't help but doubt that my idea of a loudspeakers efficiency factor (or more specifically, a loudspeakers efficiency across its range of loudness) is useful here at all. I had this mental image of a slider with calibration marks for various SPL levels (if such data is even available, I doubt '1watt @ 1meter' rating alone would be enough) that the user would set one time based on the SPL ratings (1W @ 1M, 1W @ 5M, 5W @ 1M etc etc, is this info even databased?) of loudspeakers. Maybe just some left-brain debris.. :duh: Now reading your post I wonder if air humidity is actually more relevant, or even altitude.

    Where did I put my thinking cap. Ok so we are trying to figure out how much to attenuate each of the 5 ouputs 'evenly' based on listenners distance from the speakers. Clearly you are correct in that a major factor is said distance(s), however I don't think this factor is a constant, although it may well be in practice, so long as the speakers aren't very very far away from listenner:

    It is probably not easy to know which variables to prioritize without testing. So far I see these;

    - listenner/loudspeaker(s) distance(s)
    - air pressure
    - air humidity

    My SPL slider idea I realize now was a feeble way for me to try and describe the idea that any particular amp/speaker setup is going to express its input signal differently than another, across the possible range of master volumes. While I don't see how this is a factor at a fixed master volume with listenner equidistant from each respective speaker, I am thinking that it does become relevant when, for example, the center speaker is well behind the fronts, and then the master volume is changed. How many db's of difference between my center speakers quietest and loudest output levels, as compared to yours? I suspect this is a factor, particularily if the speakers aren't each, on their own, equidistant from listenner. So, possible additional factor is;

    - SPL gradient of amp/speaker

    It may well be that the only practically relevant factor is in fact simply 'listenner/loudspeaker(s) distance(s)' as you stated. Maybe the best approach is to forget about all the other factors and do some white noise tests on your setup, calibrating the new slider by ear, then have a bunch other folks do the same on their setups. That may give enough info to know whether or not to pursue the issue.

    Maybe another solution is to rig the setup portion of your plug-in set with 5 gain sliders and a white noise button, and let the user manually fix their own settings, maybe a 'quietest' and 'loudest' set of tests, then the 'lite' version of the plug-in could use those upper/lower limits to scale the signals?

    Wow, you know, somewhere in there I actually felt like I knew what I was talking about!
     
  3. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    I use this plugin but I have volumes as well, to trim the system to avoid clipping. Those other caculations would those help with sound quality? would they help with getting the best setup possible with a users given speakers? I have used this plug since it hit the forum, it's part of my stock setup now. I don't know why it's not getting more of a fan fare. I would like to see it evolve sort of like the THX setup page of a CL driver. I think this is what you have in mind tril is it not? To be able to set these seemingly small delays and parameters that aid in getting the best possible sound quality and surround imaging possible is Awsome!!. I think you boosted Kx up another notch in terms of professionalism Tril. I can't wait to see how the plug in will evolve. I know the sound is the main thing but it would be so Awsome to have a Nice GUI for this plugin especially. Having that level of accuracy in setup is something KX did not have before, and now thanks to you it does. Great Job, I just wish maybe the guys with the skinning knowledge..Max,Tiger.etc..would aid you in development. Is it only me who see's the usefulness of this plugin? is it only me who thinks it should be added to the KX installer?- I know it's beta right now. Just my opinions though.
     
  4. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    My plugin introduce no volume change. Why do you have to lower the volume to avoid clipping?


    I can manage to do a skin myself. To insert it in the plugin I just have to look in the SDK to see what I need to do.


    I have never used that THX setup page of the CL driver. I don't know what it does and how good it is.


    From what I know, I can't add an automatic volume control but it could be manual. I could add a volume slider for every channel. aspectus idea of using white noise might be a good idea.


    I'll add an option to choose between imperial system and SI system to my plugin. The calculations are all done in SI and the sliders range are in SI too so the imperial setting will only convert the graphical display that is in SI to decimal imperial. It will be in inches.


    ROBSCIX, you never shared with us how and why you use this plugin. Usually, if your speakers are positionned correctly or if you don't have a special setup, you don't need the plugin. Please share your experience with this plugin with us.


    I initially made this plugin for uipe but I never had feedback from him/her. I wonder if it works well in a car where you don't sit at an equal distance to all the speakers. If someone uses a sound system with a computer and a sound card with emu10kX and the kX drivers, please try the plugin and share your experience with us.
     
  5. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    I don't use the voume plugs because of your plugin..I have them in my setup always...
    I sent you the picture of the THX page..well a link to it, has a guy in the middle....lots of number and settings, for delays for distance from speaker to listener and such. I use your plugin to trim distances of my speakers... Am I wrong for the way I am using this? I am using it to set the exact distances from the speakers to me. I know you designed it for a car application for drastic changes but I thought you can use it for small changes(trimming) to improve spatial imaging. Works for me. Thats why I sent you the link to the pic of that THX set-up page. I thought thats what you were going for with this plugin. SO people could tune and trim their exact speaker locations and listener location within the surround soundfield.
     
    Last edited: Aug 10, 2005
  6. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    You are not wrong. I use it like that too. Mainly to adjust the delay between the front and rear speakers.


    Ok, I understand. My plugin might be doing something similar to what that THX set-up page does but I only saw that picture after writing my plugin. My goal was never to copy someone else work.

    Which soundcard or driver does that THX set-up page come from?


    I will add a slider for the temperature. This temperature would be used to calculate the speed of sound. There is an equation to get the speed of sound here : http://en.wikipedia.org/wiki/Speed_of_sound

    It is : cair = sqrt(kappa * R * T)


    I could also add a display of the angles (in degrees) between the speakers with the listener as the center point if it's needed. Anyone that finds it useful, tell me and I'll implement it. I don't need it myself so I won't implement it if nobody asks me.
     
  7. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    No,No I am not saying your copying someone elses work. Um that idea of exact speaker set up is on a few cards. That one though I think is from the new X-fi. Well I guess the more slider to input data for equations the better IF it helps with sound quality.....do you still have the link to that THX panel. When I seen it I thought, that your plugin could be similar to this with the GUI and such. The concept has been used before. I think it's great we have it now for KX.
     
  8. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
  9. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    Yep, Thats it. See that idea is what I basically use your plug for. For tuning speaker positions as exact as I can. Now I do put a Volume slider on each channel but it is unrelated to your plugin. I us the volume as a final system trim, to prevent clipping. I thought before your plugin that such a setup plugin or page within the KX driver would be great. Then you came up with your plugin. I thought great..this is what I wanted..well in the beta stage anyway. When I seen the THX page I thought I would send you the link as maybe it would spark some ideas for GUI, or calculations to include within your plugin. Don't styop your development. I think having this adds more professionalism to KX. Any thought on a GUI design? I will help anyway I can, I imagine a few other will as well. TO see this plugin developed to what we all think it could/can be..just my opinions..
     
  10. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    New version of the plugin. Both 3537 and 3538i are updated. Use the links in the first post. Tell me if you find any bugs. I'll correct them fast.

    What's new :

    - Temperature slider to control speed of sound
    - Choice between Metric and Imperial

    What changed :

    - The text on the save button changed from "Save" to "Save to TimeBalanceV2 light""
    - The labels for the distance between C-FL and C-FR were moved to place them more centered between the speakers.

    What's to come :

    - A skin
    Probably more.
     
    Last edited: Aug 13, 2005
  11. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Just a suggestion, I think feet would be better units of measurement (for Imperial) than inches.

    <EDIT>
    ...or maybe not. :)
    I guess if you are going to actually measure the distances, than it doesn't really matter, it is just easier to estimate feet than inches.
     
    Last edited: Aug 15, 2005
  12. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    Yup, it's in inches because you measure the distance.
    New version of the plugin available. The functionality stays the same. Only the interface is improved. Same links as before in the first post. I added a second screenshot to show the interface.

    What's new :

    - There is now a basic gui. It's far from being perfect but it's a start.
    - The distances between the listener and the speakers now use a blue font.
    - The distances between the speakers now use a yellow font.
    - I placed the labels of the sliders under the sliders instead of at the left. The interface looks more centered and the sliders are longer, making it easier to adjust with the mouse.
     
  13. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    Nice, now with colors things are more clear. I have been playing with your plugin: I use only an stereo output for music by SPDIF, but what the hell, this plugin still can do his job here.

    I have to make you two sugestions. You use coordinates x-y to set the position of each speaker and listener. Here you has two fails:

    1.- You use six points, and you only need five. The sixth one can be taken as the reference (lets say the listener, the center speaker, or wich you want). Like Benedictus XVI said when he was nominated a Pope, the relativism is omnipresent. (Well, he said something strange about 'the dicatatorship of the relativism' :duh:).

    2.- You are forgetting the third dimension: z. You can set the x-y coordinates very precisely, but if you don't include the z coordinate, it has no sense to use such a precission. And to solve this problem easily, you could simplify your plugin by using distances between listener and speakers (taking listener as the reference) instead of coordinates. I think that is more easy to measure one distance that two (x-y) or three (x-y-z) coordinates.

    See my setup as an example:
    http://users.servicios.retecal.es/decodingtv/speakers.gif
     
  14. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    By the way, you neither have to delay all the inputs, only four of them. In the example of the photo the situaton should be:


    1.- The center speaker is the more closer to the listener, so this should be taken as the reference distance (because you only can delay time, not advance it). This reference distance is then 0.70 m. This speaker shouldn't be delayed.

    2.- Front-left delay: (1.10 m - 0.70 m) * 340 m/s

    2.- Front-right delay: (1.17 m - 0.70 m) * 340 m/s

    2.- Rear-left delay: (1.50 m - 0.70 m) * 340 m/s

    2.- Rear-right delay: (1.60 m - 0.70 m) * 340 m/s

    P.D.: Don't know if you are still doing this in your plugin.
     
  15. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    The reason why the listener position is used is because it's easier to move only the listener than to move all the speakers at the same time around him.

    You are right about the third dimension missing. I thought about it before. Adding another slider for the z dimension would have increased a lot the number of sliders and would have increased the development time. That's not a good reason not to implement the z coordinate but it was when I first wrote the plugin. I could add it now if I want to improve the current system. The other reason was that I thought that most people put their speakers at ear level. Of course that's not always true, my speakers are not.

    The coordinates are used to measure the distances between the listener and the speakers. I could simply ask the user to input the distances between listener and speakers. It's easier to measure these distances but if I use that, I lose the ability to easily move the listener around in the listening environment.

    I'll probably add a combo box to choose wich system of measurement to use between two choices if it's possible:
    - The current system to which I'll add the z coordinate
    - A system where you input the distance of the listener to the speakers.

    I sometimes have problems with the sound if I use an iTram delay of 1. I need to at least use a delay of 2 to get a delay without glitches. Because of the code I use, all the channels pass through iTram. I need to at least delay them by one sample. Since one sample doesn't work correctly, I use a delay of two samples. I offset all the delays by two samples. When all the speakers are the same distance from the listener, there is a delay of two on all the channels.

    After calculating the distances between the listener and the speakers, I find the speaker the smallest distance to the listener. It's the speaker that will get delayed the least, that is a delay of 2.

    You made good comments eyagos. Thank you. I think I cleared all the points you mentionned.


    I use kSlider for my sliders, kStatic for some labels. Is there a command to hide and show them?

    For the labels that are colored differently I don't use kStatic, I use something like :
    Code:
    blDistL_FL.Create("	",WS_CHILD | WS_VISIBLE | SS_CENTER ,CRect(CPoint(245,305),CSize(75,16)), this, LBLDISTL_FL_ID);
    lblDistL_FL.SetBkColor(color_bkg_values);
    lblDistL_FL.SetTextColor(color_txt_listener);
    lblDistL_FL.SetFont(&defaultfont,NULL); 
    How do I hide and show them? Can someone tell me where to look to know what properties after the dot (SetFont, SetBKColor, etc) I can use.

    I would have to load another GUI. I've never seen a plugin that changed (at least I never noticed) depending on an option. Is it possible to have two diferent GUI and load one or the other depending on a combo box choice without closing and reopening the tweak window?
     
  16. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    Tril, your replys has been very clear. Thanks. But I think that there is something 'not very logical' in your plugin. Lets see:

    1.-You want to keep the hability of moving the listener postion, so you need 6 points, determined by 3 coordinates for each one. This makes a total of 18 paramaeters.
    Ok.

    2.- If you dont want to keep the hability of moving the listener position, you only need 5 points, determined by 1 distance for each one. This make a total of 5 parameters.
    Ok.

    3.- You use as the reference point the rear-left corner of the room.
    This is valid, but I think it would be clearer to use the listener as the reference point, and measure the coordinates of speakers from the listener. Naturally, the listener position still can be changed.
    (Does I need a picture to explain this better, or you know what am I talking about??).

    4.-
    But looking at the dane, I think that you are doing this bad. For example:
    I set all the coordinates to zero (this is, the speakers and the listener at the rear-left corner of the room :evil:), and move the rear-right speaker 1 meter away. Then, only the rear-right speaker should be delayed. But if I look at dane, I see the rear-right not delayed (2 samples dalay) and all the others delayed. This has no sense for me!!.


    About the GUI questions, the surrounder plugin hides and show controls. And in FontCtrl.h and ColorCtrl.h you can find all the functions avaliables for the labels that you say.
     
  17. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Most of the kX controls are derived from kWindow, so look at kWindow.h for additional functions that you can use with these controls ( hide(), show(), etc).
     
  18. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I think I understand what you mean. The reference point is at (0,0,0). By default the listener is at (0,0,0). It can be moved but it's there to make it easier to place the speakers, measuring from this point. The coordinates can go from -2.5 to +2.5 (except of z that I'll make shorter, maybe -1 to 1 or less). Tell me if it's what you meant.

    I made a mistake when saying that. I did not look at the code and I remembered incorrectly.

    After calculating the distances between the listener and the speakers, I find which speaker is the biggest distance away from the listener. I use that distance to calculate the maximum delay. I'll give some code. It will make it clear.

    Code:
    MaxDelay = (int)((double)DistL[4] * 48000 / SoS / 1000);
     
     
    DelayFL = (int)((double)MaxDelay - (double)DistL_FL * 48000 / SoS / 1000) + 2;
    DelayFR = (int)((double)MaxDelay - (double)DistL_FR * 48000 / SoS / 1000) + 2;
    DelayRL = (int)((double)MaxDelay - (double)DistL_RL * 48000 / SoS / 1000) + 2;
    DelayRR = (int)((double)MaxDelay - (double)DistL_RR * 48000 / SoS / 1000) + 2;
    DelayC = (int)((double)MaxDelay - (double)DistL_C * 48000 / SoS / 1000) + 2;
    DistL[4] is the biggest distance.
    SoS is Speed of sound. It's calculated using the temperature.

    You have Total delay = delay in the air + delay in soundcard.
    You want Total delay from every channels to be equal.

    The farthest speaker has a bigger delay in the air so it has a shortest delay in the soundcard.


    I'll definitely take your suggestions into account. The first method requires 18 parameters and the second 5 parameters. I'll implement them both. I'll call them Advanced and Basic mode.

    Thank you again. Comments, positive or negatives help me improve the plugin.
     
  19. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    Yes. The idea is to set the speaker positions based on the 'normal' listener position (this should be the absolute reference, normally placed in front of computer screen). But the listener also can be moved from his normal position (in the advanced mode). Coordinates from -2.5 to 2.5 for x-y, of course, and from -1 to 1 for z.
    Note: This is only what I tried to do first time I saw the plugin. But maybe that a little drawing in the interface helps us to see rapidly how the distances are measured.

    Oh yes. You are right. The mistake was mine.

    Thats grate !!!
     
    Last edited: Aug 17, 2005
  20. ROBSCIX

    ROBSCIX New Member

    Joined:
    Mar 28, 2004
    Messages:
    1,732
    Likes Received:
    4
    Trophy Points:
    0
    It's great to see this plugin developing, from feedback. The new GUI is great. Tril, how hard would it be to produce a GUI having a person in the middle, then speakers around the listener, when you move the slider the speakers around the listener also move..indicating to the user exactly what parameter is being changed..does that make sense?...anyway it's cool. I just wish some of these master skinners would aid you in development as well. Keep up the good work tril and know it's appreciated.
     

Share This Page

visited