pyroomacoustics.experimental package


Module contents


A bunch of routines useful when doing measurements and experiments.

pyroomacoustics.experimental.measure_ir(sweep_length=1.0, sweep_type='exponential', fs=48000, f_lo=0.0, f_hi=None, volume=0.9, pre_delay=0.0, post_delay=0.1, fade_in_out=0.0, dev_in=None, dev_out=None, channels_input_mapping=None, channels_output_mapping=None, ascending=False, deconvolution=True, plot=True)

Measures an impulse response by playing a sweep and recording it using the sounddevice package.

  • sweep_length (float, optional) – length of the sweep in seconds

  • sweep_type (SweepType, optional) – type of sweep to use linear or exponential (default)

  • fs (int, optional) – sampling frequency (default 48 kHz)

  • f_lo (float, optional) – lowest frequency in the sweep

  • f_hi (float, optional) – highest frequency in the sweep, can be a negative offset from fs/2

  • volume (float, optional) – multiply the sweep by this number before playing (default 0.9)

  • pre_delay (float, optional) – delay in second before playing sweep

  • post_delay (float, optional) – delay in second before stopping recording after playing the sweep

  • fade_in_out (float, optional) – length in seconds of the fade in and out of the sweep (default 0.)

  • dev_in (int, optional) – input device number

  • dev_out (int, optional) – output device number

  • channels_input_mapping (array_like, optional) – List of channel numbers (starting with 1) to record. If mapping is given, channels is silently ignored.

  • channels_output_mapping (array_like, optional) – List of channel numbers (starting with 1) where the columns of data shall be played back on. Must have the same length as number of channels in data (except if data is mono, in which case the signal is played back on all given output channels). Each channel number may only appear once in mapping.

  • ascending (bool, optional) – wether the sweep is from high to low (default) or low to high frequencies

  • deconvolution (bool, optional) – if True, apply deconvolution to the recorded signal to remove the sweep (default 0.)

  • plot (bool, optional) – plot the resulting signal

Return type

Returns the impulse response if deconvolution == True and the recorded signal if not