zeffii / SoundPetal

Blender based SuperCollider Node system
GNU General Public License v3.0
19 stars 2 forks source link

Different direction project now called SoundPetal #11

Open zeffii opened 10 years ago

zeffii commented 10 years ago

I've been playing with the idea to make FLOW a visual node interface for GNU GPL SuperCollider. SC already is a node based system of SynthDefs and Groups, based on Unit Generators. UGens can be routed into other UGens.

The little experiments so far suggest that it will be possible but I will have to learn SC better first.

Here's a set of milestones I think will need to be completed in order:

ugens:

zeffii commented 10 years ago

image

Streamlining Node Interface, because there should be very little working code inside these node 'shells' all performance happens on SuperCollider's Server

zeffii commented 10 years ago

image

zeffii commented 10 years ago

this is essentially the in_class code now.

class UgenSinOsc(SoundPetalUgen):
    ''' UgenSinOsc '''
    bl_idname = 'UgenSinOsc'
    bl_label = 'SinOsc'
    sp_args = "(freq: 440, phase: 0, mul: 1, add: 0)"

    sp_rate = SoundPetalUgen.sp_rate

    def draw_buttons(self, context, layout):
        row = layout.row()
        row.prop(self, 'sp_rate', expand=True)

    def process(self):
        freq = self.inputs['freq'].fgetx()
        phase = self.inputs['phase'].fgetx()
        mul = self.inputs['mul'].fgetx()
        add = self.inputs['add'].fgetx()

        result = serialize(self, freq, phase, mul, add)
        self.outputs[0].fset(result)

I have not made sound yet.

zeffii commented 10 years ago

image

zeffii commented 10 years ago

further abstraction now to:

class UgenBlip(SoundPetalUgen):
    ''' UgenBlip '''
    bl_idname = 'UgenBlip'
    bl_label = 'Blip'
    sp_args = "(freq: 440, numharm: 200, mul: 1, add: 0)"

    sp_rate = SoundPetalUgen.sp_rate

    def process(self):
        if not len(self.inputs) == 4:
            return

        freq = self.inputs['freq'].fgetx()
        numharm = self.inputs['numharm'].fgetx()
        mul = self.inputs['mul'].fgetx()
        add = self.inputs['add'].fgetx()

        result = serialize(self, freq, numharm, mul, add)
        self.outputs[0].fset(result)
zeffii commented 10 years ago

will add a few more Ugens, including Line before attempting comms with ScSynth

zeffii commented 10 years ago

not sure how to deal with multichannel expansion.. looking forward to solving that.

zeffii commented 10 years ago

actually, most oscillator ugens can be written like

class UgenSinOsc(SoundPetalUgen):
    ''' UgenSinOsc '''
    bl_idname = 'UgenSinOsc'
    bl_label = 'SinOsc'
    sp_args = "(freq: 440, phase: 0, mul: 1, add: 0)"

    sp_rate = SoundPetalUgen.sp_rate

    def process(self):
        if not len(self.inputs) == 4:
            return

        result = serialize(self)
        self.outputs[0].fset(result)
zeffii commented 10 years ago

I think even the process function could be part of the superclass . if all that changes is the number of inputs to count before processing can take place

zeffii commented 10 years ago

woah

class UgenSawOsc(SoundPetalUgen):
    ''' UgenSawOsc '''
    bl_idname = 'UgenSawOsc'
    bl_label = 'Saw'
    sp_args = "(freq: 440, mul: 1, add: 0)"
    sp_rate = SoundPetalUgen.sp_rate

def register():
    bpy.utils.register_class(UgenSawOsc)

def unregister():
    bpy.utils.unregister_class(UgenSawOsc)

the rest is defined in the superclass SountPetalUgen

zeffii commented 10 years ago

included rounding on float types

zeffii commented 10 years ago

OK, Splay has this kind of argument list ar (inArray, spread: 1, level: 1, center: 0, levelComp: true), which the current codebase wont handle nicely. Time to rethink.

zeffii commented 10 years ago

still no sound, but have enough ugens now to start attempting a SynthDef gen

zeffii commented 10 years ago

image

zeffii commented 9 years ago

I'll take a break from this Addon for a while and focus on learning SC.

zeffii commented 9 years ago

I'm about 1/5 of where I want to be, while still a complete novice, the syntax is making more sense. I've started writing a note-to-self-reference