def __init__(self, context, name, parent, numLoudspeakers, port, baud, sofaFile, enableSerial=True, dynITD=True, hrirInterp=True, irTruncationLength=None, headTrackingCalibrationPort=None, switchUdpPort=12345): super(Comparison, self).__init__(context, name, parent) self.input = visr.AudioInputFloat("in", self, 2) self.output = visr.AudioOutputFloat("out", self, 2) self.renderer = VirtualLoudspeakerRendererSerial( context, "renderer", self, numLoudspeakers, port, baud, sofaFile, enableSerial=useTracking, dynITD=useDynamicITD, hrirInterp=useHRIRinterpolation, irTruncationLength=BRIRtruncationLength, headTrackingCalibrationPort=headTrackingCalibrationPort) self.controlReceiver = rcl.UdpReceiver( context, "ControlReceiver", self, port=switchUdpPort, mode=rcl.UdpReceiver.Mode.Asynchronous) self.switch = AudioSignalSwitch(context, "OutputSwitch", self, numberOfChannels=2, numberOfInputs=2, controlDataType=pml.Float) self.controlDecoder = rcl.ScalarOscDecoder(context, "ControlDecoder", self) self.controlDecoder.setup(dataType='float') self.parameterConnection( self.controlReceiver.parameterPort("messageOutput"), self.controlDecoder.parameterPort("datagramInput")) self.parameterConnection(self.controlDecoder.parameterPort("dataOut"), self.switch.parameterPort("controlIn")) self.audioConnection(self.input, self.renderer.audioPort("audioIn")) self.audioConnection(self.renderer.audioPort("audioOut"), self.switch.audioPort("in_0")) self.audioConnection(self.input, self.switch.audioPort("in_1")) self.audioConnection(self.switch.audioPort("out"), self.output)
def __init__( self, context, name, parent, loudspeakerConfigFiles, numberOfInputs, numberOfOutputs, interpolationPeriod, diffusionFilterFile, trajectoryPositions, trajectoryUpdateSamples = None, sourceLevel=1.0, sourceObjectId = 0, controlReceivePort=8889, trackingConfiguration='', ): super(RealTimeMultiRendererTrajectory,self).__init__( context, name, parent) self.input = visr.AudioInputFloat( "in", self, numberOfInputs ) self.output = visr.AudioOutputFloat( "out", self, numberOfOutputs ) rendererConfigs = [] for cfgFile in loudspeakerConfigFiles: rendererConfigs.append( panning.LoudspeakerArray(cfgFile) ) diffFilters = np.array(pml.MatrixParameterFloat.fromAudioFile( diffusionFilterFile )) if trajectoryUpdateSamples is None: trajectoryUpdateSamples = self.period() self.multiRenderer = MultiRenderer(context, name, self, loudspeakerConfigs=rendererConfigs, numberOfInputs=numberOfInputs, numberOfOutputs=numberOfOutputs, interpolationPeriod=trajectoryUpdateSamples, diffusionFilters=diffFilters, trackingConfiguration='', controlDataType=pml.Float) self.audioConnection( self.input, self.multiRenderer.audioPort("in" ) ) self.audioConnection( self.multiRenderer.audioPort("out" ), self.output ) self.sceneGenerator = PointSourceTrajectoryGenerator( context, "SceneDecoder", self, positions=trajectoryPositions, updateRateSamples = trajectoryUpdateSamples, objectId = sourceObjectId, groupId = 0, priority = 0, objectLevel = sourceLevel ) self.parameterConnection( self.sceneGenerator.parameterPort( "objectVectorOutput"), self.multiRenderer.parameterPort( "objectIn" ) ) self.controlReceiver = rcl.UdpReceiver( context, "ControlReceiver", self, port=controlReceivePort, mode=rcl.UdpReceiver.Mode.Asynchronous) self.controlDecoder = rcl.ScalarOscDecoder( context, "ControlDecoder", self ) self.controlDecoder.setup(dataType='float') self.parameterConnection( self.controlReceiver.parameterPort("messageOutput"), self.controlDecoder.parameterPort("datagramInput") ) self.parameterConnection( self.controlDecoder.parameterPort( "dataOut"), self.multiRenderer.parameterPort( "controlIn" ) )
def __init__( self, context, name, parent, loudspeakerConfig, numberOfInputs, numberOfOutputs, trajectoryPositions, trajectoryUpdateSamples=None, sourceLevel=1.0, sourceObjectId=0, controlDataType=pml.Float, controlReceivePort=8889, ): if trajectoryUpdateSamples is None: trajectoryUpdateSamples = context.period super(RealTimePanningComparisonTrajectory, self).__init__(context, name, parent) self.input = visr.AudioInputFloat("in", self, numberOfInputs) self.output = visr.AudioOutputFloat("out", self, numberOfOutputs) self.multiRenderer = PanningComparison( context, "MultiRenderer", self, loudspeakerConfig=loudspeakerConfig, numberOfInputs=numberOfInputs, numberOfOutputs=numberOfOutputs, interpolationSteps=trajectoryUpdateSamples, controlDataType=pml.Float) self.audioConnection(self.input, self.multiRenderer.audioPort("in")) self.audioConnection(self.multiRenderer.audioPort("out"), self.output) self.sceneGenerator = PointSourceTrajectoryGenerator( context, "SceneDecoder", self, positions=trajectoryPositions, updateRateSamples=trajectoryUpdateSamples, objectId=sourceObjectId, groupId=0, priority=0, objectLevel=sourceLevel) self.parameterConnection( self.sceneGenerator.parameterPort("objectVectorOutput"), self.multiRenderer.parameterPort("objectIn")) self.controlReceiver = rcl.UdpReceiver( context, "ControlReceiver", self, port=controlReceivePort, mode=rcl.UdpReceiver.Mode.Asynchronous) self.controlDecoder = rcl.ScalarOscDecoder(context, "ControlDecoder", self) self.controlDecoder.setup(dataType='float') self.parameterConnection( self.controlReceiver.parameterPort("messageOutput"), self.controlDecoder.parameterPort("datagramInput")) self.parameterConnection(self.controlDecoder.parameterPort("dataOut"), self.multiRenderer.parameterPort("controlIn"))
def __init__(self, context, name, parent, loudspeakerConfigFiles, numberOfInputs, numberOfOutputs, interpolationPeriod, diffusionFilterFile, udpReceivePort=8888, controlReceivePort=8889, trackingConfiguration=''): super(RealTimeMultiRenderer, self).__init__(context, name, parent) self.input = visr.AudioInputFloat("in", self, numberOfInputs) self.output = visr.AudioOutputFloat("out", self, numberOfOutputs) rendererConfigs = [] for cfgFile in loudspeakerConfigFiles: rendererConfigs.append(panning.LoudspeakerArray(cfgFile)) diffFilters = np.array( pml.MatrixParameterFloat.fromAudioFile(diffusionFilterFile)) self.multiRenderer = MultiRenderer( context, name, self, loudspeakerConfigs=rendererConfigs, numberOfInputs=numberOfInputs, numberOfOutputs=numberOfOutputs, interpolationPeriod=interpolationPeriod, diffusionFilters=diffFilters, trackingConfiguration='', controlDataType=pml.Float) self.audioConnection(self.input, self.multiRenderer.audioPort("in")) self.audioConnection(self.multiRenderer.audioPort("out"), self.output) self.sceneReceiver = rcl.UdpReceiver( context, "SceneReceiver", self, port=udpReceivePort, mode=rcl.UdpReceiver.Mode.Asynchronous) self.sceneDecoder = rcl.SceneDecoder(context, "SceneDecoder", self) self.parameterConnection( self.sceneReceiver.parameterPort("messageOutput"), self.sceneDecoder.parameterPort("datagramInput")) self.parameterConnection( self.sceneDecoder.parameterPort("objectVectorOutput"), self.multiRenderer.parameterPort("objectIn")) self.controlReceiver = rcl.UdpReceiver( context, "ControlReceiver", self, port=controlReceivePort, mode=rcl.UdpReceiver.Mode.Asynchronous) self.controlDecoder = rcl.ScalarOscDecoder(context, "ControlDecoder", dataType='float') self.parameterConnection( self.controlReceiver.parameterPort("messageOutput"), self.controlDecoder.parameterPort("datagramInput")) self.parameterConnection(self.controlDecoder.parameterPort("dataOut"), self.multiRenderer.parameterPort("controlIn"))