@@ -0,0 +1,857 @@
+# coding: utf-8%0A%0Aimport os%0Aimport re%0Aimport shlex%0Afrom subprocess import Popen, PIPE%0A%0A%0Adef available_devices():%0A    devices =%5B%5D%0A%0A    os.environ%5B'LANG'%5D = 'C'%0A    command = 'arecord -l'%0A    arecord_l = Popen(shlex.split(command), stdout=PIPE, stderr=PIPE)%0A    arecord_l.wait()%0A%0A    if arecord_l.returncode != 0:%0A        print(arecord_l.stderr.read())%0A        return devices%0A%0A    for line in arecord_l.stdout.readlines():%0A        m = re.match('%5Ecard (%5B0-9%5D): .*, device (%5B0-9%5D): .*$', line.decode('utf-8'))%0A        if not m:%0A            continue%0A%0A        card = m.group(1)%0A        device = m.group(2)%0A        if card and device:%0A            devices.append('hw:%25s,%25s' %25 (card, device))%0A%0A    return devices%0A%0Adef record_wav(hw_id, duration, filename):%0A    command = 'arecord -D %25s -f S16_LE -d %25d %25s' %25 (hw_id, duration, filename)%0A    call(shlex.split(command))%0A

Add sound recording tool with arecord and lame