def __init__(self, format, parent=None):

        QIODevice.__init__(self, parent)
        self.data = QByteArray()

        # Preserve phase across calls
        self.phase = 0
        self.freq = 440

        self.convert_16_bit = float(2**15)

        coefs = self.getCoef()

        self.white_osc = noise.WhiteNoise()

        self.white_buffer = self.white_osc.genBuffer(
            Meep.SAMPLES_PER_READ)  # gen white buffer
        self.filter = sf.FilterChain(coefs)

        # Check we can deal with the supplied
        # sample format. We're supposed to be
        # able to deal with any requested
        # sample format. But this is a
        # _minimal_ example, right?
        if format.isValid() and \
           format.sampleSize() == 16 and \
           format.byteOrder() == \
                QAudioFormat.LittleEndian and \
           format.sampleType() == \
                QAudioFormat.SignedInt and \
           format.channelCount() == 1 :
            print("Meep: Format compatible. Good.")
            self.format = format
Example #2
0
 def __init__(self, format, parent=None):
     QIODevice.__init__(self, parent)
     self.data = QByteArray()
     self.format = format
     self.voiceList = []
     self.pulseP = 0.3
     self.q = 100
     self.transpose = 36
Example #3
0
 def __init__(self,format,parent=None):
     self.format=format
     QIODevice.__init__(self,parent)
     self.data=QByteArray()
     self.state=0
     self.vel=0
     self.vol=0
     self.q=0
     self.d=0
Example #4
0
    def __init__(self, format, parent = None):
        QIODevice.__init__(self, parent)
        self.data = QByteArray()

        # find bandwith for one hertz
        self.bdw = 2*np.pi/SAMPLE_RATE

        # start off with no note playing (toggled when we detect midi messages)
        self.note_on = 0

        # add freq offset so we can tune keys
        self.octave = 0


        # create Filter
        b, a = signal.iirdesign([0.2,0.21], [0.1,0.3], 3, 80, False, 'butter')
        self.filter = IIR(a,b)

        # create ADSR env. generator
        self.env = ADSR()
        self.env.setAttackRate(.1 * SAMPLE_RATE)
        self.env.setDecayRate(.3 * SAMPLE_RATE)
        self.env.setReleaseRate(5 * SAMPLE_RATE)
        self.env.setSustainLevel(.8)

        print("\n~~~~ GENERATOR ~~~~")

        # Check we can deal with the supplied
        # sample format. We're supposed to be
        # able to deal with any requested
        # sample format. But this is a
        # _minimal_ example, right?
        if format.isValid() and \
           format.sampleSize() == 16 and \
           format.byteOrder() == \
                QAudioFormat.LittleEndian and \
           format.sampleType() == \
                QAudioFormat.SignedInt and \
           format.channelCount() == 1 :
               print(
                 "Sample format compatible."
               )
               self.format = format
    def __init__(self, format, parent=None):

        QIODevice.__init__(self, parent)
        self.data = QByteArray()

        # Preserve phase across calls
        self.phase = 0

        # Check we can deal with the supplied
        # sample format. We're supposed to be
        # able to deal with any requested
        # sample format. But this is a
        # _minimal_ example, right?
        if format.isValid() and \
           format.sampleSize() == 16 and \
           format.byteOrder() == \
                QAudioFormat.LittleEndian and \
           format.sampleType() == \
                QAudioFormat.SignedInt and \
           format.channelCount() == 1 :
            print("Meep: Format compatible. Good.")
            self.format = format
Example #6
0
    def __init__(self, format, activeGen, parent=None):

        QIODevice.__init__(self, parent)
        self.data = QByteArray()

        # hold a reference to the active generator instance
        self.generator = activeGen

        self.convert_16_bit = float(2**15)

        # Check we can deal with the supplied
        # sample format. We're supposed to be
        # able to deal with any requested
        # sample format. But this is a
        # _minimal_ example
        if format.isValid() and \
           format.sampleSize() == 16 and \
           format.byteOrder() == \
                QAudioFormat.LittleEndian and \
           format.sampleType() == \
                QAudioFormat.SignedInt and \
           format.channelCount() == 1 :
            print("Meep: Format compatible. Good.")
            self.format = format