Exemplo n.º 1
0
 def __init__(self,
              func=fonctionReconnaissance,
              outputGen=outputGenerator(),
              dataType=DEFAULT_DATA_TYPE,
              chunkSize=DEFAULT_CHUNK_SIZE):
     self.func = func
     self.outputGen = outputGen
     self.dataType = dataType
     self.chunkSize = chunkSize
Exemplo n.º 2
0
 def __init__(self,
              fileName,
              func=fonctionReconnaissance,
              outputGen=outputGenerator(),
              dataType=DEFAULT_DATA_TYPE,
              chunkSize=DEFAULT_CHUNK_SIZE):
     baseStreamHandler.__init__(self, func, outputGen, dataType, chunkSize)
     self.fileName = fileName
     self.wav = None
Exemplo n.º 3
0
 def __init__(self, func = fonctionReconnaissance, outputGen = outputGenerator(), dataType = DEFAULT_DATA_TYPE, chunkSize = DEFAULT_CHUNK_SIZE, streamInfo = liveStreamInfo()):
     baseStreamHandler.__init__(self, func, outputGen, dataType, chunkSize)
     self.streamInfo = streamInfo
Exemplo n.º 4
0
            data = numpy.fromstring(in_data, dtype=numpy.int16).tolist()
            noteData = self.func(data)
            
            self._callbackProcessing(noteData)
            
            return (None, pyaudio.paContinue)
        return _streamCallback

    def start(self):
        self._pa = pyaudio.PyAudio()
        self.stream = self._pa.open(format = self.streamInfo.streamDataType,
                                    channels = self.streamInfo.channels,
                                    rate = self.streamInfo.rate,
                                    input = True,
                                    input_device_index = self.streamInfo.deviceIndex,
                                    frames_per_buffer = self.chunkSize,
                                    stream_callback = self._getCallback())

    def stop(self):
        self.stream.stop_stream()
        self.stream.close()
        self._pa.terminate()

if __name__ == "__main__":
    sh = liveStreamHandler(outputGen = outputGenerator(outputStream = io.open("yotest.txt", 'w')))
    #sh = liveStreamHandler()
    sh.start()
    print('Press ENTER to stop recording... ')
    nothing = raw_input()
    sh.stop()
Exemplo n.º 5
0
#!/usr/bin/env python3
"""
Main Function #Driving Code
"""

import logaLyzer as ll
import outputGenerator as og
import frontEndGUI as fg

log = ll.LogLyzer()
graph = og.outputGenerator(log)
gui = fg.GuiDesign(log, graph)

gui.launchApp()
Exemplo n.º 6
0
                 fileName,
                 func=fonctionReconnaissance,
                 outputGen=outputGenerator(),
                 dataType=DEFAULT_DATA_TYPE,
                 chunkSize=DEFAULT_CHUNK_SIZE):
        baseStreamHandler.__init__(self, func, outputGen, dataType, chunkSize)
        self.fileName = fileName
        self.wav = None

    def start(self):
        self.wav = wave.open(self.fileName, "rb")

        # read chucks until end
        readchunk = self.wav.readframes(self.chunkSize)
        while (readchunk != ""):
            # print numpy.fromstring(readchunk, dtype=self.dataType).tolist()
            self._getCallback()(readchunk)
            readchunk = self.wav.readframes(self.chunkSize)

        self.stop()

    def stop(self):
        self.outputGen.translate([(None, None)])
        self.wav.close()


if __name__ == "__main__":
    test = WavStreamHandler(sys.argv[1],
                            outputGen=outputGenerator(tabTranslator()))
    test.start()
Exemplo n.º 7
0
def testTabTranslator(notes, outStream):
    """tabTranslator test"""
    outStream.write(u"\n================\nTesting tabTranslator...\n================\n")
    outGen = outputGenerator.outputGenerator(translator = tabTranslator(), outputStream = outStream)
    outGen.translate(notes)
Exemplo n.º 8
0
def testSimpleTranslator(notes, outStream):
    """simpleTranslator test"""
    outStream.write(u"\n================\nTesting simpleTranslator...\n================\n")
    outGen = outputGenerator.outputGenerator(outputStream = outStream)
    outGen.translate(notes)