Skip to content

Instantly share code, notes, and snippets.

@EnkrateiaLucca
Created July 9, 2023 22:06
Show Gist options
  • Save EnkrateiaLucca/7500979bdf7b5577c1b1442e172bd604 to your computer and use it in GitHub Desktop.
Save EnkrateiaLucca/7500979bdf7b5577c1b1442e172bd604 to your computer and use it in GitHub Desktop.
record audio using arecord cli tool from within Python
import os
import subprocess
import time
def record_audio():
audio_file_path = "audio_output.wav"
command = 'arecord -f cd -r 16000 ' + audio_file_path
subprocess.run(command, shell=True)
if __name__ == "__main__":
record_audio()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment