# SingleRoomSRIR

## Description

The `SingleRoomSRIR`

object stores SOFA data following the
SingleRoomSRIR convention. This convention defines a setup used for measuring spatial room
impulse responses (SRIR) in a single room with a single excitation source (for example, a
loudspeaker) and a listener consisting of an arbitrary number of omnidirectional receivers
(for example, a microphone array). The data is represented as FIR filters, and the positions
of both the source and the listener may vary. The positions of the receivers (with respect to
the listener) are fixed, and the number of emitters can be unlimited, but the data is not
emitter-dependent. If it is required to consider individual emitters separately, use `SingleRoomMIMOSRIR`

instead.

Use `sofaread`

and
`sofawrite`

to read
and write SOFA files with this convention.

## Properties

## Data

`Numerator`

— Impulse responses

`0`

(default) | *M*-by-*R*-by-*N* array

Impulse responses in FIR form, specified as a real-valued
*M*-by-*R*-by-*N* array, where
*M* is the number of measurements, *R* is the number
of receivers, and *N* is the impulse response length.

`Delay`

— Impulse response delay

`0`

(default) | 1-by-*R* matrix | *M*-by-*R* matrix

Delay of each impulse response in samples, specified as a 1-by-*R*
or *M*-by-*R* matrix, where *M* is
the number of measurements and *R* is the number of receivers.

`SamplingRate`

— Sampling rate (Hz)

48000 (default) | positive scalar

Sampling rate of the data in hertz, specified as a positive scalar.

`SamplingRateUnits`

— Sampling rate units

`"hertz"`

This property is read-only.

Sampling rate units, returned as a string.

`DataType`

— Type of data

`"FIR"`

This property is read-only.

Type of data in the file, returned as a string.

## Listener

`ListenerPosition`

— Listener position

`[0 0 0]`

(default) | *M*-by-3 matrix

Listener position in Cartesian or spherical coordinates, specified as an
*M*-by-3 matrix, where *M* is the number of
measurements.

For more information, see Spatial Data Representations.

`ListenerPositionType`

— Listener position type

`"cartesian"`

(default) | `"spherical"`

Listener position type, specified as `"cartesian"`

or
`"spherical"`

.

`ListenerPositionUnits`

— Listener position units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Listener position units, returned as `"meter"`

if
`ListenerPositionType`

is `"cartesian"`

or
`"degree, degree, meter"`

if
`ListenerPositionType`

is `"spherical"`

.

`ListenerView`

— Listener view direction

`[1 0 0]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Listener view direction, specified as a 1-by-3 or *M*-by-3 matrix,
where *M* is the number of measurements. This property defines the
direction of the positive x-axis of the local listener coordinate system.

`ListenerViewType`

— Listener view type

`"cartesian"`

(default) | `"spherical"`

Listener view type, specified as `"cartesian"`

or
`"spherical"`

.

`ListenerViewUnits`

— Listener view units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Listener view units, returned as `"meter"`

if
`ListenerViewType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `ListenerViewType`

is
`"spherical"`

.

`ListenerUp`

— Listener up direction

`[0 0 1]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Listener up direction, specified as a 1-by-3 or *M*-by-3 matrix,
where *M* is the number of measurements. This property defines the
direction of the positive z-axis of the local listener coordinate system.

`ListenerShortName`

— Listener short name

`""`

(default) | string

Listener short name, specified as a string. This property defines the ID of the subject from the database.

`ListenerDescription`

— Listener description

`""`

(default) | string

Listener description, specified as a string.

## Receiver

`ReceiverPosition`

— Receiver positions

`[0 0 0]`

(default) | 1-by-3 matrix | *R*-by-3 matrix | *R*-by-3-by-*M* array

Receiver positions in Cartesian coordinates, spherical coordinates, or spherical
harmonics, specified as a 1-by-3 matrix, *R*-by-3 matrix, or
*R*-by-3-by-*M* array, where *M* is
the number of measurements. If `ReceiverPositionType`

is
`"cartesian"`

or `"spherical"`

, *R*
is the number of receivers. If `ReceiverPositionType`

is
`"spherical harmonics"`

, *R* is the number of
spherical-harmonic coefficients.

For more information, see Spatial Data Representations.

`ReceiverPositionType`

— Receiver position type

`"spherical"`

(default) | `"cartesian"`

| `"spherical harmonics"`

Receiver position type, specified as `"cartesian"`

,
`"spherical"`

, or `"spherical harmonics"`

.

`ReceiverPositionUnits`

— Receiver position units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Receiver position units, returned as `"meter"`

if
`ReceiverPositionType`

is `"cartesian"`

or
`"spherical harmonics"`

. If `ReceiverPositionType`

is `"spherical"`

, the units are returned as ```
"degree, degree,
meter"
```

.

`ReceiverView`

— Receiver view direction

`[1 0 0]`

(default) | *R*-by-3 matrix | *R*-by-3-by-*M* array

Receiver view direction, specified as an *R*-by-3 matrix or
*R*-by-3-by-*M* array, where *M* is
the number of measurements and *R* is the number of receivers. This
property defines the direction of the positive x-axis of the local receiver coordinate
system.

`ReceiverViewType`

— Receiver view type

`"cartesian"`

(default) | `"spherical"`

Receiver view type, specified as `"cartesian"`

or
`"spherical"`

.

`ReceiverViewUnits`

— Receiver view units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Receiver view units, returned as `"meter"`

if
`ReceiverViewType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `ReceiverViewType`

