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

Source directivity and various extensions to gpuRIR #27

Open
wants to merge 121 commits into
base: master
Choose a base branch
from

Conversation

fuerbringer
Copy link
Contributor

@fuerbringer fuerbringer commented Dec 15, 2021

As part of a semester project at uni we've expanded gpuRIR with the following features:

Source Directivity (fixes #16)

You can now steer the source and apply polar patterns with the new parameters orV_src and spkr_pattern.

For this purpose we've generated polar plots of the various patterns by rotating the source by 360 degrees:

polar_plot

Note: The source directivity features has been merged in #28

Extensions

We've developed various filters to make the Room impulse responses generated by gpuRIR more realistic. They're located in gpuRIR/extensions and can be imported as gpuRIR.extensions.*.

You can see them in action in our example scripts examples/mono_filters.py and examples/stereo_filters.py. Also consult the readme: gpuRIR/extensions/README.md.

We've uploaded the speech+guitar tracks which we've convolved with the RIRs that have gone through our filters: https://soundcloud.com/user-500297940/sets/gpurir-sound-samples

For reference, here's a spectrogram of a RIR generated by gpuRIR without any filters:

no_filter_spektro

Air absorption

We've created filters to apply the effects or air absorption to the RIRs. For this we've devised two options: Using the Short-time fourier transform or a bandpassed variant to apply the attenuations. The result is higher frequencies decaying much faster than lower frequencies which immidiately makes the RIRs sound more realistic.

STFT

stft_airabs_spektro

Bandpass

bandpass_airabs_spektro

Source and receiver characteristics

We've created filters to model frequency responses for speakers and microphones. Here's the Shure SM57 simulated:

char_sm57_spektro

Binaural Receivers

You can generate stereo RIRs (two channels). You can specify a position where the head shall be placed and the direction it looks towards. Then our code automatically places receivers where the "ears" should be. Here you can see a head placed in 3d space:

hrtf_3d

Head-related transfer function HRTF

We apply the effects of the HRTF to the RIRs generated by gpuRIR by using HRIRs from the CIPIC database. Note that we solely use the direct path vector between the head and source to calculate the azimuth and elevation.

image_2021-12-15_20-39-03

Frequency dependant wall absorption coefficients

Sound is reflected by sources dependant on the frequency. For this, we've consulted literature and extracted coefficients for various materials and frequencies. You can now define the materials the six walls in a room are made out of.

Here's a room made out of wallpapers on lime cement plaster, glued parquet floors and a concrete ceiling:

Freq_dep_mono


We think our extensions demonstrate the great usefulness and possible application of gpuRIR. If you feel like the extensions fit in the upstream repo, then we'd greatly appreciate it. Otherwise we can also keep the on our fork and only leave the source directivity in this PR.

If there's anything unclear or change suggestions, please tell us.

Thanks to our advisor(s) @schmiph2 for the very helpful support throughout the project and @DavidDiazGuerra for answering our questions regarding source directivity in great detail.

Best regards,
Severin (@fuerbringer) and Oliver (@corrooli)

corrooli and others added 30 commits September 14, 2021 19:44
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
absorption. Not yet working

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
well right now

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
splitting frequency ranges into
different bands.

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
(importing into other scripts, terminal arguments)

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
testing

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: TheBlueFireFox <adrian.hornung@yahoo.de>
Co-Authored-By: fuerbsev <fuerbsev@students.zhaw.ch>
Implement multi-processing, increase bandpass air absorption speed dramatically
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
and backwards filtering

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Ready to implement into code

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Add SM57 and iPhone X frequency responce model.

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
corrooli and others added 16 commits December 8, 2021 19:48
implement sos in freq_dep_abs_coeff

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Fix pinna offset errors

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Extending room parameters with beta

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Further refactoring

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Further refactoring
More comments

Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
Co-Authored-By: fuerbringer <severin@fuerbringer.info>
@DavidDiazGuerra
Copy link
Owner

Thank you very much @fuerbringer and @corrooli for all this work. By now, I have merged your PR with the source directivity implementation and I'll review the rest of the features during the next month.

@DavidDiazGuerra
Copy link
Owner

Hello!

I've made a couple of commits to the master branch of my repo today. fa32eb3 fixes a bug you had with the shared memory of calcAmpTau_kernel (I don't know why GitHub says that I changed the whole src/gpuRIR_cuda.cu file when I just made minor changes in lines 313 and 805) and ae84cab avoid copying the orientation of the sources and receivers to shared memory for omnidirectional directivity patterns so you can compute more RIRs in that case.

Could you add those commits to your branch so I can test your PR with that bug fixed?

@DavidDiazGuerra
Copy link
Owner

I could do it myself. I'll take a look at the extensions you propose in the following days/weeks.

@fuerbringer
Copy link
Contributor Author

Sorry about that bug! Glad it could be fixed, though. We're currently in our end-of-semester exam phase until the end of January, so couldn't respond right away. Looking forward to see what you think of the extensions.

@DavidDiazGuerra
Copy link
Owner

Don't worry about the bug, that things happen. I know this isn't a good time for students, good luck with your exams!

@DavidDiazGuerra
Copy link
Owner

Hi @fuerbringer and @corrooli,

The extensions that you developed are really interesting, especially those about air absorption and frequency-dependent wall coefficients. I would love to integrate them better with the rest of the library, but I've been trying to find some time to do it during the past weeks and it was just impossible. I hope to be able to find some time for this in the future, but for now, I think I will accept the PR as you developed it.

However, before accepting the PR, I think it would be interesting if you include in extensions/README.md the references for the techniques that you used for your implementations. Most of them are approximations and there might be several ways to do them in the literature, so users could be interested in knowing which techniques are you using so they can be aware of their limitations when using the library.

Best regards,
David

@fuerbringer
Copy link
Contributor Author

fuerbringer commented Mar 19, 2022

Hi @DavidDiazGuerra

We could definitely reference the literature used and point out the limitations of our extensions. But we're in a similar situation, barely finding time for anything. We're currently working on our bachelor's thesis (computational acoustics based on parallel Adaptive Rectangular Decomposition) and job hunting and all that. Hopefully we'll find a free afternoon this semester to do it though.

@DavidDiazGuerra
Copy link
Owner

Ok, don't worry about this, there's no hurry. Just try to add the references when you have some time.

Good luck with your bachelor's thesis, it sounds really interesting and I'm sure you'll do a great job.

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

Successfully merging this pull request may close these issues.

Source Directivity
3 participants