Function
| Static Public Summary | ||
| public |
almostEquals(value: Number, reference: Number, tolerance: Number): Number Test whether a value is around a reference, given a tolerance. |
|
| public |
Test whether a value is around a reference, given a tolerance and a modulo. |
|
| public |
Get the arc-tangent (2 arguments) of 2 angles in degrees. |
|
| public |
conformSofaCoordinateSystem(system: String): String Prefix SOFA coordinate system with |
|
| public |
Get the cosinus of an angle in degrees. |
|
| public |
createDiracBuffer(options: Object): AudioBuffer Create a Dirac buffer, zero-padded. |
|
| public |
createNoiseBuffer(options: Object): AudioBuffer Create a noise buffer. |
|
| public |
Convert a dB value to a linear amplitude, i.e. |
|
| public |
Get the distance between to points. |
|
| public |
distanceSquared(a: Object, b: Object): Number Get the squared distance between to points. |
|
| public |
fromRadian(angle: Number): Number Convert an angle in radians to degrees. |
|
| public |
glToSofaCartesian(out: Coordinates, a: Coordinates): Coordinates Convert openGL coordinates to SOFA cartesian. |
|
| public |
glToSofaSpherical(out: Coordinates, a: Coordinates): Coordinates Convert openGL coordinates to SOFA spherical. |
|
| public |
glToSpat4Cartesian(out: Coordinates, a: Coordinates): Coordinates Convert openGL coordinates to Spat4 cartesian. |
|
| public |
glToSpat4Spherical(out: Coordinates, a: Coordinates): Coordinates Convert openGL coordinates to Spat4 spherical. |
|
| public |
glToSystem(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates Convert openGL coordinates to other system. |
|
| public |
parseDataSet(input: String): Object Parse data set meta data into an object of |
|
| public |
Parses a SOFA JSON string with into an object with |
|
| public |
resampleFloat32Array(options: Object): Promise.<Float32Array | Error> Convert an array, typed or not, to a Float32Array, with possible re-sampling. |
|
| public |
Get the sinus of an angle in degrees. |
|
| public |
sofaCartesianToGl(out: Coordinates, a: Coordinates): Coordinates Convert SOFA cartesian coordinates to openGL. |
|
| public |
Convert SOFA cartesian coordinates to SOFA spherical. |
|
| public |
sofaSphericalToGl(out: Coordinates, a: Coordinates): Coordinates Convert SOFA spherical coordinates to openGL. |
|
| public |
Convert SOFA spherical coordinates to SOFA spherical. |
|
| public |
sofaToSofaCartesian(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates Convert coordinates to SOFA cartesian. |
|
| public |
spat4CartesianToGl(out: Coordinates, a: Coordinates): Coordinates Convert Spat4 cartesian coordinates to openGL. |
|
| public |
Convert Spat4 cartesian coordinates to Spat4 spherical. |
|
| public |
spat4SphericalToGl(out: Coordinates, a: Coordinates): Coordinates Convert Spat4 spherical coordinates to openGL. |
|
| public |
Convert Spat4 spherical coordinates to Spat4 spherical. |
|
| public |
stringifySofa(sofaSet: Object): String Generates a SOFA JSON string from an object. |
|
| public |
systemToGl(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates Convert coordinates to openGL. |
|
| public |
systemType(system: String): String Get the coordinate system general type (cartesian or spherical). |
|
| public |
Convert an angle in degrees to radians. |
|
Static Public
public almostEquals(value: Number, reference: Number, tolerance: Number): Number source
import {almostEquals} from 'binaural/src/common/utilities.js'Test whether a value is around a reference, given a tolerance.
public almostEqualsModulo(value: Number, reference: Number, modulo: Number, tolerance: Number): Number source
import {almostEqualsModulo} from 'binaural/src/common/utilities.js'Test whether a value is around a reference, given a tolerance and a modulo.
public atan2(y: Number, x: Number): Number source
import {atan2} from 'binaural/src/geometry/degree.js'Get the arc-tangent (2 arguments) of 2 angles in degrees.
public conformSofaCoordinateSystem(system: String): String source
import {conformSofaCoordinateSystem} from 'binaural/src/sofa/parseSofa.js'Prefix SOFA coordinate system with sofa.
Params:
| Name | Type | Attribute | Description |
| system | String | : either |
Throw:
if system is unknown |
public cos(angle: Number): Number source
import {cos} from 'binaural/src/geometry/degree.js'Get the cosinus of an angle in degrees.
Params:
| Name | Type | Attribute | Description |
| angle | Number |
public createDiracBuffer(options: Object): AudioBuffer source
import {createDiracBuffer} from 'binaural/src/audio/utilities.js'Create a Dirac buffer, zero-padded.
Warning: the default length is 2 samples, to by-pass a bug in Safari ≤ 9.
Params:
| Name | Type | Attribute | Description |
| options | Object | ||
| options.audioContext | AudioContext | must be defined |
|
| options.channelCount | Number |
|
|
| options.gain | Number |
|
in dB |
| options.length | Number |
|
in samples |
Return:
| AudioBuffer |
public createNoiseBuffer(options: Object): AudioBuffer source
import {createNoiseBuffer} from 'binaural/src/audio/utilities.js'Create a noise buffer.
Params:
| Name | Type | Attribute | Description |
| options | Object | ||
| options.audioContext | AudioContext | must be defined |
|
| options.channelCount | Number |
|
|
| options.duration | Number |
|
in seconds |
| options.gain | Number |
|
in dB |
Return:
| AudioBuffer |
public dBToLin(dBValue: Number): Number source
import {dBToLin} from 'binaural/src/audio/utilities.js'Convert a dB value to a linear amplitude, i.e. -20dB gives 0.1
Params:
| Name | Type | Attribute | Description |
| dBValue | Number |
public distance(a: Object, b: Object): Number source
import {distance} from 'binaural/src/geometry/KdTree.js'Get the distance between to points.
public distanceSquared(a: Object, b: Object): Number source
import {distanceSquared} from 'binaural/src/geometry/KdTree.js'Get the squared distance between to points.
(Avoid computing the square-root when unnecessary.)
public fromRadian(angle: Number): Number source
import {fromRadian} from 'binaural/src/geometry/degree.js'Convert an angle in radians to degrees.
Params:
| Name | Type | Attribute | Description |
| angle | Number | in radians |
public glToSofaCartesian(out: Coordinates, a: Coordinates): Coordinates source
import {glToSofaCartesian} from 'binaural/src/geometry/coordinates.js'Convert openGL coordinates to SOFA cartesian.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public glToSofaSpherical(out: Coordinates, a: Coordinates): Coordinates source
import {glToSofaSpherical} from 'binaural/src/geometry/coordinates.js'Convert openGL coordinates to SOFA spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public glToSpat4Cartesian(out: Coordinates, a: Coordinates): Coordinates source
import {glToSpat4Cartesian} from 'binaural/src/geometry/coordinates.js'Convert openGL coordinates to Spat4 cartesian.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public glToSpat4Spherical(out: Coordinates, a: Coordinates): Coordinates source
import {glToSpat4Spherical} from 'binaural/src/geometry/coordinates.js'Convert openGL coordinates to Spat4 spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public glToSystem(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates source
import {glToSystem} from 'binaural/src/geometry/coordinates.js'Convert openGL coordinates to other system.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates | ||
| system | CoordinateSystem |
Throw:
when the system is unknown. |
public parseDataSet(input: String): Object source
import {parseDataSet} from 'binaural/src/sofa/parseDataSet.js'Parse data set meta data into an object of {definition: {key: values}} objects.
Params:
| Name | Type | Attribute | Description |
| input | String | data set DDS-like. |
Example:
_parseDataSet(
`Dataset {
Float64 ReceiverPosition[R = 2][C = 3][I = 1];
Float64 SourcePosition[M = 1680][C = 3];
Float64 EmitterPosition[E = 1][C = 3][I = 1];
Float64 Data.SamplingRate[I = 1];
} IRC_1100_C_HRIR.sofa;`);
// { ReceiverPosition: { type: 'Float64', R: 2, C: 3, I: 1 },
// SourcePosition: { type: 'Float64', M: 1680, C: 3 },
// EmitterPosition: { type: 'Float64', E: 1, C: 3, I: 1 }
// 'Data.SamplingRate': { type: 'Float64', I: 1 } }
public parseSofa(sofaString: String): Object source
import {parseSofa} from 'binaural/src/sofa/parseSofa.js'Parses a SOFA JSON string with into an object with name, data and
metaData attributes.
Params:
| Name | Type | Attribute | Description |
| sofaString | String | in SOFA JSON format |
Throw:
when the parsing fails |
See:
public resampleFloat32Array(options: Object): Promise.<Float32Array | Error> source
import {resampleFloat32Array} from 'binaural/src/audio/utilities.js'Convert an array, typed or not, to a Float32Array, with possible re-sampling.
Return:
| Promise.<Float32Array | Error> |
public sin(angle: Number): Number source
import {sin} from 'binaural/src/geometry/degree.js'Get the sinus of an angle in degrees.
Params:
| Name | Type | Attribute | Description |
| angle | Number |
public sofaCartesianToGl(out: Coordinates, a: Coordinates): Coordinates source
import {sofaCartesianToGl} from 'binaural/src/geometry/coordinates.js'Convert SOFA cartesian coordinates to openGL.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public sofaCartesianToSofaSpherical(out: Coordinates, a: Coordinates): Coordinates source
import {sofaCartesianToSofaSpherical} from 'binaural/src/geometry/coordinates.js'Convert SOFA cartesian coordinates to SOFA spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public sofaSphericalToGl(out: Coordinates, a: Coordinates): Coordinates source
import {sofaSphericalToGl} from 'binaural/src/geometry/coordinates.js'Convert SOFA spherical coordinates to openGL.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public sofaSphericalToSofaCartesian(out: Coordinates, a: Coordinates): Coordinates source
import {sofaSphericalToSofaCartesian} from 'binaural/src/geometry/coordinates.js'Convert SOFA spherical coordinates to SOFA spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public sofaToSofaCartesian(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates source
import {sofaToSofaCartesian} from 'binaural/src/geometry/coordinates.js'Convert coordinates to SOFA cartesian.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates | ||
| system | CoordinateSystem |
Throw:
when the system is unknown. |
public spat4CartesianToGl(out: Coordinates, a: Coordinates): Coordinates source
import {spat4CartesianToGl} from 'binaural/src/geometry/coordinates.js'Convert Spat4 cartesian coordinates to openGL.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public spat4CartesianToSpat4Spherical(out: Coordinates, a: Coordinates): Coordinates source
import {spat4CartesianToSpat4Spherical} from 'binaural/src/geometry/coordinates.js'Convert Spat4 cartesian coordinates to Spat4 spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public spat4SphericalToGl(out: Coordinates, a: Coordinates): Coordinates source
import {spat4SphericalToGl} from 'binaural/src/geometry/coordinates.js'Convert Spat4 spherical coordinates to openGL.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public spat4SphericalToSpat4Cartesian(out: Coordinates, a: Coordinates): Coordinates source
import {spat4SphericalToSpat4Cartesian} from 'binaural/src/geometry/coordinates.js'Convert Spat4 spherical coordinates to Spat4 spherical.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates |
public stringifySofa(sofaSet: Object): String source
import {stringifySofa} from 'binaural/src/sofa/parseSofa.js'Generates a SOFA JSON string from an object.
Note that the properties differ from either an HrtfSet and from the result of the parsing of a SOFA JSON. In particular, the listener attributes correspond to the reference for the filters; the source positions are the positions in the data-base.
Params:
| Name | Type | Attribute | Description |
| sofaSet | Object | ||
| sofaSet.ListenerPosition | Coordinates | ||
| sofaSet.ListenerPositionType | CoordinateSystem | ||
| sofaSet.ListenerUp | Coordinates | ||
| sofaSet.ListenerUpType | CoordinateSystem | ||
| sofaSet.ListenerView | Coordinates | ||
| sofaSet.ListenerViewType | CoordinateSystem | ||
| sofaSet.SourcePosition | Array<Array<Number>> | ||
| sofaSet.SourcePositionType | CoordinateSystem | ||
| sofaSet.DataSamplingRate | Number | ||
| sofaSet.DataIR | Array<Array<Array<Number>>> | ||
| sofaSet.RoomVolume | Array<Number> |
Throw:
when the export fails, because of missing data or unknown coordinate system |
public systemToGl(out: Coordinates, a: Coordinates, system: CoordinateSystem): Coordinates source
import {systemToGl} from 'binaural/src/geometry/coordinates.js'Convert coordinates to openGL.
Params:
| Name | Type | Attribute | Description |
| out | Coordinates | in-place if out === a. |
|
| a | Coordinates | ||
| system | CoordinateSystem |
Throw:
when the system is unknown. |
public systemType(system: String): String source
import {systemType} from 'binaural/src/geometry/coordinates.js'Get the coordinate system general type (cartesian or spherical).
Params:
| Name | Type | Attribute | Description |
| system | String |