WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Sound activated recording  (Read 3465 times)

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Sound activated recording
« on: January 02, 2016, 07:39:49 AM »
Hi Guys,

I use PS3 Eye cameras for my home security system running Motionpie.
These only do 640x480 res and I am adding the Pi CSI cameras for high res still etc.
Now starting to use IR leds and NOIR cameras for night time security, based on piCore.

One thing I have been thinking about is using the dogs barking to start recording, audio/still/video.
Got Alsa install and tested audio levels by running this code
arecord -D plughw:0,0 -d 10 -vv /dev/nullmixer
-vv give a VU type output, -d 0 will give continuous running.
This defaults to single channel which is ok for detection.

The Eye 3 webcams have 4 microphones, so there is a possible audio location use.
This would be  good for robot use, pull the camera apart and aim the mics in 4 directions.
Phase delay analysis will locate sound sources.

Where do I find the raw audio data in linux?
I want to use shell, micropython or lua code to set a threshold level and start thing happening if the audio gets above the level.
My Linux Audio coding skills are now two days old.

Having trouble installing sox in piCore which has an interesting Spectrogram function.
Not sure where libgomp.xxx is hiding?

Dog barks are interesting to look at using the spectrogram function in sox or Audacity.
Sox makes a png file for the spectrogram, not sure how I would analysis that with shell script:)
So I want to get the raw data and work on it myself.

Regards
Gavin


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Sound activated recording
« Reply #1 on: January 03, 2016, 06:16:57 AM »
To get the raw data, you need to write a C program using the ALSA api. There's some existing software for voice triangulation, IIRC it was mentioned on lwn some weeks ago.

On x86 gomp is in gcc-libs.
The only barriers that can stop you are the ones you create yourself.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sound activated recording
« Reply #2 on: January 04, 2016, 03:04:11 AM »
Thanks,

Thought I had installed gcc-libs, will have to recheck.
Speex has a tcz, I will try that too.
Looking like a LPC encoder may be best for dog barks.
LPC seems to get rid of more noise than FFT's.
Makes recog easier?

Never knew about LWN, must be Linux insiders stuff.
Signed up but cannot find that stuff on voice triangulation.

Now that I have ALSA sound input working, sound out should work too.

Know any "text to speech".tcz's? espeak, festival?

Regards
Gavin

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sound activated recording
« Reply #3 on: January 04, 2016, 03:27:52 AM »
There is no text to speach application in the repo for RPi.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sound activated recording
« Reply #4 on: January 04, 2016, 03:51:32 AM »
Found it,  Oct 28
Gstreamer stuff with a link to ManyEars.
Wonder if I can use it with the 4 microphones in the PS3 Eye cam?

Another link to Hark that does use the PS3 Eye.
Bit more useful for robots, even has some serious Windows software.
Looks like it uses Julius for speech recog.

Bela, no text to speech:(
Might have a look at Flite, cut down Festival or Pocketsphinx.
Speech stuff here.
http://raspberrypi.stackexchange.com/questions/10384/speech-processing-on-the-raspberry-pi

Be kind of cool to put the PS3 Eye on a servo and have it turn and look at a speaker then talk back to them.
Face tracking with OpenCV next?
The Pi Zero has no camera, so a PS3 Eye gets me a cheap USB camera and microphones.
Going to have to cut the cable and put a micro B connector on it.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sound activated recording
« Reply #5 on: January 04, 2016, 10:42:08 AM »
Lots of missing dependencies for sox when I manually installed it.
Used the internet from home and tce-load -wi now works.
sox seems to work now.
Now I can try this
http://ymkimit.blogspot.com.au/2014/07/recording-sound-detecting-silence.html
or this
http://unix.stackexchange.com/questions/55032/end-sox-recording-once-silence-is-detected
or this
http://www.commandlinefu.com/commands/view/7915/record-audio-and-use-sox-to-eliminate-silence.-results-an-ogg-file-that-only-contains-the-audio-signal-exceeding-45db

Seems to be a few options to get the bit rate down, reducing file size.
Not sure yet how to use this to trigger still and videos.
More to learn.