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, numberOfObjects, lspConfig, nwPort): """ Constructor, instantiates the component, all contained sub-components, and their connections. Parameters ---------- self: VbapRenderer self argument, mandatory for Python methods. context: visr.SignalFlowContext A context object containing the sampling frequency and the block size. That is a mandatory parameter for VISR components. name: string Name of the component to be identified within a containing component. parent: visr.Compositcomponent A containing component, or None if this is the top-level component. numberOfObjects: int The maximum number of objects to be rendered. lspConfig: panning.LoudspeakerArray Object containing the loudspeaker positions. nwPort: int Port number of a UDP connection to receive object metadata messages. """ super().__init__(context, name, parent) if not isinstance(lspConfig, panning.LoudspeakerArray): lspConfig = panning.LoudspeakerArray(lspConfig) self.audioIn = visr.AudioInputFloat("in", self, numberOfObjects) self.audioOut = visr.AudioOutputFloat( "out", self, lspConfig.numberOfRegularLoudspeakers) self.receiver = rcl.UdpReceiver(context, "NetworkReceiver", self, port=nwPort) self.decoder = rcl.SceneDecoder(context, "SceneDecoder", self) self.panner = VbapRenderer(context, "VbapPanner", self, numberOfObjects, lspConfig) self.audioConnection(self.audioIn, self.panner.audioPort("in")) self.audioConnection(self.panner.audioPort("out"), self.audioOut) self.parameterConnection(self.receiver.parameterPort("messageOutput"), self.decoder.parameterPort("datagramInput")) self.parameterConnection( self.decoder.parameterPort("objectVectorOutput"), self.panner.parameterPort("objects"))
def __init__(self, context, name, parent, numberOfObjects, lspArray, nwPort): super().__init__(context, name, parent) if not isinstance(lspArray, panning.LoudspeakerArray): lspArray = panning.LoudspeakerArray(lspArray) self.audioIn = visr.AudioInputFloat("in", self, numberOfObjects) self.audioOut = visr.AudioOutputFloat( "out", self, lspArray.numberOfRegularLoudspeakers) self.receiver = rcl.UdpReceiver(context, "NetworkReceiver", self, port=nwPort) self.decoder = rcl.SceneDecoder(context, "SceneDecoder", self) self.panner = VbapL2Renderer(context, "VbapPanner", self, numberOfObjects, lspArray) self.audioConnection(self.audioIn, self.panner.audioPort("in")) self.audioConnection(self.panner.audioPort("out"), self.audioOut) self.parameterConnection(self.receiver.parameterPort("messageOutput"), self.decoder.parameterPort("datagramInput")) self.parameterConnection( self.decoder.parameterPort("objectVectorOutput"), self.panner.parameterPort("objects"))
blockSize = 4096 samplingFrequency = 48000 parameterUpdatePeriod = 4096 numBlocks = 32 signalLength = blockSize * numBlocks t = 1.0/samplingFrequency * np.arange(0,signalLength) numObjects = 2; ctxt = visr.SignalFlowContext( blockSize, samplingFrequency) lspConfigFile = os.path.join( os.getcwd(), 'bs2051-4+5+0_nosub.xml').replace('\\','/') # lspConfigFile = os.path.join( visrBaseDirectory, 'config/isvr/audiolab_39speakers_1subwoofer.xml' ) lc = panning.LoudspeakerArray( lspConfigFile ) numOutputChannels = np.max( lc.channelIndices() + lc.subwooferChannelIndices() ) +1 numLoudspeakers = lc.numberOfRegularLoudspeakers diffFilterFile = os.path.join( visrBaseDirectory, 'config/filters/random_phase_allpass_64ch_512taps.wav') diffFiltersRaw = np.array(pml.MatrixParameterFloat.fromAudioFile( diffFilterFile ), dtype = np.float32 ) diffFilters = pml.MatrixParameterFloat( diffFiltersRaw[ np.array(lc.channelIndices() )-1,: ] ) reverbConfigStr = '{ "numReverbObjects": %i, "discreteReflectionsPerObject": 20, "lateReverbFilterLength": 2, "lateReverbDecorrelationFilters": "%s/config/filters/random_phase_allpass_64ch_1024taps.wav" }' % (numObjects, visrBaseDirectory ) #reverbConfigStr = '' ## Load the BBC BRIR dataset #brirFile = os.path.join( os.getcwd(), 'BBC_BRIR.mat' ) #brirMat = h5py.File( brirFile )
blockSize = 64 parameterUpdatePeriod = 1024 numBlocks = 1024 signalLength = blockSize * numBlocks t = 1.0 / fs * np.arange(0, signalLength) ctxt = visr.SignalFlowContext(blockSize, fs) numberOfObjects = 2 numberOfOutputs = 41 lc1 = panning.LoudspeakerArray( os.path.join(visrBaseDirectory, 'config/isvr/audiolab_39speakers_1subwoofer.xml')) lc2 = panning.LoudspeakerArray( os.path.join(visrBaseDirectory, 'config/isvr/audiolab_22speakers_1subwoofer.xml')) configFiles = [ os.path.join(visrBaseDirectory, 'config/isvr/audiolab_39speakers_1subwoofer.xml'), os.path.join(visrBaseDirectory, 'config/isvr/audiolab_22speakers_1subwoofer.xml') ] #lc1 = panning.LoudspeakerArray( os.path.join( visrBaseDirectory, 'config/generic/bs2051-0+5+0.xml') ) #lc2 = panning.LoudspeakerArray( os.path.join( visrBaseDirectory, 'config/generic/bs2051-0+2+0.xml') )
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"))
sofaFile = configName + '.sofa' arrayConfigDirectory = '../data/loudspeaker_configs' arrayConfigPath = os.path.join(arrayConfigDirectory, configName + '.xml') fullSofaPath = os.path.join(sofaDirectory, sofaFile) if not os.path.exists(fullSofaPath): sofaDir = os.path.split(fullSofaPath)[0] if not os.path.exists(sofaDir): os.makedirs(sofaDir) urlretrieve('http://data.bbcarp.org.uk/bbcrd-brirs/sofa/' + sofaFile, fullSofaPath) hrirPos, hrirData, hrirDelays = readSofaFile( fullSofaPath, truncationLength=BRIRtruncationLength) arrayConfig = panning.LoudspeakerArray(arrayConfigPath) # Safety check to ensure that the dynamicITD is only used with datasets that contain extracted initial delays. if useDynamicITD and (hrirDelays is None or len(hrirDelays.shape) != 3): raise ValueError( "The option 'useDynamicITD' must be used only with BRIR datasets that provide a full delay dataset in 'Data.Delay'." ) # Crude check for 'horizontal-only' listener view directions if np.max(np.abs(hrirPos[:, 1])) < deg2rad(1): hrirPos = hrirPos[:, [0, 2]] # transform to polar coordinates # Dimension of hrirData is #measurement positions x #ears x # lsp x ir length numLoudspeakers = hrirData.shape[2] context = visr.SignalFlowContext(period=blockSize, samplingFrequency=fs)
hfLfPanning = True blockSize = 128 samplingFrequency = 48000 azGrid = np.arange(-180, 180, 1) * np.pi / 180.0 gridSize = len(azGrid) numSamples = 1024 numObjectChannels = 36 ctxt = visr.SignalFlowContext(blockSize, samplingFrequency) regArray = panning.LoudspeakerArray( 'c:/local/visr/src/libpanning/test/matlab/arrays/t-design_t8_P40.xml') realArray = panning.LoudspeakerArray( 'c:/local/visr/config/generic/octahedron.xml') decodeMatrixFile = 'c:/local/visr/src/libpanning/test/matlab/arrays/decode_N8_P40_t-design_t8_P40.txt' decodeMatrix = pml.MatrixParameterFloat.fromTextFile(decodeMatrixFile) numSpeakers = realArray.numberOfRegularLoudspeakers calc = rcl.HoaAllradGainCalculator(ctxt, 'calc', None) calc.setup(numberOfObjectChannels=numObjectChannels, regularArrayConfig=regArray, realArrayConfig=realArray, decodeMatrix=decodeMatrix)
""" import sys #sys.path.append( '/home/andi/dev/visr-build-debug/python' ) sys.path.append('c:/local/visr-build/python/Debug') import visr import signalflows import panning import pml import rcl import rrl ctxt = visr.SignalFlowContext(1024, 48000) lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/isvr/audiolab_39speakers_1subwoofer.xml') #lc = panning.LoudspeakerArray( 'c:/local/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) diffFilters = pml.MatrixParameterFloat(39, 512, 16) renderer1 = signalflows.BaselineRenderer(context=ctxt, name='renderer1', parent=None, loudspeakerConfig=lc, numberOfInputs=2, numberOfOutputs=41, interpolationPeriod=4096, diffusionFilters=diffFilters, trackingConfiguration='', sceneReceiverPort=4242, reverbConfig='',
def __init__( self, context, name, parent, *, # This ensures that the remaining arguments are given as keyword arguments. numberOfObjects, lspConfig, sofaFile=None, objectPort=4242, headTracking=False, trackingPort="", irTruncationLength=None): """ Constructor. Parameters ---------- context : visr.SignalFlowContext Standard visr.Component construction argument, a structure holding the block size and the sampling frequency name : string Name of the component, Standard visr.Component construction argument parent : visr.CompositeComponent Containing component if there is one, None if this is a top-level component of the signal flow. lspConfig: panning.LoudspeakerArray Loudspeaker configuration object used in the ob ject renderer. Must not be None numberOfObjects: int The number of objects to be rendered. sofaFile: string BRIR database provided as a SOFA file. This is an alternative to the hrirPosition, hrirData (and optionally hrirDelays) argument. Default None means that hrirData and hrirPosition must be provided. headTracking: bool Whether dynamic headTracking is active. If True, an control input "tracking" is created. trackerPort: string OS-specific device name of the tracker-s serial port. Examples: Windows:"COM4", Linux: "/dev/"/dev/ttyUSB0", Mac OS: "/dev/cu.usbserial-AJ03GSC8" irTruncationLength: int or None Maximum number of samples of the BRIR impulse responses. Functional only if the BRIR is provided in a SOFA file. """ # Parameter checking if not isinstance(lspConfig, panning.LoudspeakerArray): # Try to convert automatically lspConfig = panning.LoudspeakerArray(lspConfig) super(PanningAuralization, self).__init__(context, name, parent) self.objectInput = visr.AudioInputFloat("audioIn", self, numberOfObjects) self.binauralOutput = visr.AudioOutputFloat("audioOut", self, 2) self.objectRenderer = RealtimeVbapRenderer( context, "ObjectRenderer", self, numberOfObjects=numberOfObjects, lspConfig=lspConfig, nwPort=objectPort) self.virtualLoudspeakerRenderer = VirtualLoudspeakerRenderer( context, "VirtualLoudspeakerRenderer", self, sofaFile=sofaFile, headTracking=headTracking, dynamicITD=False, hrirInterpolation=True, irTruncationLength=irTruncationLength, filterCrossfading=True, interpolatingConvolver=False) self.audioConnection(self.objectInput, self.objectRenderer.audioPort("in")) self.audioConnection( self.objectRenderer.audioPort("out"), self.virtualLoudspeakerRenderer.audioPort("audioIn")) self.audioConnection( self.virtualLoudspeakerRenderer.audioPort("audioOut"), self.binauralOutput) if headTracking: self.tracker = RazorAHRSWithUdpCalibrationTrigger( context, "Tracker", self, port=trackingPort, calibrationPort=9999) self.parameterConnection( self.tracker.parameterPort("orientation"), self.virtualLoudspeakerRenderer.parameterPort("tracking"))
from helper.baseTrigFunctions import sph2cart bs = 128 samplingFrequency = 48000 numBlocks = 128 numObjects = 1 signalLength = bs * numBlocks t = 1.0 / samplingFrequency * np.arange(0, signalLength) ctxt = visr.SignalFlowContext(bs, samplingFrequency) lc = panning.LoudspeakerArray('../data/bs2051-4+5+0.xml') numOutputChannels = lc.numberOfRegularLoudspeakers rendererVbap = VbapRenderer(ctxt, 'renderer', None, numObjects, lspConfig=lc) rendererL2 = VbapL2Renderer(ctxt, 'renderer', None, numObjects, lspArray=lc) flowVbap = rrl.AudioSignalFlow(rendererVbap) flow = rrl.AudioSignalFlow(rendererL2) paramInput = flow.parameterReceivePort('objects') paramInputVbap = flowVbap.parameterReceivePort('objects') az = np.linspace(0, 2.0 * np.pi, numBlocks) el = 10.0 * np.pi / 180.0
def __init__( self, context, name, parent, *, # This ensures that the remaining arguments are given as keyword arguments. numberOfObjects, sofaFile=None, hrirPositions=None, hrirData=None, hrirDelays=None, headOrientation=None, headTracking=True, dynamicITD=False, hrirInterpolation=False, irTruncationLength=None, filterCrossfading=False, interpolatingConvolver=False, staticLateSofaFile=None, staticLateFilters=None, staticLateDelays=None, fftImplementation="default", loudspeakerConfiguration=None, loudspeakerRouting=None, objectRendererOptions={}): """ Constructor. Parameters ---------- context : visr.SignalFlowContext Standard visr.Component construction argument, a structure holding the block size and the sampling frequency name : string Name of the component, Standard visr.Component construction argument parent : visr.CompositeComponent Containing component if there is one, None if this is a top-level component of the signal flow. sofaFile: string BRIR database provided as a SOFA file. This is an alternative to the hrirPosition, hrirData (and optionally hrirDelays) argument. Default None means that hrirData and hrirPosition must be provided. hrirPositions : numpy.ndarray Optional way to provide the measurement grid for the BRIR listener view directions. If a SOFA file is provided, this is optional and overrides the listener view data in the file. Otherwise this argument is mandatory. Dimension #grid directions x (dimension of position argument) hrirData: numpy.ndarray Optional way to provide the BRIR data. Dimension: #grid directions x #ears (2) # x #loudspeakers x #ir length hrirDelays: numpy.ndarray Optional BRIR delays. If a SOFA file is given, this argument overrides a potential delay setting from the file. Otherwise, no extra delays are applied unless this option is provided. Dimension: #grid directions x #ears(2) x # loudspeakers headOrientation : array-like Head orientation in spherical coordinates (2- or 3-element vector or list). Either a static orientation (when no tracking is used), or the initial view direction headTracking: bool Whether dynamic headTracking is active. If True, an control input "tracking" is created. dynamicITD: bool Whether the delay part of th BRIRs is applied separately to the (delay-free) BRIRs. hrirInterpolation: bool Whether BRIRs are interpolated for the current head oriention. If False, a nearest-neighbour interpolation is used. irTruncationLength: int Maximum number of samples of the BRIR impulse responses. Functional only if the BRIR is provided in a SOFA file. filterCrossfading: bool Whether dynamic BRIR changes are crossfaded (True) or switched immediately (False) interpolatingConvolver: bool Whether the interpolating convolver option is used. If True, the convolver stores all BRIR filters, and the controller sends only interpolation coefficient messages to select the BRIR filters and their interpolation ratios. staticLateSofaFile: string, optional Name of a file containing a static (i.e., head orientation-independent) late part of the BRIRs. Optional argument, might be used as an alternative to the staticLateFilters argument, but these options are mutually exclusive. If neither is given, no static late part is used. The fields 'Data.IR' and the 'Data.Delay' are used. staticLateFilters: numpy.ndarray, optional Matrix containing a static, head position-independent part of the BRIRs. This option is mutually exclusive to staticLateSofaFile. If none of these is given, no separate static late part is rendered. Dimension: 2 x #numberOfLoudspeakers x firLength staticLateDelays: numpy.ndarray, optional Time delay of the late static BRIRs per loudspeaker. Optional attribute, only used if late static BRIR coefficients are provided. Dimension: 2 x #loudspeakers fftImplementation: string The FFT implementation to be used in the convolver. the default value selects the system default. loudspeakerConfiguration: panning.LoudspeakerArray Loudspeaker configuration object used in the ob ject renderer. Must not be None loudspeakerRouting: array-like list of integers or None Routing indices from the outputs of the object renderer to the inputs of the binaural virtual loudspeaker renderer. If empty, the outputs of the object renderer are connected to the first inputs of the virt. lsp renderer. objectRendererOptions: dict Keyword arguments passed to the object renderer (rcl.CoreRenderer). This may involve all optional arguments for this class apart from loudspeakerConfiguration, numberOfInputs, and numberOfOutputs. If provided, these paremters are overwritten by the values determined from the binaural renderer's configuration. """ # Parameter checking if not isinstance(loudspeakerConfiguration, panning.LoudspeakerArray): # Try to convert automatically loudspeakerConfiguration = panning.LoudspeakerArray( loudspeakerConfiguration) # raise ValueError( "'loudspeakerConfiguration' is not a 'panning.LoudspeakerArray' object." ) numArraySpeakers = loudspeakerConfiguration.numberOfRegularLoudspeakers outRoutings = list(range(numArraySpeakers)) # Plain[0,1,...] routing super(ObjectToVirtualLoudspeakerRenderer, self).__init__(context, name, parent) self.objectInput = visr.AudioInputFloat("audioIn", self, numberOfObjects) self.binauralOutput = visr.AudioOutputFloat("audioOut", self, 2) self.objectVectorInput = visr.ParameterInput( "objectVector", self, pml.ObjectVector.staticType, pml.DoubleBufferingProtocol.staticType, pml.EmptyParameterConfig()) if headTracking: self.trackingInput = visr.ParameterInput( "tracking", self, pml.ListenerPosition.staticType, pml.DoubleBufferingProtocol.staticType, pml.EmptyParameterConfig()) objectRendererOptions[ "loudspeakerConfiguration"] = loudspeakerConfiguration objectRendererOptions["numberOfInputs"] = numberOfObjects objectRendererOptions["numberOfOutputs"] = numArraySpeakers if "interpolationPeriod" not in objectRendererOptions: objectRendererOptions["interpolationPeriod"] = context.period if "diffusionFilters" not in objectRendererOptions: diffLen = 512 fftLen = int(np.ceil(0.5 * (diffLen + 1))) H = np.exp(-1j * (np.random.rand(numArraySpeakers, fftLen))) h = np.fft.irfft(H, axis=1) diffFilters = efl.BasicMatrixFloat(h) objectRendererOptions["diffusionFilters"] = diffFilters self.objectRenderer = CoreRenderer(context, "ObjectRenderer", self, **objectRendererOptions) self.virtualLoudspeakerRenderer = VirtualLoudspeakerRenderer( context, "VirtualLoudspeakerRenderer", self, sofaFile=sofaFile, hrirPositions=hrirPositions, hrirData=hrirData, hrirDelays=hrirDelays, headOrientation=headOrientation, headTracking=headTracking, dynamicITD=dynamicITD, hrirInterpolation=hrirInterpolation, irTruncationLength=irTruncationLength, filterCrossfading=filterCrossfading, interpolatingConvolver=interpolatingConvolver, staticLateSofaFile=staticLateSofaFile, staticLateFilters=staticLateFilters, staticLateDelays=staticLateDelays, fftImplementation=fftImplementation) self.audioConnection(self.objectInput, self.objectRenderer.audioPort("audioIn")) numVirtualSpeakers = self.virtualLoudspeakerRenderer.audioPort( 'audioIn').width if loudspeakerRouting is None: if numVirtualSpeakers != numArraySpeakers: raise ValueError( "If no 'loudspeakerRouting' parameter is provided, the numbers of loudspeakers of the object renderer and the binaural virt. loudspeaker renderer must match." ) loudspeakerRouting = list( range(numArraySpeakers)) # Plain[0,1,...] routing if numVirtualSpeakers > numArraySpeakers: unconnectedSpeakers = list( set(range(numVirtualSpeakers)) - set(outRoutings)) self.nullSource = NullSource(context, "NullSource", self, width=1) self.audioConnection( self.nullSource.audioPort("out"), [0] * len(unconnectedSpeakers), self.virtualLoudspeakerRenderer.audioPort("audioIn"), loudspeakerRouting) self.audioConnection( self.objectRenderer.audioPort("audioOut"), outRoutings, self.virtualLoudspeakerRenderer.audioPort("audioIn"), loudspeakerRouting) self.audioConnection( self.virtualLoudspeakerRenderer.audioPort("audioOut"), self.binauralOutput) self.parameterConnection( self.objectVectorInput, self.objectRenderer.parameterPort("objectDataInput")) if headTracking: self.parameterConnection( self.trackingInput, self.virtualLoudspeakerRenderer.parameterPort("tracking"))
samplingFrequency = 48000 azGrid = np.arange(-45, 45, 1) * np.pi / 180.0 gridSize = len(azGrid) numSamples = 1024 numObjectChannels = 1 ctxt = visr.SignalFlowContext(blockSize, samplingFrequency) # lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) # lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/generic/bs2051-9+10+3_linear.xml' ) # lc = panning.LoudspeakerArray( 'c:/local/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) # lc = panning.LoudspeakerArray( 'c:/local/visr/config/generic/bs2051-9+10+3.xml' ) lc = panning.LoudspeakerArray( '/Users/rdmg1u13/Google Drive/_dylan/work/soton/_s3a/research/S3A_renderer/VISR_CAPproto/VISR/config/generic/bs2051-0+2+0_90.xml' ) numSpeakers = lc.numberOfRegularLoudspeakers calc = CAPGainCalculator(ctxt, "CAPCalculator", None, numberOfObjects=numObjectChannels, arrayConfig=lc) flow = rrl.AudioSignalFlow(calc) paramInput = flow.parameterReceivePort('objectVectorInput') # Dummy input required for the process() function inputBlock = np.zeros((0, blockSize), dtype=np.float32)
# <cart x=\"2.15\" y=\"-1.22\" z=\"0.01\"/> # </loudspeaker> # <virtualspeaker eq=\"highpass\" id=\"3\"> # <cart x=\"-1\" y=\"0\" z=\"0\"/> # <route lspId=\"T-030\" gainDB=\"0\"/> # <route lspId=\"T+030\" gainDB=\"0\"/> # </virtualspeaker> # <subwoofer assignedLoudspeakers=\"T-030, T+030\" channel=\"3\" delay=\"0\" eq=\"lowpass\" gainDB=\"0\" weights=\"1.000000, 1.000000\"/> # <triplet l1=\"T+030\" l2=\"3\"/> # <triplet l1=\"T-030\" l2=\"T+030\"/> # <triplet l1=\"3\" l2=\"T-030\"/> #</panningConfiguration>""" filename = 'C:/Local/gc1y17/visr/config/isvr/audiolab_stereo_1sub_with_rerouting.xml' conffile = open(filename, 'r') lc = panning.LoudspeakerArray(filename) #lc.loadXmlString(conffile) print("FILE", conffile.read()) numRegSpeakers = lc.numberOfRegularLoudspeakers numTotSpeakers = lc.totNumberOfLoudspeakers numSub = lc.numberOfSubwoofers numTrip = lc.numberOfTriplets is2D = lc.is2D print('\n', 'GENERAL CONFIGURATION ') print('Number of regular speakers: ', numRegSpeakers) print('Number of virtual speakers: ', numTotSpeakers - numRegSpeakers) print('Total number speakers (virtual included): ', numTotSpeakers) print('Number of subwoofers: ', numSub) print('Number of triplets: ', numTrip) print('2D layout: ', is2D)
obj_vector = om.ObjectVector() # load the object vector obj_str = open(jsonFile).read() # read json object vector as a string obj_vector.fillFromJson(obj_str) # populate the object vector rob = obj_vector[0] rob.lateReverb.levels = np.array([0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0], dtype=np.float32) rob.lateReverb.decayCoefficients = np.array( [-5.0, 1.0, 1.0, 1.0, -3.0, 1.0, 1.0, 1.0, 1.0], dtype=np.float32) # create signal flow context and loudspeaker array config blockSize = 128 samplingFrequency = 48000 ctxt = visr.SignalFlowContext(blockSize, samplingFrequency) lc = panning.LoudspeakerArray( os.path.join(visrBaseDirectory, 'config/generic/bs2051-9+10+3.xml')) robj = obj_vector[0] lr = robj.lateReverb lr_param = ro.LateReverbParameter(0, lr) calc = ro.LateReverbFilterCalculator(ctxt, 'calc', None, numberOfObjects=1, lateReflectionLengthSeconds=1.0, numLateReflectionSubBandLevels=9, maxUpdatesPerPeriod=100) flow = rrl.AudioSignalFlow(calc)
# Multichannel Loudspeaker configurations as defined by ITU-R BS.2051. # Note that the speaker channels are consectutive, i.e., they differ from # the ITU standard as they omit the channels for the subwoofers (channel 4 and 10 # for 9+10+3) # Note: The sudio interface used must support the number of output channels. #configFile = '../data/bs2051-0+5+0.xml' #configFile = '../data/bs2051-4+5+0.xml' #configFile = '../data/bs2051-9+10+3.xml' # Number of objects rendered. # More objects are possible if the sound card supports a sufficient number of channels. numObjects = 2 # Create a loudspeaker array object. lc = panning.LoudspeakerArray(configFile) # Retrieve number of loudspeakers from file. numLsp = lc.numberOfRegularLoudspeakers # Instantiate the signal flow. renderer = RealtimeVbapRenderer(context, 'renderer', None, numObjects, lspConfig=lc, nwPort=4242) # Instantiate a flow object that contains the runtime infrastructure for the renderer. flow = rrl.AudioSignalFlow(renderer)
blockSize = 128 samplingFrequency = 48000 azGrid = np.arange(-45, 45, 1) * np.pi / 180.0 gridSize = len(azGrid) numSamples = 1024 numObjectChannels = 1 ctxt = visr.SignalFlowContext(blockSize, samplingFrequency) # lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) # lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/generic/bs2051-9+10+3_linear.xml' ) # lc = panning.LoudspeakerArray( 'c:/local/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) # lc = panning.LoudspeakerArray( 'c:/local/visr/config/generic/bs2051-9+10+3.xml' ) lc = panning.LoudspeakerArray( 'c:/local/s3a_git/aes2018_dualband_panning/code/data/bs2051-4+5+0.xml') numSpeakers = lc.numberOfRegularLoudspeakers if False: calc = PythonPanner(ctxt, 'calc', None, numberOfObjects=numObjectChannels, arrayConfig=lc) else: calc = rcl.PanningCalculator(ctxt, 'calc', None, numberOfObjects=numObjectChannels, arrayConfig=lc,
return x, y, z blockSize = 128 samplingFrequency = 48000 parameterUpdatePeriod = 1024 numBlocks = 1024 signalLength = blockSize * numBlocks t = 1.0 / samplingFrequency * np.arange(0, signalLength) ctxt = visr.SignalFlowContext(blockSize, samplingFrequency) #lc = panning.LoudspeakerArray( '/home/andi/dev/visr/config/isvr/audiolab_39speakers_1subwoofer.xml' ) lc = panning.LoudspeakerArray('c:/local/VISR/config/generic/bs2051-9+10+3.xml') # lc = panning.LoudspeakerArray( 'c:/local/VISR/config/isvr/audiolab_39speakers_1subwoofer.xml' ) numOutputChannels = np.max(lc.channelIndices()) diffFilters = pml.MatrixParameterFloat(22, 512, 16) # #renderer1 = signalflows.CoreRenderer( ctxt, 'renderer1', None, lc, 2, numOutputChannels, parameterUpdatePeriod, diffFilters, '' ) ## loudspeakerConfiguration=lc, ## numberOfInputs=2, ## numberOfOutputs=41, ## interpolationPeriod=1024, ## diffusionFilters=diffFilters, ## tra ckingConfiguration='' ) renderer1 = signalflows.CoreRenderer(ctxt,