Shop OBEX P1 Docs P2 Docs Learn Events
Detect and trigger on the sound of a human voice — Parallax Forums

Detect and trigger on the sound of a human voice

Chuck RiceChuck Rice Posts: 210
edited 2008-10-27 02:30 in Propeller 1
Does anyone know of code that could be used to take a line-out (or headphone out) signal of a singer singing a song, and trigger a pin high for the duration of the sound? So the pin would be high when the singer sang a word, but low during frequencies other than human vocals. I thought that the microphone_to_vga would be a start, but it looks like it would trigger on amplitude, not frequency.
Wikipedia said...
The voiced speech of a typical adult male will have a fundamental frequency of from 85 to 155 Hz, and that of a typical adult female from 165 to 255 Hz
I think that it is too late for this year, my singing skeleton has to perform at the party tomorrow night. I have a solution that works (black box I had in the Halloween Junk Drawer), but it is very fiddly. Is what I am looking for called a Notch Filter? -Chuck-

Edit 1: I added a couple of pictures.

Edit 2: Here is a link to a movie of the skeleton: www.wildrice.com/Halloween/Construction/Skelly/Skelly.m4v

Post Edited (Chuck Rice) : 11/1/2008 2:15:06 AM GMT
1200 x 1600 - 857K
1600 x 1200 - 360K

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-10-24 21:59
    The ease of this is dependent on if there is music in the background. If there is then there undoubtedly will be music content in the 300 to 3400 Hz range of the human voice. To deliniate the two would require very complex analysis (too much for a general microcontroller) and there would still be a substantial error rate since the human voice in a sustained note is very difficult to differential from a melodic instrument (brass, string, etc). It requires looking at harmonic content, and most systems I've seen have the sound to be analyzed in isolation to make it easy to make sure which spectral peaks belong to each source (since there is only one source).

    The quickest way to achieve what you want is to generate a control track, where you use a sound program on your computer to manually generate a time file of when the human voice is present. You sync the playback with the control track to make it appear as though your skeleton is singing the song.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 10/24/2008 10:05:54 PM GMT
  • Chuck RiceChuck Rice Posts: 210
    edited 2008-10-24 22:11
    There is the rub. You are right, but the idea is to have the skelly sing to any music during the party. i am also using the Propeller to urn the head and hope to add arm movements tonight.

    I would be willing to live with a few false triggers. People sometimes move their mouth when they are not singing, or singing DA-DA-DA to the music. By moving the frequency code to the Propeller, I would also be able to have another cog trigger on a guitar frequencies and cause the skelly's hand to strum his guitar in sync.
  • hippyhippy Posts: 1,981
    edited 2008-10-25 13:54
    Most software disco light controllers doing sound to light use simple band pass filters and ADC to determine the relative intensities of various frequency bands in the incoming sounds. Those are then processed to 'do something interesting' with the outputs.

    Something along that principle should work. Getting arms to move in response to bass beats and suchlike is probably easier than trying to track vocal presence but accuracy probably isn't as necessary as overall effect.

    Once you've got some raw data which represents the music to work with it's really just a matter of coming up with some algorithms to detect beats, determine bpm, crescendos, silences and so on. Once you have that it's then a case of combing that to create some output. It is also possible to make some good guesses as to type of music being played and modify what the output is as appropriate; wild gestures for rock 'n' roll, smoother ones for slow ballads.

    I wouldn't worry about getting everything perfect; most people seem to be more impressed by what does work well and will overlook what doesn't.
  • HannoHanno Posts: 1,130
    edited 2008-10-25 22:44
    If you have a Propeller Demo Board (the one that comes with the Starter Kit) you can use ViewPort to show a spectrum analysis of the sounds captured by the built-in microphone. It's tutorial #13 which let's you look of the spectrum from 3 different sources: amplitude modulation from specified frequencies, add-beat from specified frequencies or from the microphone. The microphone demo/ViewPort spectrum analysis is quite sensitive to singing, I can sing across the room and watch the magnitude of the signal change in real time.
    Once you figure out which frequency best matches your singing, you can use the fft object to react to the singer. I would use a multi-state trigger. For example, only trigger when you pass a threshold at frequency X, then Y, then Z. Good luck!
    Hanno
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-10-26 02:38
    Chuck Rice,

    Use two microphones located on the same stand relatively in the same vertical plane. One microphone will pick up ambient sound "music" plus some of the singer while the other will pick up ambient sound plus most of the singer. subtract the two via a differential amplifier or wire the two mic's in series so that they are out of phase with one another.

    If this is a Stereo recording and you are trying to pick off the vocals, then this may already be mostly done for you...... With most recordings the voice track is always in MONO equally distributed on both the Left and Right channels.... you can prove this by creating a 3rd channel or "center channel" take the POSITIVE terminal from each output Left and Right and wire that to a single speaker. Doing so will only allow stereo signals to be heard from the center speaker and most VOICE will be silent.

    Ok, so the center channel is sort of opposite of what you want.... use the center channel to dynamically attenuate the original signal... in other words have two Op-Amps for each channel Left and Right setup as a 1:1 gain amplifier. Use the center channel technique by using a third Op-Amp in a differential mode which drives or quenches the gain to the Left and Right Op-Amps.... The output should be mostly voice.


    Edit: Attached schematic block diagram

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 10/26/2008 1:50:42 PM GMT
  • HannoHanno Posts: 1,130
    edited 2008-10-26 06:39
    I took a quick screenshot of me singing "uuuuuh". Strong peak around 420hz, see attached!
    900 x 621 - 260K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-26 17:35
    Chuck.. You should also enter this for our Halloween contest.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-26 20:10
    Hey Chuck, This is a bit off topic but I did something similar years ago.
    Here's the link - the pics might give you some ideas on mechanics.
    Jim-

    http://cannibalrobotics.com/Photo_ralph.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • Chuck RiceChuck Rice Posts: 210
    edited 2008-10-27 02:30
    The skeleton at the party last night was a big hit! The Skeleton ran all night and sang and looked back and forth without a single problem. This is saying a lot because I am using a fourth-class, full size Bucky skeleton from www.anatomical.com/product.asp?pn=CH10D4, and it is very heavy. I was worried that the motors might overheat, but it was not a problem. I will try to post some video of it in action when I get a chance.

    OBC, I would, but Time is short during the Halloween season. It takes me a couple of weeks to set everything up. My Propeller code is nothing much so far. I do not think it would qualify at this point.

    Beau, Thanks. That looks like an awesome thing to try. I can't wait to try give it a test! Too many projects. So little time.


    CannibalRobotics, I also did one years ago, I think about 1999, and used what looks like that same skeleton. Take a look at: www.wildrice.com/Halloween/Construction/Skeleton/. Your hardware looks much more sophisticated than mine. That skeleton was very light weight, which is good, but I found it rather breakable. I also kept stripping the gears in the arm due to the stop and start mass of the arm. . It did not last from season. The arms and legs kept breaking off. [noparse]:)[/noparse] [noparse][[/noparse]url]
Sign In or Register to comment.