Intelligent Voice Recording Program

Source: Internet
Author: User

1.

I have a bad habit since childhood, is like peeping other people's privacy. Of course, in moral, I always ask myself to be a gentleman, but it is a psychological hobby. So I grew up on eavesdropping, stealing, hacking technology, cracking technology and other crazy fascinated! In fact, this is one of the important reasons for me to embark on the programmer's path!

Perhaps as Freud has said, the primal desire hidden in the subconscious is the real motive behind all our actions. Like Mighty Hitler and his ambitious struggle, it is only because he is a self-abased shaking s.

2.

The same thing we said today is going to start two years ago. At that time I was still studying in college. Coincidentally, the 4 people in our dorm have a common problem-balderdash. (that is to say in your sleep. I found out from the beginning that I heard them in three of their sleep, and several times it was a big paragraph saying that there was a lot of information. But because everyone is from all corners, the accent is not the same, to understand the heart is hard, even if occasionally understand a few words, the next day woke up and forgot. As a result, everyone said, I also have a talk in my own sleep, and speak vividly, with the film!

Freud said: Dreams are the bridge to the subconscious. The dream hides the secret of the mind that you don't even know. What secret secrets are hidden in other people's dreams? What do you reveal in your dreams that cannot be said in privacy? --All this stirred up a strong desire inside me!

Please forgive a pervert programmer's desire to peep!

3.

So then I always wanted to write a program, can in the late night, according to the size of the volume, intelligent recording sound-so that can put those sleep clean sweep! And then to analyze the hidden secrets, just like Tannangquwu.

But how do you write such a program? Or find resources in the garden.

Later found an article: achieve Voice video recording (demo source)

So study for a period of time, finally have the desire to write their own eavesdropping artifact!

4. Principle and realization

The continuous capture microphone gets the audio frame and then the loudness of the audio frame based on the Fourier transform. When the loudness is greater than the specified value, the recording is turned on-the audio frame is written to the MP3 file, and when the loudness falls below the specified value, the specified number of frames is checked, and if all are below the specified value, the recording is turned off and an audio file is obtained.

The configuration file is as follows:

<?xml version= "1.0" encoding= "Utf-8"?><configuration>  <appSettings>    <!--turn on volume threshold for recording-- >    <add key= "Db2open" value= "30"/>    <!--turn off recording volume threshold--    <add key= ' db2close ' value= >    <!--low decibel continuous detection of frames--    <add key= "Checkcount" value= "/> </appsettings></  Configuration>

First, keep the capture microphone. The code is as follows:

Public Form1 () {      InitializeComponent ();      This.microphonecapturer = capturerfactory.createmicrophonecapturer (0);//collector, open      when the program is started this.microphoneCapturer.AudioCaptured + = new esbasic.cbgeneric<byte[]> (microphonecapturer_audiocaptured);// Scheduled acquisition Event       This.microphoneCapturer.Start ();//Start acquisition       //initialization of the recorder required parameters       this.audioFileMaker.Initialize (" Test.mp3 ", This.microphoneCapturer.SampleRate, This.microphoneCapturer.ChannelCount);}

Where the audiocaptured event is triggered by a 20-millisecond cycle, the parameters are the PCM data captured by the microphone. The logic that can only be recorded is mainly in the event handler function of audiocaptured.

 void microphonecapturer_audiocaptured (byte[] data) {this.audioFileMaker.StartMakeFile (data);//recorder placement here, via Iswork ing parameters to control its working state this.frameCounter.Start (); The frame Count counter is placed here to record the total number of frames in a low decibel period. The isworking parameter is adopted to control its working state this.decibelDisplayer1.DisplayAudioData (data);//decibel monitor displays volume This.labe l_db. Text = This.decibelDisplayer1.Volume.ToString ();//display current volume This.label_RecordSign.Text = This.audioFileMaker.IsWor King?            "Recording": "Not recorded"; This.label_RecordSign.ForeColor = this.audioFileMaker.IsWorking?            Color.Blue:Color.Red; When the volume is above the Open value, open the recorder if (this.decibelDisplayer1.Volume > int.            Parse (configurationmanager.appsettings["Db2open"])) {this.audioFileMaker.IsWorking = true; }//When the number of low decibel frames recorded reaches a certain value, turn off two counters, and then summarize the frame status if (This.lowDBFrameCounter.Count > int) during this time. Parse (configurationmanager.appsettings["Checkcount"])) {//If the low decibel frame number and total frame count have been, that is, the duration of the period of lowif (This.lowDBFrameCounter.Count = = This.frameCounter.Count) {t), turn off the recording if                                   His.audioFileMaker.IsWorking = false;                } this.frameCounter.IsWorking = false;                This.lowDBFrameCounter.IsWorking = false;            Return }//When the volume is below the threshold, turn on the count of the low decibel counter and the number of frames counter if (This.decibelDisplayer1.Volume < int.                Parse (configurationmanager.appsettings["Db2close"])) {this.frameCounter.IsWorking = true;                This.lowDBFrameCounter.IsWorking = true;            This.lowDBFrameCounter.Start (); }                    }
5. PostScript

With this program, every night before bedtime to open, the next morning will be able to harvest quite a lot!

These dreams often have a huge amount of information, and when the Master of a psychoanalysis, the inner secret is nowhere to hide, naked human nature sweeping!

Moreover, sometimes during the day classes also open, and occasionally some unexpected receipts, this is not much to say.

Source: Click to download

This program can actually be further improved, not only smart recording, but also smart video, as long as you plug in a USB camera, you can record monitoring video according to movement. In addition, and image analysis technology integration, but also to complete intelligent anti-theft and other high-end features!

Interested in the realization of smart video friends, you can refer to: achieve voice video recording (demo source)

———————————————————————————————————————————

Attached to read: learn sister to practice, see how I step by step!

Intelligent Voice Recording Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.