Giter Club home page Giter Club logo

Comments (4)

lakulish avatar lakulish commented on August 12, 2024

Can you share the relevant portions of code where you're setting up the simulation and rendering settings, and where you're creating and using the Environmental Renderer and Convolution Effect objects? We're trying to reproduce this on our end, and we want to be sure we're testing the same sequence of operations as you have.

Your expectation is correct: the value of maxConvolutionSources should only affect memory consumption, not speed.

from steam-audio.

Slin avatar Slin commented on August 12, 2024

After some more investigating it appears that it is mainly caused by not having any convolution effects with the following setup:

This is the rendering setup:

	_internals->context.allocateCallback = nullptr;
	_internals->context.freeCallback = nullptr;
	_internals->context.logCallback = nullptr;

	_internals->settings.samplingRate = 44100;
	_internals->settings.frameSize = 512;
	_internals->settings.convolutionType = IPL_CONVOLUTIONTYPE_PHONON;

	IPLHrtfParams hrtfParams{IPL_HRTFDATABASETYPE_DEFAULT, nullptr, 0, nullptr, nullptr};
	iplCreateBinauralRenderer(_internals->context, _internals->settings, hrtfParams, &_binauralRenderer);

This is the environment and environmental renderer part, scene can be a valid scene or nullptr:

	IPLSimulationSettings simulationSettings;
	simulationSettings.ambisonicsOrder = 3;
	simulationSettings.irDuration = 0.5f;
	simulationSettings.maxConvolutionSources = 20;
	simulationSettings.numBounces = 16;
	simulationSettings.numDiffuseSamples = 512;
	simulationSettings.numRays = 64000;
	simulationSettings.sceneType = IPL_SCENETYPE_PHONON;

	iplCreateEnvironment(_internals->context, nullptr, simulationSettings, _scene, nullptr, &_environment);	//TODO: 4th paramter should be a scene object for indirect sound modeling
	iplCreateEnvironmentalRenderer(_internals->context, _environment, _internals->settings, _internals->internalAmbisonicsFormat, &_environmentalRenderer);

Then I have a callback calling iplGetMixedEnvironmentalAudio every audio frame:

	iplGetMixedEnvironmentalAudio(_instance->GetEnvironmentalRenderer(),
			IPLVector3{ listenerPosition.x, listenerPosition.y, listenerPosition.z },
			IPLVector3{ listenerForward.x, listenerForward.y, listenerForward.z },
			IPLVector3{ listenerUp.x, listenerUp.y, listenerUp.z }, mixingBuffer[1]);

In this order, this is all that is needed to make it slow. Setting maxConvolutionSources to 0 or another low value makes it fast/better.

Once there is a convolution effect, a value of 20 is not a problem anymore. Setting it to higher numbers like 100 or more will introduce cracking again.

from steam-audio.

lakulish avatar lakulish commented on August 12, 2024

@Slin Ah, got it. Not creating convolution effects results in an unexpected performance hit. We have been able to reproduce this issue, and will be working on a fix. Thanks!

from steam-audio.

kisak-valve avatar kisak-valve commented on August 12, 2024

Closing per "Fixed performance issue when calling iplGetMixedEnvironmentalAudio when no Convolution Effect objects have been created." in the 2.0-beta.5 release notes.

from steam-audio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.