Skip to content

Listens for sounds and automatically replays them like a parrot, in a loop with a web interface and customizable settings.

Notifications You must be signed in to change notification settings

pingec/parrot-vox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parrot-vox

Listens for sounds, records them and automatically plays them back.

Wraps the sox utility internally, so make sure you have sox installed on your system

This app is far from finished it and is closer to a prototype than a finished product! YMMV

parrot-vox screenshot

r.pi hardware picture

This setup was tested to be working on the following setup:

Raspberry Pi B+ running Raspbian GNU/Linux 7 (wheezy)

Linux raspberrypi 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015 armv6l GNU/Linux

Using an external usb sound card (1908:2070 GEMBIRD) but any C-Media CM108 and similar should work fine.

Configuration

  • Some things can be changed via the web interface (everything in config.json), other are hardcoded in code. You might have to modify the paths in code.
  • To make the external usb audio card the default one change /etc/modprobe.d/alsa-base.conf set:
    options snd-usb-audio index=0
  • Ensure you have sox installed and "rec"/"play" commands are globally available.
  • Run with "node main.js" and then browse to device's ip address and port 8080.

If you're using a Raspberry Pi and notice the output isnt totally clean, some USB Audio adapters don't like USB-1.2 and produce crackling in the output. You can work around the problem by adding dwc_otg.speed=1 to /boot/cmdline.txt and setting the USB ports to USB-1.1 mode.

config.json example

{
    "start-threshold": 2,
    "stop-threshold": 2,
    "duration-start": 5,
    "duration-stop": 2,
    "duration": 20,
    "input-gain": 100,
    "output-volume": 100,
    "input-boost": 1,
    "output-boost": 1
}

Appendix: sox syntax explanation

silence [ -l ] above_periods [ duration threshold[d|%] ] [ below_periods duration threshold[d|%] ]
rec recording.wav silence 1 5 2% 1 0:00:02 2%
  • 1 - above-periods (start recording when non-silence is detected) TREAT AS CONSTANT
  • 5 - duration (amount of SAMPLES that non-silence must be detected for before starting recording, you can also specify time instead number of samples, eg. use '2t' for 2 seconds or '0:00:02' syntax also works)
  • 2% - threshold (what is treated as silence and what not when determining when to start recording)
  • 1 - below-periods (stop recording when silence is detected) TREAT AS CONSTANT
  • 0:00:02 - duration (amount of time of non-silence before recording is stopped, same formatting options are available as for duration parameter above)
  • 2% - threshold (what is treated as silence and what not when determining when to stop recording)

About

Listens for sounds and automatically replays them like a parrot, in a loop with a web interface and customizable settings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published