Пример #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_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')
Пример #3
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)
Пример #4
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],
        ),
    ])
Пример #5
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)
Пример #6
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),
        ),
    ])
Пример #7
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],
        ),
    ])
Пример #8
0
# 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],
        ),
    ])
Пример #9
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,
            ],
        ),
    ])
Пример #10
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],
        ),
    ]
)
Пример #11
0
#
# @end:license

from noisicaa import node_db

MixerDescription = node_db.NodeDescription(
    uri='builtin://mixer',
    display_name='Mixer',
    type=node_db.NodeDescription.PROCESSOR,
    node_ui=node_db.NodeUIDescription(type='builtin://mixer', ),
    builtin_icon='node-type-builtin',
    processor=node_db.ProcessorDescription(type='builtin://mixer', ),
    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,
Пример #12
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],
        ),
    ])