MMM-Assistant icon indicating copy to clipboard operation
MMM-Assistant copied to clipboard

Use a ramdisk for the TTS tmp files

Open E3V3A opened this issue 6 years ago • 0 comments

Consider using a ramdisk for the temporary files created in /tmp to store pico2wav files used in the text-to-speech function, in node_helper.js. This would help save SD card based devices from over-wear.

    var commandTmpl = 'pico2wave -l "{{lang}}" -w {{file}} "{{text}}" && aplay {{file}}'

    function getTmpFile() {
        var random = Math.random().toString(36).slice(2),
        path = '/tmp/' + random + '.wav'
        return (!fs.existsSync(path)) ? path : getTmpFile()
    }

E3V3A avatar Mar 31 '18 18:03 E3V3A