is
`"spherical"`

.

`ReceiverUp`

— Receiver up direction

`[0 0 1]`

(default) | *R*-by-3 matrix | *R*-by-3-by-*M* array

Receiver up direction, specified as an *R*-by-3 matrix or
*R*-by-3-by-*M* array, where *M* is
the number of measurements and *R* is the number of receivers. This
property defines the direction of the positive z-axis of the local receiver coordinate
system.

`ReceiverShortName`

— Receiver short name

`""`

(default) | string

Receiver short name, specified as a string.

`ReceiverDescription`

— General receiver description

`""`

(default) | string

General receiver description, specified as a string.

`ReceiverDescriptions`

— Descriptions for each receiver

empty array (default) | *R*-by-1 string array | *R*-by-1 cell array of character strings

Descriptions for each receiver, specified as an *R*-by-1 string
array or *R*-by-1 cell array of character strings, where
*R* is the number of receivers.

## Source

`SourcePosition`

— Source position

`[0 0 1]`

(default) | *M*-by-3 matrix

Source position in Cartesian or spherical coordinates, specified as an
*M*-by-3 matrix, where *M* is the number of
measurements.

For more information, see Spatial Data Representations.

`SourcePositionType`

— Source position type

`"cartesian"`

(default) | `"spherical"`

Source position type, specified as `"cartesian"`

or
`"spherical"`

.

`SourcePositionUnits`

— Source position units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Receiver position units, returned as `"meter"`

if
`SourcePositionType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `SourcePositionType`

is `"spherical"`

.

`SourceView`

— Source view direction

`[1 0 0]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Source view direction, specified as a 1-by-3 or *M*-by-3 matrix,
where *M* is the number of measurements. This property defines the
direction of the positive x-axis of the local source coordinate system.

`SourceViewType`

— Source view type

`"cartesian"`

(default) | `"spherical"`

Source view type, specified as `"cartesian"`

or
`"spherical"`

.

`SourceViewUnits`

— Source view units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Source view units, returned as `"meter"`

if
`SourceViewType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `SourceViewType`

is
`"spherical"`

.

`SourceUp`

— Source up direction

`[0 0 1]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Source up direction, specified as a 1-by-3 or *M*-by-3 matrix,
where *M* is the number of measurements. This property defines the
direction of the positive z-axis of the local source coordinate system.

`SourceShortName`

— Source short name

`""`

(default) | string

Source short name, specified as a string.

`SourceDescription`

— Source description

`""`

(default) | string

Source description, specified as a string.

## Emitter

`EmitterPosition`

— Emitter position

`[0 0 0]`

(default) | *E*-by-3 matrix | *E*-by-3-by-*M* array

Emitter position in Cartesian or spherical coordinates, specified as a
*E*-by-3 matrix or *E*-by-3-by-*M*
array, where *M* is the number of measurements and *E*
is the number of emitters.

For more information, see Spatial Data Representations.

`EmitterPositionType`

— Emitter position type

`"spherical"`

(default) | `"cartesian"`

Emitter position type, specified as `"cartesian"`

or
`"spherical"`

.

`EmitterPositionUnits`

— Emitter position units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Emitter position units, returned as `"meter"`

