示例#1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.passthru_description = node_db.NodeDescription(
            uri='test://passthru',
            type=node_db.NodeDescription.PROCESSOR,
            ports=[
                node_db.PortDescription(
                    name='in:left',
                    direction=node_db.PortDescription.INPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
                node_db.PortDescription(
                    name='in:right',
                    direction=node_db.PortDescription.INPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
                node_db.PortDescription(
                    name='out:left',
                    direction=node_db.PortDescription.OUTPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
                node_db.PortDescription(
                    name='out:right',
                    direction=node_db.PortDescription.OUTPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
            ],
            processor=node_db.ProcessorDescription(type='builtin://null', ),
        )
示例#2
0
    def test_id(self):
        node_description = node_db.NodeDescription(
            uri='test://test',
            type=node_db.NodeDescription.PROCESSOR,
            ports=[],
            processor=node_db.ProcessorDescription(
                type='builtin://null',
            ),
        )

        proc1 = processor.PyProcessor('realm', 'test_node_1', self.host_system, node_description)
        proc2 = processor.PyProcessor('realm', 'test_node_2', self.host_system, node_description)

        self.assertNotEqual(proc1.id, proc2.id)
示例#3
0
    def test_event_input_port(self):
        self.node_description = node_db.NodeDescription(
            uri='test://test',
            type=node_db.NodeDescription.PROCESSOR,
            ports=[
                node_db.PortDescription(
                    name='in',
                    direction=node_db.PortDescription.INPUT,
                    types=[node_db.PortDescription.EVENTS],
                ),
                node_db.PortDescription(
                    name='out',
                    direction=node_db.PortDescription.OUTPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
            ],
            processor=node_db.ProcessorDescription(
                type='builtin://csound',
            ),
            csound=node_db.CSoundDescription(
                orchestra=textwrap.dedent("""\
                    sr=44100
                    0dbfs=1
                    ksmps=32
                    nchnls=1

                    gaOut chnexport "out", 2

                    instr 1
                      iPitch = p4
                      iVelocity = p5

                      iFreq = cpsmidinn(iPitch)
                      iVolume = -20 * log10(127^2 / iVelocity^2)

                      gaOut = db(iVolume) * linseg(0, 0.08, 1, 0.1, 0.6, 0.5, 0.0) * poscil(1.0, iFreq)
                    endin
                """),
                score='',
            ),
        )
        self.create_processor()
        self.fill_midi_buffer(
            'in',
            [(0, [0x90, 60, 100]),
             (64, [0x80, 60, 0])])

        self.process_block()
        self.assertBufferIsNotQuiet('out')
示例#4
0
    def test_csound(self):
        self.node_description = node_db.NodeDescription(
            uri='test://test',
            type=node_db.NodeDescription.PROCESSOR,
            ports=[
                node_db.PortDescription(
                    name='gain',
                    direction=node_db.PortDescription.INPUT,
                    types=[node_db.PortDescription.KRATE_CONTROL],
                ),
                node_db.PortDescription(
                    name='in',
                    direction=node_db.PortDescription.INPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
                node_db.PortDescription(
                    name='out',
                    direction=node_db.PortDescription.OUTPUT,
                    types=[node_db.PortDescription.AUDIO],
                ),
            ],
            processor=node_db.ProcessorDescription(
                type='builtin://csound',
            ),
            csound=node_db.CSoundDescription(
                orchestra=textwrap.dedent("""\
                    sr=44100
                    0dbfs=1
                    ksmps=32
                    nchnls=1

                    gkGain chnexport "gain", 1
                    gaIn chnexport "in", 1
                    gaOut chnexport "out", 2

                    instr 1
                      gaOut = gkGain * gaIn
                    endin
                """),
                score='i1 0 -1',
            ),
        )
        self.create_processor()
        self.fill_buffer('in', 1.0)
        self.fill_buffer('gain', 0.5)

        self.process_block()
        self.assertBufferAllEqual('out', 0.5)
示例#5
0
#
# @end:license

from noisicaa import node_db


MidiLooperDescription = node_db.NodeDescription(
    uri='builtin://midi-looper',
    display_name='MIDI Looper',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(
        type='builtin://midi-looper',
    ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(
        type='builtin://midi-looper',
    ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ]
)
示例#6
0
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

InstrumentDescription = node_db.NodeDescription(
    uri='builtin://instrument',
    display_name='Instrument',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://instrument', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://instrument', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
        node_db.PortDescription(
            name='out:left',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.AUDIO],
        ),
        node_db.PortDescription(
            name='out:right',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.AUDIO],
示例#7
0
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

OscilloscopeDescription = node_db.NodeDescription(
    uri='builtin://oscilloscope',
    display_name='Oscilloscope',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(
        type='builtin://oscilloscope',
        muteable=False,
    ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://oscilloscope', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[
                node_db.PortDescription.ARATE_CONTROL,
                node_db.PortDescription.KRATE_CONTROL,
                node_db.PortDescription.AUDIO,
            ],
        ),
    ])
示例#8
0
#
# @end:license

from noisicaa import node_db


VUMeterDescription = node_db.NodeDescription(
    uri='builtin://vumeter',
    display_name='VU Meter',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(
        type='builtin://vumeter',
    ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(
        type='builtin://vumeter',
    ),
    ports=[
        node_db.PortDescription(
            name='in:left',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.AUDIO],
        ),
        node_db.PortDescription(
            name='in:right',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.AUDIO],
        ),
    ]
)
示例#9
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

MidiCCtoCVDescription = node_db.NodeDescription(
    uri='builtin://midi-cc-to-cv',
    display_name='MIDI CC to Control Value',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://midi-cc-to-cv', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://midi-cc-to-cv', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ])
示例#10
0
    async def test_processor(self):
        self.host_system.set_block_size(256)
        async with self.create_realm() as realm:
            node_description = node_db.NodeDescription(
                uri='test://test',
                type=node_db.NodeDescription.PROCESSOR,
                processor=node_db.ProcessorDescription(
                    type='builtin://null', ),
                ports=[
                    node_db.PortDescription(
                        name='gain',
                        direction=node_db.PortDescription.INPUT,
                        types=[node_db.PortDescription.KRATE_CONTROL],
                    ),
                    node_db.PortDescription(
                        name='in',
                        direction=node_db.PortDescription.INPUT,
                        types=[node_db.PortDescription.AUDIO],
                    ),
                    node_db.PortDescription(
                        name='out',
                        direction=node_db.PortDescription.OUTPUT,
                        types=[node_db.PortDescription.AUDIO],
                    ),
                ])

            processor = PyProcessor(realm.name, 'amp', self.host_system,
                                    node_description)
            processor.setup()
            realm.add_active_processor(processor)

            spec = PySpec()
            spec.append_buffer(
                'sink:in:left',
                buffers.PyFloatAudioBlockBuffer(node_db.PortDescription.AUDIO))
            spec.append_buffer(
                'sink:in:right',
                buffers.PyFloatAudioBlockBuffer(node_db.PortDescription.AUDIO))
            spec.append_buffer('gain', buffers.PyFloatControlValueBuffer())
            spec.append_buffer(
                'in',
                buffers.PyFloatAudioBlockBuffer(node_db.PortDescription.AUDIO))
            spec.append_buffer(
                'out',
                buffers.PyFloatAudioBlockBuffer(node_db.PortDescription.AUDIO))
            spec.append_processor(processor)
            spec.append_opcode('CONNECT_PORT', processor, 0, 'gain')
            spec.append_opcode('CONNECT_PORT', processor, 1, 'in')
            spec.append_opcode('CONNECT_PORT', processor, 2, 'out')
            spec.append_opcode('CALL', processor)
            realm.set_spec(spec)

            # Initializes the program with the new spec (required for Realm::get_buffer() to work).
            program = realm.get_active_program()

            buf_gain = realm.get_buffer('gain',
                                        buffers.PyFloatControlValueBuffer())
            buf_gain[0] = 0.5

            buf_in = realm.get_buffer(
                'in',
                buffers.PyFloatAudioBlockBuffer(node_db.PortDescription.AUDIO))
            buf_in[0] = 1.0
            buf_in[1] = 2.0
            buf_in[2] = 3.0
            buf_in[3] = 4.0

            realm.process_block(program)
示例#11
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

SampleTrackDescription = node_db.NodeDescription(
    uri='builtin://sample-track',
    display_name='Sample Track',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://sample-track', ),
    processor=node_db.ProcessorDescription(type='builtin://sample-script', ),
    builtin_icon='track-type-sample',
    ports=[
        node_db.PortDescription(
            name='out:left',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.AUDIO],
        ),
        node_db.PortDescription(
            name='out:right',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.AUDIO],
        ),
    ])
示例#12
0
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <*****@*****.**>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

CustomCSoundDescription = node_db.NodeDescription(
    uri='builtin://custom-csound',
    display_name='Custom CSound',
    type=node_db.NodeDescription.PROCESSOR,
    processor=node_db.ProcessorDescription(type='builtin://custom-csound', ),
    node_ui=node_db.NodeUIDescription(type='builtin://custom-csound', ),
    builtin_icon='node-type-builtin',
)
示例#13
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

MidiMonitorDescription = node_db.NodeDescription(
    uri='builtin://midi-monitor',
    display_name='MIDI Monitor',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://midi-monitor', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://midi-monitor', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ])
示例#14
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

CVMapperDescription = node_db.NodeDescription(
    uri='builtin://cv-mapper',
    display_name='Control Value Mapper (a-rate)',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://cv-mapper', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://cv-mapper', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.ARATE_CONTROL],
        ),
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.ARATE_CONTROL],
        ),
    ])
