Exemplo n.º 1
0
 def save_record(self, frames, filename="output.wav"):
     path = CONFIGS['audio_folder'].format(CONFIGS.get('session'))
     # path = "{}/session_{}/{}/Audio/".format(CONFIGS.get("store_location", "."), CONFIGS.get("session"), CONFIGS.get("folder"))
     wf = wave.open(path+filename, 'wb')
     wf.setnchannels(CHANNELS)
     wf.setsampwidth(self.p.get_sample_size(FORMAT))
     wf.setframerate(RATE)
     wf.writeframes(b''.join(frames))
     wf.close()
Exemplo n.º 2
0
    def record(self, analyze=False, filename="output.wav"):
        self.do_recording = True
        logger.info("* recording")
        # filename = CONFIGS.get('audio_folder').format(CONFIGS['session']) + filename
        filename = "./session_{}.wav".format(CONFIGS.get("session"))
        self.wf = wave.open(filename, "wb")
        self.wf.setnchannels(CHANNELS)
        self.wf.setsampwidth(self.p.get_sample_size(FORMAT))
        self.wf.setframerate(RATE)

        self.analyze = analyze
        if self.analyze:
            self.audio_analyzer.start_analyzing_audio()
        self.stream.start_stream()
Exemplo n.º 3
0
 def send_to_google(self, filename):
     path = "{}/session_{}/{}/Audio/".format(CONFIGS.get("store_location", "."), CONFIGS.get("session"), CONFIGS.get("folder"))
     os.system("flac -f "+path+filename) #Create a flac file
     filename =  filename.split(".")[0]+".flac"
     logger.debug("Created %s", filename)