A SuperCollider implementation of a Spatial Render. It reads OSC messages in SpatDIF format (from SSWorld or any other Sound Scene Simulator), as well as audio streams from Jack, and renders the corresponding audio.
Three different audio spatialization techniques are available, which can be changed on the fly:
It also handles internally a SpatDifLogger with autosaving features for recording the incoming messages.
See 3Dj for a deeper insight into the concepts.
Create a instance of SpatialRender.
Default render parameters are \binaural
decoder, \listen
head, hrtfID 1002
server |
Reference to the server |
spatDifLoggerPath |
String with the path to the folder in which save the log files. If |
When a SpatialRender
is instanciated, the server is (re)booted, in order to load VBAP and Binaural Buffers.
It also sets the SuperCollider output number to 24 (this parameter is accesible in the variable numAudioOutputs), and sets the required Jack connexions.
Get the current spatialization technique.
Set the desired spatialization technique. The possible values are either \ambisonics
, \binaural
or \vbap
.
It manages internally the required Jack connexions (and eventually AmbDec instanciation/quit)
Get a Dictionary with the form (sourceName -> [order, shape] )
If ambisonics is the current spatialization technique, configure its properties.
source |
A NOTE: Notice that, in ambisonics, each source can be encoded in a different order, and with a different shape |
order |
|
shape |
One of the following
|
internal |
Private use |
Get the current binaural decoder type
Get the current subject ID for the binaural model used
Configure the binaural model, if \binaural
is the current spatialization technique.
decoderType should be one of these: \spherical
, \listen
or \cipic
. subjectID is the integer holding the subject code.
For more information about binaural decoders, check FoaDecoderKernel.
Get the current vbap speaker configuration
Get the current vbap speaker buffer
get the current number of speakers in vbap
Set the vbap speaker configuration.
speakerArray is an instance of VBAPSpeakerArray
Set the maximum attenuation used used for the distance attenuation function. Default to 0.000016.
Set the maximum source distance used for the distance attenuation function. Default to 62500 m.
Set the reference distance used for the distance attenuation function. Default to 1 m.
Select the air absorption model. The possible values are 0 for no model, 1 for standard model, or \default
. Default to 1.
Check http://redmine.spatdif.org/attachments/download/105/SpatDIF-specs-V0.3.pdf, Appendix F
Select the distance attenuation model. Possible values are 0 for no model, 1 for higher attenuation model, 2 for lower attenuation model, or \default
. Default to 2.
Check http://redmine.spatdif.org/attachments/download/105/SpatDIF-specs-V0.3.pdf, Appendix F
Get the list of all Classes/SSWorld
addresses where to send back the scene information (in case of SpatDifPlayer
playback) or remote control. Multiple addresses are allowed.
At instanciation, the only address available will be NetAddr: -localAddr. It is responsability of the user to provide a correct address, when working in remote.
Add a NetAddress
to the SpatialRender: -worldAddresses list.
Remove a NetAddress
from the SpatialRender: -worldAddresses list.
The removed NetAddress
if succesful, or nil
if not.
Get/set whether scene information will be resended to all associated SSWorld
, when there is no SpatDifPlayer
playback.
By default it will be false
. User should set it only for remote visualization.
Get a List
with all source names
Get a Dictionary
in the form [sourceName -> OSCReceiver function associated]
A SpatDifLogger instance is provided with the Spatial Render. It is recommended to control it from the following methods.
Get the current path for the SpatDIF log file.
Get the complete file name for the SpatDIF log file.
Set wheter the SpatDifLogger is active or inactive.
Activate or deactivate the autosave functionality of the log file. Default to true
.
Get/set the period between consecutive autosavings of the log file. Default to 10 s.
A SpatDifPlayer instance is provided with the Spatial Render. It is recommended to control it from the following methods.
Load the content of a OSC-SpatDIF file and prepare it for playback.
aFile |
|
Start playback from the beggining of the document.
loop |
Set the looping. 1 for one-shot, 2 for two repetitions... inf for eternal repeat |
Starts playback from where it was paused last time.
Pauses playback. Next call to SpatialRender: -spatDifPlayer_play will start from where it was paused.
Stop playback. Next call to SpatialRender: -spatDifPlayer_play will start from the beginning
Next call to SpatialRender: -spatDifPlayer_play will start from the beginning
Answer whether the player is currently playing. See SpatDifPlayer: -isPlaying
If true
, it will print all sended messages.
If verbose is set to true, outcoming messages will be printed
Close all OSCResponders, free all synths, close the OSC Logger file.
Get the used server