pyroomacoustics.soundsource module¶
- class pyroomacoustics.soundsource.SoundSource(position, images=None, damping=None, generators=None, walls=None, orders=None, signal=None, delay=0, directivity=None)¶
Bases:
object
A class to represent sound sources.
This object represents a sound source in a room by a list containing the original source position as well as all the image sources, up to some maximum order.
It also keeps track of the sequence of generated images and the index of the walls (in the original room) that generated the reflection.
- add_signal(signal)¶
Sets signal attribute
- Parameters
signal (ndarray) – a N-length ndarray, representing a sequence of samples generated by the source.
- distance(ref_point)¶
- get_damping(max_order=None)¶
- get_images(max_order=None, max_distance=None, n_nearest=None, ref_point=None)¶
Keep this for compatibility Now replaced by the bracket operator and the setOrdering function.
- get_rir(mic, visibility, Fs, t0=0.0, t_max=None)¶
Compute the room impulse response between the source and the microphone whose position is given as an argument.
- Parameters
mic (ndarray) – microphone position
visibility (int32) – 1 if mic visibile from source, 0 else. Exact type is important for C extension
Fs (int) – sampling frequency
t0 (float) – time offset, defaults to 0
t_max (None) – max time, defaults to 1.05 times the propagation time from mic to source
- set_directivity(directivity)¶
Sets self.directivity as a list of directivities with 1 entry
- set_ordering(ordering, ref_point=None)¶
Set the order in which we retrieve images sources. Can be: ‘nearest’, ‘strongest’, ‘order’ Optional argument: ref_point
- wall_sequence(i)¶
Print the wall sequence for the image source indexed by i
- pyroomacoustics.soundsource.build_rir_matrix(mics, sources, Lg, Fs, epsilon=0.005, unit_damping=False)¶
A function to build the channel matrix for many sources and microphones
- Parameters
mics (ndarray) – a dim-by-M ndarray where each column is the position of a microphone
sources (list of pyroomacoustics.SoundSource) – list of sound sources for which we want to build the matrix
Lg (int) – the length of the beamforming filters
Fs (int) – the sampling frequency
epsilon (float, optional) – minimum decay of the sinc before truncation. Defaults to epsilon=5e-3
unit_damping (bool, optional) – determines if the wall damping parameters are used or not. Default to false.
- Returns
the function returns the RIR matrix H =
:: – ——————– | H_{11} H_{12} … | … | ——————–
where H_{ij} is channel matrix between microphone i and source j.
H is of type (M*Lg)x((Lg+Lh-1)*S) where Lh is the channel length (determined by epsilon),
and M, S are the number of microphones, sources, respectively.