-2

I'm trying to use SOX to start when there is sound and stop when there is silence. I can get it to work on the command Line:

rec recording.wav rate 32k silence 1 0.1 2% 1 3.0 2% 

But when I try to replicate in a python script:

import sox
args  = ['-d', '-t', 'wav','recording.wav', 'rate','32k', 'silence', '1', '0.1', '2%', '1', '3.0','2%']
sox.core.sox(args)

The program just ends. No errors, no file created. Nothing

Hankp
  • 47
  • 5

1 Answers1

0

I solved this with the following code:

import os
os.environ['AUDIODRIVER']= 'alsa'
os.system('rec recording.wav rate 44k silence 1 0.1 1% 1 3.0 1%')
Hankp
  • 47
  • 5