Open n1x0id opened 6 years ago
I'm not sure which demo you are looking at, but Snowboy doesn't have to write a sound file to your SD card.
I use my script based on : https://github.com/Kitt-AI/snowboy/blob/master/examples/Python/demo.py
I don't think it's writing to your SD card. Could you post the code snippet?
def saveMessage(self):
"""
Save the message stored in self.recordedData to a timestamped file.
"""
filename = 'output' + str(int(time.time())) + '.wav'
data = b''.join(self.recordedData)
#use wave to save data
wf = wave.open(filename, 'wb')
wf.setnchannels(1)
wf.setsampwidth(self.audio.get_sample_size(
self.audio.get_format_from_width(
self.detector.BitsPerSample() / 8)))
wf.setframerate(self.detector.SampleRate())
wf.writeframes(data)
wf.close()
logger.debug("finished saving: " + filename)
return filename
The function for snowboydecoder.py.
@john170502 if you read the code, the saveMessage part will only get triggered when you provide audio_recorder_callback, the example is in demo4.py
@chenguoguo yes, i read code for python3 examples. i mean this method will write to the file. snowboy hotword detector don't have wirte sound file. thanks.
Hello!
My question: when snowboy working, it writes a sound file to a SD card (Raspberry Pi 3) or keeps it in RAM? This is pretty critical for me, because if it writes it to SD card, I would make a partition from RAM and write a file to it for a longer save of the SD card.