if
`EmitterPositionType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `EmitterPositionType`

is `"spherical"`

.

`EmitterView`

— Emitter view direction

`[1 0 0]`

(default) | *E*-by-3 matrix | *E*-by-3-by-*M* array

Emitter view direction, specified as an *E*-by-3 matrix or
*E*-by-3-by-*M* array, where *M* is
the number of measurements and *E* is the number of emitters. This
property defines the direction of the positive x-axis of the local emitter coordinate
system.

`EmitterViewType`

— Emitter view type

`"cartesian"`

(default) | `"spherical"`

Emitter view type, specified as `"cartesian"`

or
`"spherical"`

.

`EmitterViewUnits`

— Emitter view units

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Emitter view units, returned as `"meter"`

if
`EmitterViewType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `EmitterViewType`

is
`"spherical"`

.

`EmitterUp`

— Emitter up direction

`[0 0 1]`

(default) | *E*-by-3 matrix | *E*-by-3-by-*M* array

Emitter up direction, specified as an *E*-by-3 matrix or
*E*-by-3-by-*M* array, where *M* is
the number of measurements and *E* is the number of emitters. This
property defines the direction of the positive z-axis of the local emitter coordinate
system.

`EmitterShortName`

— Emitter short name

`""`

(default) | string

Emitter short name, specified as a string.

`EmitterDescription`

— General emitter description

`""`

(default) | string

General emitter description, specified as a string.

`EmitterDescriptions`

— Descriptions for each emitter

empty array (default) | *E*-by-1 string array | *E*-by-1 cell array of character strings

Descriptions for each emitter, specified as an *E*-by-1 string
array or *E*-by-1 cell array of character strings, where
*E* is the number of emitters.

## Room

`RoomType`

— Room type

`"shoebox"`

(default) | `"dae"`

Type of room used to perform the measurements, specified as a
`"shoebox"`

for data measured under echoic conditions or
`"dae"`

for data measured under echoic conditions with geometry
described by a digital asset (DAE) file.

`RoomDescription`

— Room description

`""`

(default) | string

Informal description of the room used to perform the measurements, specified as a string.

`RoomGeometry`

— Room geometry

`""`

(default) | string

Room geometry, specified as a string containing the uniform resource identifier
(URI) to the file describing the room geometry. This property applies when
`RoomType`

is `"dae"`

.

`RoomLocation`

— Room location

`""`

(default) | string

Room location, specified as a string.

`RoomShortName`

— Room short name

`""`

(default) | string

Room short name, specified as a string.

`RoomCornerA`

— Coordinates of room corner A

