Main Content

SimpleHeadphoneIR

SimpleHeadphoneIR SOFA convention

Since R2023b

    Description

    The SimpleHeadphoneIR object stores SOFA data following the SimpleHeadphoneIR convention. This convention stores impulse responses with a one-to-one correspondence between emitter and receiver. The main application of this convention is to store headphone impulse responses recorded for an emitter-ear pair. When measuring headphones, two emitters (E1 and E2) are typically placed on a listener's head, and two microphones are placed in the listener's ears (R1 and R2). In the first measurement, two transfer functions are measured: direct (E1 to R1) and crosstalk (E1 to R2). In the second measurement, two further transfer functions are measured (E2 to R1 and E2 to R2). SimpleHeadphoneIR is designed to store this correspondence of direct impulse responses. In case it is required to store the crosstalk impulse responses as well, use GeneralFIR instead.

    Use sofaread and sofawrite to read and write SOFA files with this convention.

    Creation

    Create a SimpleHeadphoneIR object using sofaconvention.

    s = sofaconvention("SimpleHeadphoneIR");

    Properties

    expand all

    Data

    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. The number of receivers is typically equal to 2 in this convention.

    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. The number of receivers is typically equal to 2 in this convention.

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

    This property is read-only.

    Sampling rate units, returned as a string.

    This property is read-only.

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

    Listener

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

    For more information, see Spatial Data Representations.

    Listener position type, specified as "cartesian" or "spherical".

    This property is read-only.

    Listener position units, returned as "meter" if ListenerPositionType is "cartesian" or "degree, degree, meter" if ListenerPositionType is "spherical".

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

    Listener description, specified as a string.

    Receiver

    Receiver positions in Cartesian or spherical coordinates, specified as a 2-by-3 matrix or 2-by-3-by-M array, where M is the number of measurements and 2 represents the number of receivers. The default value assumes the head has a radius of 0.09 meters.

    For more information, see Spatial Data Representations.

    Receiver position type, specified as "cartesian" or "spherical".

    This property is read-only.

    Receiver position units, returned as "meter" if ReceiverPositionType is "cartesian" or "degree, degree, meter" if ReceiverPositionType is "spherical".

    General receiver description, specified as a string.

    Measurement-dependent receiver description, specified as an M-by-1 string array or M-by-1 cell array of character strings. Each string describes the receiver for a specific measurement.

    Source

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

    For more information, see Spatial Data Representations.

    Source position type, specified as "cartesian" or "spherical".

    This property is read-only.

    Receiver position units, returned as "meter" if SourcePositionType is "cartesian" or "degree, degree, meter" if SourcePositionType is "spherical".

    Source description, specified as a string.

    Source model, specified as a string. The source model must uniquely describe the headphones of the manufacturer.

    Measurement-dependent source model, specified as an M-by-1 string array or M-by-1 cell array of character strings. Each string is the name of the headphone model for a specific measurement.

    Source manufacturer, specified as a string.

    Measurement-dependent source manufacturer, specified as an M-by-1 string array or M-by-1 cell array of character strings. Each string is the name of the headphone manufacturer for a specific measurement.

    Source URI, specified as a string.

    Emitter

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

    For more information, see Spatial Data Representations.

    Emitter position type, specified as "cartesian" or "spherical".

    This property is read-only.

    Emitter position units, returned as "meter" if EmitterPositionType is "cartesian" or "degree, degree, meter" if EmitterPositionType is "spherical".

    General emitter description, specified as a string.

    Measurement-dependent emitter description, specified as an M-by-1 string array or M-by-1 cell array of character strings. Each string describes the emitter for a specific measurement.

    Room

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

    Metadata

    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")).

    This property is read-only.

    Name of the SOFA convention, returned as a string.

    Name of the database that this data belongs to, specified as a 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.

    This property is read-only.

    Name of the API that created or edited the SOFA file, returned as a 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.

    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 containing a succinct description of the file contents, specified as a string.

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

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

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

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

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

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

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

    Published or web-based references that describe the data or the methods used to produce the data, specified as a 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.

    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.

    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.

    Object Functions

    writeWrite SOFA file
    validateValidate SOFA data

    Examples

    collapse all

    Create a SOFA template object following the SimpleHeadphoneIR convention.

    s = sofaconvention("SimpleHeadphoneIR");

    Generate mock impulse response data to store in the file. Set the number of measurements M to two and set the impulse response length N to 1024. The number of receivers R is two, corresponding to two ears. Use the fir1 function to create arbitrary FIR filters for the impulse response measurements.

    M = 2;
    N = 1024;
    R = 2;
    
    IR = zeros(M,R,N);
    IR(1,:,:) = [fir1(N-1,0.1);fir1(N-1,.2)];
    IR(2,:,:) = [fir1(N-1,0.15);fir1(N-1,.25)];

    Store the measurements in the SOFA object.

    s.Numerator = IR;

    Save the data to a SOFA file.

    sofawrite("mockHeadphoneIRData.sofa",s);

    More About

    expand all

    Version History

    Introduced in R2023b