Closed aandroide closed 2 years ago
The audiorecorder script is being used by the interpreter feature as well. Only the record to file should be imported into the main.py
Please check these lines: https://github.com/shivasiddharth/GassistPi/blob/97fd82b0cd79a5daabb41b84dadd8ec5b97accfe/src/audiorecorder.py#L163-L166
Lo script dell'audioregistratore viene utilizzato anche dalla funzione interprete. Solo il record su file dovrebbe essere importato in main.py
Si prega di controllare queste righe:
https://github.com/shivasiddharth/GassistPi/blob/97fd82b0cd79a5daabb41b84dadd8ec5b97accfe/src/audiorecorder.py#L163-L166 if I don't add those lines, the file is sent immediately without giving time to record
Thats why there is a while loop in the main.py in the original script.
Thats why there is a while loop in the main.py in the original script.
i found out that the memory full problem is due to just that while
Can you check and fix the interpreter function also ? Both use the same script. Changing this will break that.
done is all in the fork
What is his module ?
import audioop
What is his module ?
import audioop
rms_value = audioop.rms(snd_data, 2) if 98 <= max(snd_data) <= 300: return 0 elif max(snd_data) > 300:
if rms_value < 300:
return 0
return 1
else:
return -1
I have not installed any module I think it is present by default in raspberry
In normal state (100 <= max_value <= 300), then it records the current input waveform. E.g. in this program, if the current state is normal, then it returns 0. If the max_value of the current input exceeds 300, moving average method is activated, if the current rms_value is less than 300, it returns 0, e.g. normal state. If not, it represent third state and return 1. If program detects silence state, it increases the num_silent value. If the num_silent value is equal to 200, it stops input and terminate. Also saves wav file. Terminate condition (num_silent) also can be adjustable. The last length parameter represents the length of current input buffer. You can adjust its value you want.