`[0 0 0]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Coordinates of room corner A in Cartesian or spherical coordinates, specified as a
1-by-3 or *M*-by-3 matrix, where *M* is the number of
measurements.

This property applies when `RoomType`

is
`"shoebox"`

.

`RoomCornerB`

— Coordinates of room corner B

`[1 2 3]`

(default) | 1-by-3 matrix | *M*-by-3 matrix

Coordinates of room corner B in Cartesian or spherical coordinates, specified as a
1-by-3 or *M*-by-3 matrix, where *M* is the number of
measurements.

This property applies when `RoomType`

is
`"shoebox"`

.

`RoomCornersType`

— Type of room corner coordinates

`"cartesian"`

(default) | `"spherical"`

Type of room corner coordinates, specified as `"cartesian"`

or
`"spherical"`

.

`RoomCornersUnits`

— Units of room corner coordinates

`"meter"`

| `"degree, degree, meter"`

This property is read-only.

Units of room corner coordinates, returned as `"meter"`

if
`RoomCornersType`

is `"cartesian"`

or
`"degree, degree, meter"`

if `RoomCornersType`

is
`"spherical"`

.

This property applies when `RoomType`

is
`"shoebox"`

.

`RoomTemperature`

— Temperature of room

0 (default) | scalar | vector of length *M*

Temperature of the room during the measurements, in kelvins, specified as a scalar
or vector of length *M*, where *M* is the number of
measurements.

`RoomVolume`

— Volume of room

0 (default) | scalar | vector of length *M*

Volume of the room used to perform the measurements, in cubic meters, specified as a
scalar or vector of length *M*, where *M* is the
number of measurements.

## Metadata

`MeasurementDate`

— Measurement date

`0`

(default) | vector of length *M*

Date and time of each measurement, specified as a vector of length
*M*, where *M* is the number of measurements. Each
element is a date value (for example, `datetime("today")`

).

`SOFAConventions`

— Name of SOFA convention

`"SingleRoomSRIR"`

This property is read-only.

Name of the SOFA convention, returned as a string.

`DatabaseName`

— Name of database

`""`

(default) | string

Name of the database that this data belongs to, specified as a string.

`Version`

— Version of specifications

`"2.1"`

(default) | string

This property is read-only.

Version of the SOFA AES69 specifications, returned as a string of the format
`"x.y"`

where `x`

is the version major and
`y`

is the version minor.

`APIName`

— Name of API

`"Audio Toolbox"`

(default) | string

This property is read-only.

Name of the API that created or edited the SOFA file, returned as a string.

`APIVersion`

— Version of API

`"1.0"`

(default) | string

This property is read-only.

Version of the API that created or edited the SOFA file, returned as a string of the
format `"x.y"`

or `"x.y.z"`

where `x`

is the version major and `y`

and `z`

are the version
minors.

`SOFAConventionsVersion`

— Version of convention set

`"1.0"`

(default) | string

This property is read-only.

Version of the SOFA AES69 convention set, returned as a string of the format
`"x.y"`

where `x`

is the version major and
`y`

is the version minor.

`Title`

— Title

`""`

(default) | string

Title containing a succinct description of the file contents, specified as a string.

`AuthorContact`

— Contact information of author

`""`

(default) | string

Contact information of the author (for example, an email address), specified as a string.

`Organization`

— Name of organization

`""`

(default) | string

Name of the organization of the author, specified as a string.

`License`

— Legal license

`""`

(default) | string

Legal license under which the data is provided, specified as a string.

`ApplicationName`

— Name of application

`"Audio Toolbox"`

(default) | string

Name of the application that created or edited the file, specified as a string.

`ApplicationVersion`

— Version of application

`"3.0.0"`

(default) | string

Version of the application that created or edited the file, specified as a string.

`Comment`

— Comment

`""`

(default) | string

Comment that can contain miscellaneous information about the data or methods used to produce the data, specified as a string.

`History`

— History

`""`

(default) | string

History defining the audio trail for modifications to the original data, specified as a string.

`References`

— References

`""`

(default) | string

Published or web-based references that describe the data or the methods used to produce the data, specified as a string.

`Origin`

— Origin

`""`

(default) | string

Origin, specified as a string representing the method used for creating the original data. In the case of model-generated data, the origin should name the model and its version. In the case of observed or measured data, the origin should characterize the data and, where possible, name the measurement method.

`DateCreated`

— Date created

string

This property is read-only.

Date and time of the creation of the file, returned as a string in ISO 8601 format
`"YYYY-MM-DD hh:mm:ss"`

. This property is set when a new file is
created.

`DateModified`

— Date modified

string

This property is read-only.

Date and time of the last file modification, returned as a string in ISO 8601 format
`"YYYY-MM-DD hh:mm:ss"`

. This property is updated when a file is
saved.

## Examples

### Create SingleRoomSRIR SOFA File

Create a SOFA template object following the SingleRoomSRIR convention for storing room impulse responses.

`s = sofaconvention("SingleRoomSRIR");`

Read in a room impulse response measurement.

`[ir,fs] = audioread("ChurchImpulseResponse-16-44p1-mono-5secs.wav");`

Initialize the `Numerator`

property to store the five-second-long impulse response measurement for one receiver.

M = 1; R = 1; N = size(ir,1); s.Numerator = zeros(M,R,N);

Store the room impulse response in the SOFA object. Set the `RoomDescription`

to describe the room that was measured.

```
s.Numerator(1,1,:) = ir;
s.SamplingRate = fs;
s.RoomDescription = "Church";
```

Save the data to a SOFA file.

`sofawrite("roomIR.sofa",s);`

## More About

### Spatial Data Representations

In this SOFA convention, you can represent spatial data using Cartesian or spherical coordinate systems with spatially discrete representations. Alternatively, you can represent spatial data with a continuous representation using spherical harmonics.

Each spatial representation stores the position data in numerical triplets (for example,
`[0 0 0]`

).

Cartesian coordinates contain three orthogonal linear values in the format

`[x y z]`

. The units of the values are meters.Spherical coordinates contain angular values for azimuth and elevation and a linear value for the radius in the format

`[azimuth elevation radius]`

. The azimuth angle, in degrees, must be in the range [0, 360). The elevation angle, in degrees, must be in the range [-90, 90]. The units of the linear radius are meters.The spatially continuous representation uses the spatial frequency domain represented by a finite series of spherical harmonics. The position data stores the real-valued spherical-harmonic coefficients in Ambisonic Channel Number (ACN) order. For spherical harmonics, only the third element of the triplet is relevant.

The number of spherical-harmonic coefficients

*N*defines the highest spherical-harmonic order*L*, where*N*=(*L*+1)^{2}.

## Version History

**Introduced in R2023b**

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)