Closed
Description
Hey all,
As per some discussion at glTF next and W3C, I want to put forward a schema for adding spatialized audio support for glTF. Given the great work and interest in both audio and glTF coming out of today's session, I'd love to have something linkable for tomorrow. With that in mind, I think we could be more productive with something that isn't a vendor pull request. How do we feel about this as a start?
Overview
This extension adds general support for spatialized audio in glTF scenes. Audio sources are specified at the node level, and are colocated with the location of their node/joint in worldspace.
Property | Type | Description | Default Value |
---|---|---|---|
source |
string | ID of the audio source container | None |
volume |
float |
The factor by which the audio source's volume is scaled for playback. An Audio source with volume 0.0 is considered to be disabled, and may be ignored | 0.0 |
reflection |
string | Audio source attenuation mode | false |
attenuation |
boolean |
Denotes whether reflection should be enabled (true) or disabled (false) | 'NONE' |
diameter |
float |
Virtual diameter of the spherical audio source in meters. Larger sizes provide more envelopment for volumetric sounds | 0.0 |
maxSpeed |
float |
Max speed at which the audio source can travel, in meters/second. Unanticipated jumps in motion may produce artifacts during positional interpolation | 0.0 |
startOffset |
float |
The number of seconds between the time at which audio playback is requested, and the start time of the given audio source. If 'loop' is set to true, the audio source will restart playback 'startOffset' seconds after the end time of the previous iteration | 0.0 |
loop |
boolean |
When true, the audio source is played continuously in a loop, restarting 'startOffset' seconds after the previous iteration has completed | false |
Schema
glTF (gltf.XXX_audio.schema.json)
{
"$schema" : "http://json-schema.org/draft-03/schema",
"title" : "Spatialized Audio extension",
"type" : "object",
"properties" : {
"audio" : {
"type" : "object",
"description" : "A dictionary object of audio sources.",
"properties" : {
},
"additionalProperties" : {
"$ref" : "audio.schema.json"
},
"default" : {}
}
},
"additionalProperties" : false
}
audio (audio.schema.json)
{
"$schema" : "http://json-schema.org/draft-03/schema",
"title" : "audio",
"type" : "object",
"description" : "Data used to create an audio source",
"extends" : { "$ref" : "glTFChildOfRootProperty.schema.json" },
"properties" : {
"uri" : {
"type" : "string",
"description" : "The uri of the audio source.",
"format" : "uri",
"required" : true,
"gltf_detailedDescription" : "The uri of the audio source. Relative paths are relative to the .gltf file. Instead of referencing an external file, the uri can also be a data-uri.",
"gltf_uriType" : "Application"
}
},
"additionalProperties" : false
}
node (node.XXX_audio.schema.json)
{
"$schema" : "http://json-schema.org/draft-03/schema",
"title": "XXX_audio node extension",
"type": "object",
"properties": {
"source": {
"extends" : { "$ref" : "glTFid.schema.json" },
"description" : "The audio source ID",
"required" : true
},
"volume" : {
"type" : "float",
"description" : "The factor by which the audio source's volume is scaled for playback.",
"gltf_detailedDescription" : "The factor by which the audio source's volume is scaled for playback. An Audio source with volume 0.0 is considered to be disabled, and may be ignored",
"minumum" : 0.0,
"default" : 0.0,
"required" : true
},
"reflection": {
"type" : "boolean",
"description" : "Denotes whether reflection should be enabled (true) or disabled (false)",
"default" : false,
"required" : false
},
"attenuation" : {
"type" : "string",
"description" : "Audio source attenuation mode",
"enum" : [ "NONE", "FIXED", "INVERSE_SQUARE" ],
"default" : "NONE",
"required" : false
},
"diameter" : {
"type" : "float",
"description" : "Virtual diameter of the spherical audio source in meters",
"gltf_detailedDescription" : "Virtual diameter of the spherical audio source in meters. Larger sizes provide more envelopment for volumetric sounds",
"minimum" : 0.0,
"default" : 0.0,
"required" : false
},
"maxSpeed" : {
"type" : "float",
"description" : "Max speed at which the audio source can travel, in meters/second",
"gltf_detailedDescription" : "Max speed at which the audio source can travel, in meters/second. Unanticipated jumps in motion may produce artifacts during positional interpolation",
"minimum" : 0.0,
"default" : 0.0,
"required" : false
},
"startOffset" : {
"type" : "float",
"description" : "The number of seconds between the time at which audio playback is requested, and the start time of the given audio source",
"gltf_detailedDescription" : "The number of seconds between the time at which audio playback is requested, and the start time of the given audio source. If 'loop' is set to true, the audio source will restart playback 'startOffset' seconds after the end time of the previous iteration",
"minimum" : 0.0,
"default" : 0.0,
"required" : false
},
"loop" : {
"type" : "boolean",
"description" : "When true, the audio source is played continuously in a loop, restarting 'startOffset' seconds after the previous iteration has completed",
"default" : false,
"required" : false
}
},
"additionalProperties": false
}