Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add speed of sound as a parameter #23

Closed
FrancoisGrondin opened this issue Mar 22, 2018 · 3 comments
Closed

Add speed of sound as a parameter #23

FrancoisGrondin opened this issue Mar 22, 2018 · 3 comments

Comments

@FrancoisGrondin
Copy link

It would be interesting to be able to add the speed of sound as a parameter for the room. This value seems to be hardcoded to 343 m/sec, but it may change according to the temperature within the room, and one may want to play with this parameter.

Thanks!

@fakufaku
Copy link
Collaborator

Hi François, physical constants are currently set package wide. It is possible to change their values like this.

import pyroomacoustics as pra
pra.constants.set('c', 350)

You can also get the current value.

c = pra.constants.get('c')
print('The speed of sound is:', c)

Do you think there would be a need to set the speed of sound for individual rooms ?

@FrancoisGrondin
Copy link
Author

Thank you for the precision! In this case I think this is sufficient :) The way I see it is that the room object holds all physical properties of the room (dimensions, absorption, etc.) and thus to my view it was logical to also include speed of sound as it depends on physical properties such as temperature, humidity and pressure. That being said, I feel this can be easily done with the method you just showed me.

Thanks!

@fakufaku
Copy link
Collaborator

Thanks for the input. It makes a lot of sense. I think the reason I originally did that is that several modules/objects need the parameter (Room, Beamformer, DOA, etc) and that rather than passing c around I have created a global variable.

That being said, the actual physical parameter and the value used in the processing algorithm does not need to be the same. It might actually need to be different when evaluating the impact of model mismatch for example. So I might get around to pushing c in room at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants