Files @ a3267d8c498e
Branch filter:

Location: light9/attic/Nodes/sine.py

Drew Perttula
leave in a comment about how to offset the audio time in case your sound card is lying
we didn't eventually need this because we found a good-sounding card
that could report offset correctly. But if you're stuck with a card
that reports offset incorrectly, you can play with this offset for
a partial workaround. note that song intros will probably still be
corrupted (but you could workaround that by prepending some silence)
"""node that generates a sine wave"""


class SineGenerator(Node):
    def op(self, input, output, stateaccess):

        # input and output have names
        output.sin = stateaccess.magnitude * math.sin(stateaccess.phase+input.time)

        """
        # dict-style access for names with spaces
        output['sin'] = input['ti me']
        # underscore magic for accessing names with spaces-- the port object makes
        # this work
        output.sin=input.ti_me

        input.time = input.money
        """

    def getports(self):
        return OutputPort('sin'), InputPort('time'), InputPort('money')