示例#15
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

MidiSourceDescription = node_db.NodeDescription(
    uri='builtin://midi-source',
    display_name='MIDI source',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://midi-source', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://midi-source', ),
    ports=[
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ])
示例#16
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

StepSequencerDescription = node_db.NodeDescription(
    uri='builtin://step-sequencer',
    display_name='Step Sequencer',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://step-sequencer', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://step-sequencer', ),
    ports=[
        node_db.PortDescription(
            name='tempo',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.ARATE_CONTROL],
            float_value=node_db.FloatValueDescription(
                min=0.01,
                max=100.0,
                default=8,
                scale=node_db.FloatValueDescription.LOG),
        ),
    ])
示例#17
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

MidiVelocityMapperDescription = node_db.NodeDescription(
    uri='builtin://midi-velocity-mapper',
    display_name='MIDI Velocity Mapper',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://midi-velocity-mapper', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(
        type='builtin://midi-velocity-mapper', ),
    ports=[
        node_db.PortDescription(
            name='in',
            direction=node_db.PortDescription.INPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ])
示例#18
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db

BeatTrackDescription = node_db.NodeDescription(
    uri='builtin://beat-track',
    display_name='Beat Track',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://beat-track', ),
    builtin_icon='track-type-beat',
    processor=node_db.ProcessorDescription(type='builtin://pianoroll', ),
    ports=[
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.EVENTS],
        ),
    ])
示例#19
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license

from noisicaa import node_db


ControlTrackDescription = node_db.NodeDescription(
    uri='builtin://control-track',
    display_name='Control Track',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(
        type='builtin://control-track',
    ),
    builtin_icon='track-type-control',
    processor=node_db.ProcessorDescription(
        type='builtin://cv-generator',
    ),
    ports=[
        node_db.PortDescription(
            name='out',
            direction=node_db.PortDescription.OUTPUT,
            types=[node_db.PortDescription.ARATE_CONTROL],
        ),
    ]
)