Skip to content

Commit

Permalink
Create recordandplay.py
Browse files Browse the repository at this point in the history
  • Loading branch information
milandahal213 committed Mar 12, 2020
1 parent 31a14fd commit 8a9e6df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions recordandplay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env pybricks-micropython
#brickrun -r -- pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.tools import wait, StopWatch, DataLog
from pybricks.parameters import Color, Port
from pybricks.ev3devices import Motor
from pybricks.iodevices import AnalogSensor, UARTDevice
# Initialize the EV3
ev3 = EV3Brick()
ev3.speaker.beep()
import os

def record(length):
os.system("arecord -D plughw:3,0 -t wav --duration="+str(length)+" test.wav")

def playback():
os.system("aplay -D plughw:3,0 test.wav")

record(3)
wait(2000)
playback()

0 comments on commit 8a9e6df

Please sign in to comment.