20 lines
392 B
Python
20 lines
392 B
Python
python - <<'PY'
|
|
import sounddevice as sd
|
|
import soundfile as sf
|
|
|
|
print(sd.query_devices())
|
|
print("Microphone utilisé :", sd.default.device)
|
|
|
|
print("Parle pendant 8 secondes...")
|
|
audio = sd.rec(
|
|
int(8 * 16000),
|
|
samplerate=16000,
|
|
channels=1,
|
|
dtype="int16"
|
|
)
|
|
sd.wait()
|
|
|
|
sf.write("/tmp/alfred-micro.wav", audio, 16000)
|
|
print("Enregistrement terminé : /tmp/alfred-micro.wav")
|
|
PY
|