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

HRTF example has a resampling bug #215

Open
Q-Qian opened this issue Jan 24, 2024 · 1 comment
Open

HRTF example has a resampling bug #215

Q-Qian opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels

Comments

@Q-Qian
Copy link
Contributor

Q-Qian commented Jan 24, 2024

when I test ex_hrtf_spatialization function in Examples.hpp, there was no sound play out.

Reason:
the input audio's sampleRate is different from HRTF impulse sampleRate, need resample impulse array using src_simple function of libsamplerate module:

int result = src_simple(&convert, SRC_SINC_FASTEST, 1);
        if (result != 0)
        {
            std::unique_ptr<AudioBus> silentBus(new AudioBus(numberOfSourceChannels, static_cast<int>(sourceBus->length() / sampleRateRatio)));
            silentBus->setSampleRate(newSampleRate);
            return silentBus;
        }

libsamplerate project is a sub project of LabSound, after compile LabSound project, samplerate.c can't find the ENABLE_SINC_FAST_CONVERTER macro defined in CMakeLists.txt in libsamplerate/src/ :

#ifdef ENABLE_SINC_FAST_CONVERTER
	case SRC_SINC_FASTEST :
		state = sinc_state_new (converter_type, channels, &temp_error) ;
		break ;
#endif

this bug make a silence HRTF impulse, so that, the audio muted after convolved by before impulse.

@meshula
Copy link
Member

meshula commented Jan 25, 2024

Thanks for the report. I reproduced the problem on a machine with 48khz playback. Can you try this fix, which I pushed to top of tree? 21e4e5f

@meshula meshula self-assigned this Jan 25, 2024
@meshula meshula added the bug label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants