Recording while button is pressed.
For my son who is vocally challenged I am building a sound recorder/player.
When a button is pushed it should start recording. When released it should be played back.
This way he can hear what he said. And what he needs to correct.
I made a board with a rpi boot and shut down button and that works.
also there is a button to start/stop recording.
As I press the record button I can see erratic behaviour with the print debug lines.
I need to de-bounce the button. Is my waiting for the button pressing ok?
Any tips on the recording method?
The USB soundboard is being ordered.
Code: Select all
#!/usr/bin/env python import RPi.GPIO as GPIO import subprocess GPIO.setmode(GPIO.BCM) # Leds 6 22 # buttons 4 27 recbutton=27 recled=22 GPIO.setup(recbutton, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(recled, GPIO.OUT) print "Led Off" while 1: GPIO.wait_for_edge(recbutton, GPIO.RISING) print "LED on" GPIO.output(recled,GPIO.HIGH) GPIO.wait_for_edge(recbutton, GPIO.FALLING) print "LED off" GPIO.output(recled,GPIO.LOW)