pyfar.signals.files#

This module contains anechoic audio content and impulse responses for listening and illustration. Note that each file has a separate license that is listed below.

Quick listening is, e.g., possible with sounddevice installed:

>>> import pyfar as pf
>>> import sounddevice as sd
>>> # Load, illustrate and play speech signal
>>> speech = pf.signals.files.speech()
>>> pf.plot.spectrogram(speech)
>>> sd.play(speech.time.T, speech.sampling_rate)

Functions:

binaural_room_impulse_response([...])

Get a binaural room impulse response (BRIR).

castanets([sampling_rate])

Get an anechoic castanet sample.

drums([sampling_rate])

Get a dry drum sample.

guitar([sampling_rate])

Get an anechoic guitar sample.

head_related_impulse_responses([position, ...])

Get HRIRs for specified source positions and sampling rate.

headphone_impulse_responses([sampling_rate])

Get Headphone Impulse Responses (HpIRs).

room_impulse_response([sampling_rate])

Get a room impulse response (RIR).

speech([voice, sampling_rate])

Get an anechoic speech sample.

pyfar.signals.files.binaural_room_impulse_response(diffuse_field_compensation=False, sampling_rate=48000)[source]#

Get a binaural room impulse response (BRIR).

The BRIR was recorded with the FABIAN head and torso simulator in the Berliner Philharmonie [1] (Emitter 17). The head of FABIAN was rotated 25 degree to the right. For more information see [2]. A matching room impulse response can be obtained by room_impulse_response.

Note

License: CC BY-NC-SA 4.0, David Ackermann, Audio Communication Group, Technical University of Berlin

Parameters:
  • diffuse_field_compensation (bool, optional) – Apply a diffuse field compensation to the BRIR. This can be used as a simple headphone compensation filter when listening to the BRIR. The default is False, which does not apply the compensation. The diffuse field compensation is taken from head_related_impulse_responses

  • sampling_rate (int, optional) – The sampling rate of the BRIR in Hz. The default of 48000 uses the BRIR as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

brir – The BRIR

Return type:

Signal

References

pyfar.signals.files.castanets(sampling_rate=44100)[source]#

Get an anechoic castanet sample.

Castanets rhythm from EUB SQAM CD track 27 re-programmed as anechoic version using samples from the Vienna Symphonic Library [3].

Note

License: CC 0, Matthias Frank

Parameters:

sampling_rate (int, optional) – The sampling rate of the sample in Hz. The default of 44100 uses the sample as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

castanets – The castanets sample.

Return type:

Signal

References

pyfar.signals.files.drums(sampling_rate=48000)[source]#

Get a dry drum sample.

The sample was recorded with microphones close to the drums in a dry rehearsal room.

Note

License: CC BY Fabian Brinkmann, Johannes M. Arend

Parameters:

sampling_rate (int, optional) – The sampling rate of the sample in Hz. The default of 44100 uses the sample as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

drums – The drum sample.

Return type:

Signal

pyfar.signals.files.guitar(sampling_rate=48000)[source]#

Get an anechoic guitar sample.

The data is an excerpt from the file Flamenco2_U89.wav from the Cologne University of Applied Sciences, Anechoic Recordings [4].

Note

License: CC BY-SA Michio Woirgard, Philipp Stade, Jeffrey Amankwor, Benjamin Bernschütz and Johannes Arend, Audio Group, Cologne University of Applied Sciences

Parameters:

sampling_rate (int, optional) – The sampling rate of the sample in Hz. The default of 48000 uses the sample as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

guitar – The guitar sample.

Return type:

Signal

References

Get HRIRs for specified source positions and sampling rate.

The head-related impulse responses (HRIRs) are taken from the FABIAN database [5]. They are shortened to 128 samples for convenience. HRIRs are available on the horizontal plane (elevation equals zero degrees, azimuth angles available between 0 and 360 degrees in steps of two degrees) and median plane (azimuth equals 0 or 180 degrees, elevation angles available between -90 and 90 degrees in steps of two degrees).

Note

License: CC BY 4.0 Fabian Brinkmann, Alexander Lindau, Stefan Weinzierl, Gunnar Geissler, Steven van de Par, Markus Müller-Trapet, Rob Opdam, Michael Vorländer

Parameters:
  • position (list, str, optional) –

    The positions for which HRIRs are returned.

    'horizontal'

    Return horizontal plane HRIRs with an angular resolution of 2 degrees.

    'median'

    Return median plane HRIRs with an angular resolution of 2 degrees.

    List of coordinates

    Return HRIRs at specific positions defined by a list of azimuth and elevation values in degrees. For example [[30, 0], [330, 0]] returns HRIRs on the horizontal plane (0 degree elevation) for azimuth angles of 30 and 330 degrees.

    The default is [[0, 0]], which returns the HRIR for frontal sound incidence. A ValueError is raised if the requested position is not available.

  • diffuse_field_compensation (bool, optional) – Apply a diffuse field compensation to the HRIRs. This can be used as a simple headphone compensation filter when listening to the HRIRs. The default is False, which does not apply the compensation.

  • sampling_rate (int, optional) – The sampling rate of the HRIRs in Hz. The default of 44100 uses the HRIRs as they are, any other value uses resample for resampling to the desired sampling rate.

Returns:

  • hrirs (signal) – The HRIRs.

  • sources (Coordinates) – The source positions for which the HRIRs are returned.

References

pyfar.signals.files.headphone_impulse_responses(sampling_rate=44100)[source]#

Get Headphone Impulse Responses (HpIRs).

The HpIRs are taken from the FABIAN database [6]. They were measured with Sennheiser HD-650 headphones.

Note

License: CC BY 4.0 Fabian Brinkmann, Alexander Lindau, Stefan Weinzierl, Gunnar Geissler, Steven van de Par, Markus Müller-Trapet, Rob Opdam, Michael Vorländer

Parameters:

sampling_rate (int, optional) – The sampling rate of the HpIRs in Hz. The default of 44100 uses the HpIRs as they are, any other value uses resample for resampling to the desired sampling rate.

Returns:

hpirs – The HpIRs.

Return type:

signal

References

pyfar.signals.files.room_impulse_response(sampling_rate=48000)[source]#

Get a room impulse response (RIR).

The RIR was recorded with class I 1/2 inch measurement microphone in the Berliner Philharmonie [7] (Emitter 17). For more information see [8]. A matching binaural room impulse response can be obtained by brir.

Note

License: CC BY-NC-SA 4.0, David Ackermann, Audio Communication Group, Technical University of Berlin.

Parameters:

sample_rate (int, optional) – The sampling rate of the RIR in Hz. The default of 48000 uses the RIR as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

rir – The RIR

Return type:

Signal

References

pyfar.signals.files.speech(voice='female', sampling_rate=44100)[source]#

Get an anechoic speech sample.

The samples were taken from ‘Music for Archimedes’ [9] (Tracks 4, 5) with kind permission of Bang & Olufsen for research and personal purposes. Any commercial use or publication requires approval of Bang & Olufsen. For more information on the recordings see [10].

Note

Copyright: Bang & Olufsen

Parameters:
  • voice (str, optional) – Choose between a 'female' (default) and 'male' voice.

  • sampling_rate (int, optional) – The sampling rate of the sample in Hz. The default of 44100 uses the sample as it is, any other value uses resample for resampling to the desired sampling rate.

Returns:

speech – The speech sample.

Return type:

Signal

References