pygsound icon indicating copy to clipboard operation
pygsound copied to clipboard

About how to add directional simulation in the pygsound

Open xtgg4310 opened this issue 3 years ago • 4 comments

Dear author:

I would like to know how to add directional simulation in the pygsound. I notice that parameter "Sounddirectivity" in Context.cpp can be set true. Also, in GSound/gsSoundDirectivity.cpp, it seems that several sound pattern has been defined in the program. So how can I set up the directional simulation method.

Best wishes.

xtgg4310 avatar Dec 19 '22 13:12 xtgg4310

It is possible. GSound has well-defined directivity described here https://github.com/GAMMA-UMD/pygsound/blob/8f41cb13da5dba9aa09cac3f42e668005ed5cf11/src/GSound/gsound/gsSoundDirectivity.h#L70-L83

But setting that flag to True only initializes an omnidirectional pattern which doesn't do anything, a specific pattern needs to be assigned following definitions in GSound/gsSoundDirectivity.cpp as you've noticed. For people who are familiar with C++, it should be easy to leverage this API. However, I have not exposed it in current python bindings just like many other functionalities that are less often used. I may not have the bandwidth to do these additions myself. But pull requests are welcome.

Graphi07 avatar Dec 20 '22 20:12 Graphi07

Thanks for your answer, I have add a specific pattern in the program and simulate a directional acoustic wave. I want to know the definition of angle and theta in GSound/gsSoundDirectivity.cpp. I find the view direction of the source is -transform.orientioan.z. Does this mean that the value of theta and phi are corresponding to the z-axis?

xtgg4310 avatar Jan 01 '23 16:01 xtgg4310

By the way, I just found that I fail to add a sound pattern to the source. I initialise the SoundSource with the pattern defined in the SoundDirectivity in gsSoundSource.cpp but get the same RIR. Is this operation right? Or should I realise other API about SoundDirectivity.

Best wishes.

xtgg4310 avatar Jan 02 '23 09:01 xtgg4310

By the way, I just found that I fail to add a sound pattern to the source. I initialise the SoundSource with the pattern defined in the SoundDirectivity in gsSoundSource.cpp but get the same RIR. Is this operation right? Or should I realise other API about SoundDirectivity.

Best wishes.

I cannot comment on this case without codes. My suggestion is to step into the key functions (or just print them out if you have difficulty setting up a debugger) to make sure that your new directivity is actually being called in the expected way.

Regarding coordinate convention - yes I believe the convention used throughout this project is ZYX in which -z is forward, +x is right, and +y is up.

Graphi07 avatar Jan 06 '23 01:01 Graphi07