コード例 #1
0
ファイル: sayWords.py プロジェクト: cberman/speech2speech
def main():
    init()
    if len(argv) > 1:
        words = argv[1:]
    else:
        words = raw_input('gogogo: ').split()
    for word in words:
        location = findWord(word)
        if -1 in location:
            print '%s is not in the text' % word
            audio.terminate()
            exit()
        fn = '%d.%03d.wav' % location
        audio.play(path.join(recordDir, fn))
    audio.terminate()
コード例 #2
0
ファイル: main.py プロジェクト: nkisel/loudness-extractor
def rec(i, text_output, filename=""):
    """
    Initiate the loop of recording and analyzing audio for I iterations.
    If TEXT_OUTPUT, an output file containing an integer, named FILENAME, is created.

    """

    iteration = 0
    while iteration < i:
        record()
        loudness = str(int(analyze()))
        print("Loudness measure: " + loudness)
        if text_output:
            with open(filename, 'w', encoding='utf-8') as file:
                file.write(loudness)
        iteration += 1
    terminate()
コード例 #3
0
ファイル: record.py プロジェクト: cberman/speech2speech
def quit(evt):
    audio.terminate()
    exit()
コード例 #4
0
        return y

    def getAudioFunction(self, n):
        m1Gain = self.mod1Gain.value() / 200
        m2Gain = self.mod2Gain.value() / 200  # 0 - 0.1
        m1Freq = self.mod1Freq.value() / 8
        m2Freq = self.mod2Freq.value() / 8

        m1 = self.getOscillator
        if self.mod1Enable.isChecked():
            m1 = lambda n: signals.modulationModes[self.mod1Mode.currentText(
            )](self.getOscillator, signals.modulators[
                self.mod1Type.currentText()], m1Gain, m1Freq, n)
        m2 = m1
        if self.mod2Enable.isChecked():
            m2 = lambda n: signals.modulationModes[self.mod2Mode.currentText(
            )](m1, signals.modulators[self.mod2Type.currentText()], m2Gain,
               m2Freq, n)
        return m2(n)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = Main()
    window.show()
    audio.start()
    audio.audioFunction = lambda n: window.getAudioFunction(n)
    sys.exit(app.exec_())
    audio.stop()
    audio.terminate()