Make an audio recorder with voice activity detection

I was often asked about a question about Active Audio Record component: Can I detect the input audio level without start recording?

The answer is NO. The reason is that if the recording is not started, sound card doesn’t sample any input signal then no audio level can be returned.

So does it mean you have to record many non-sense silence data into your audio files? Surely not. :)

We have considered the scenerio from very beginning design of Active Audio Record. Silence detection (so called voice activity detection) is an important feature in the component.  You can easily make a typical audio recorder with voice activity detection by integrating Active Audio Record. The detailed steps are:

 

1 . Create an Active Audio Record object, set the appropriate device index and input source device line. (microphone or wavemix etc)

2. call SetDetectSilence(TRUE) to enable silence detection. Don’t forget to SetSilenceLevel as well. Silence definition varies with the environment you are in or the audio signal you cares about.

3. Set a timer to monitor the recording status 

4. Now start recording by calling StartRecord. Since silence detection is enabled, the initial silence audio data will not be saved into audio file.

5. In the timer callback function, you can call GetRecordTime to determine how many audio data have been saved and call GetSilenceTime to get how many silence have been detected currently. Note, this silence length is not accumulated. If some non-silence data come in, the silence length will be reset to zero. So you can use this silence length to determine whether or not stop recording or split audio tracks by silence.

 

DSCN1290.JPG

 

Convert html to image in IIS

This article will discuss how to use html snapshot to convert html to image (JPG, TIFF, GIF, PNG and BMP) under IIS (with ASP or ASP.net)

First, we will discuss IIS 5.0 on Windows XP.  

There are two accouts in IIS 5.0. IUSR_MACHINENAME, IWAM_MACHINENAME.

For the default setting, IUSR_MACHINENAME account is used to access files (reading or writing).

IWAM_MACHINENAME is used to run out-of-process ActiveX object such as Html Snapshot.

For normal html page without ActiveX in it,  we just need to give the IUSR_MACHINENAME write access to the folder  for saving images.

But html page may contain ActiveX such as Macromedia flash movies. The flash ActiveX control needs much privilege to run. I think It needs to access sound card resources etc.

If you don’t want flash to be captured, so it is simple to disable it with the call:

 snap.EnableActiveX 0

But if you want flash, then you need to give enough privilege.

You can do following things:

1. Run DCOMCNFG, click to expand the Component Services, Computers, My Computer, and COM+ Applications nodes. Right-click the IIS Out-of-Process Pooled Applications object, and then click Properties.
On the Identity tab, Set the account to your admin account or current interactive logon user instead of the default one (IWAM_MACHINENAME).

Note, after the account changes, you need to restart IIS (or kill the dllhost.exe running under IWAM_MACHINENAME with taskmgr).
2. Call SetLogOnUser(“admin”, “.”, “password”) before calling SnapURL. Then SnapUrl will impersonate with the logon information when converting html to image.
 

If you use Windows 2003, it is a totally different story since Windows 2003 uses IIS 6.0.

To convert html pages with flash movie to image on Win2003 server, you can do following:

1.  In IIS admin UI, Set the Application Pool property, right click the DefaultAppPool, click property->Identity, Set the account of application pool to Local Service or Local System. (Note, you must set the account to Local System if you want to convert html page which contains ActiveX like Flash movies)

Also, remove “internet explorer enhanced security” in the control panel. It may block the action to convert a URL to image.

2. Call SetLogOnUser(“admin”, “.”, “password”) before calling SnapURL. Then SnapUrl will impersonate with the logon information when converting html to image.

See a snapshot of www.macromedia.com below.

 

macromedia

 

FAQ: what to do if you meet “invalid code” when doing registration

Some people may meet “invalid code” when doing registration. When this happens,  don’t worry immediately. Take a breath and have a look at the vista outside window.

 

plants

 

There may be several things you can consider:

a. If you are an old customer, and your code doesn’t work on new version, then the code may be out of date. You can send email to our support for help. We will give you a new code.

b. If you are new customer, then maybe the software version you used is out of date. You can always download the latest version from our web site and try again.

c. Make sure when you input the exact registration code. Don’t input any addtional characters besides the code.

d. If still failing to get registered, feel free to ask us for help.

Hope this can helps. :)

How to put a child window on Overlay window

From windows 2000 above, Windows supports a new kind of window style: WS_EX_LAYERED. This window style can draw window in semi-transparency or use to make irregular window.

SetLayeredWindowAttributes and UpdateLayeredWindow are two Windows APIs that relate to overlay window.

Layered window can have two drawing modes. One is the tranditional WM_PAINT message handling by the window itself. The other one is by setting a bitmap to the window by calling UpdateLayeredWindow, then windows will handle the drawing or updating of the window. The application itself will not even recieve the WM_PAINT message.

Now there is a problem. What if I put a child window on such a bitmap based layered window? I have tried to add a simple edit window as the child window of the layered window. The edit window can be created, but it cannot draw itself on the layed window.

After doing such research, I found a post on faking child window for a layered window. The basic idea is to create another popup window that will hold the edit control. When the layered window moves, move the popup window with it. So it looks just like child window.

 

On Vacation

Hi, Dear customers:

We will be on vacation for about two weeks from Jan. 21.

I will try to respond any email ASAP. Please be patient.

But I have blogging entries scheduled. Don’t forget to continue reading.

Cheers!

 

 

Audio Recording in web browser

Some customers ask how to do recording in web browser (IE) with Active Audio Record component.  It is quite doable since Active Audio Record is implemented as an ActiveX object and supports scripting. IE has well support for ActiveX via java script or VB script.

We have provided html demo that shows how to create the record object and start/stop recording in IE. See details in the demo version. (DemoVBScripttest.htm)

Some people asked if it is possible to record audio on client computer in ASP.Net. Well, this may be a misunderstood concept. ASP.Net is server script, which means the script is running on server. To record the audio on client side, the audio recording component has to run on the client side. This is the way our demo shows.

When recording is finished, the audio file can be uploaded to server by HTTP PUT.

Html To Image Command Line version

Some customers are interested in a command line version of Html To Image.

We do have such version. Currently it is provided with our ActiveX component product html snapshot. You can download the trial package here. There is a batch program with Delphi source code in DemoDelphiBatch. 

Batch is a command line example of Html Snapshot.
Usage:
BatchGet.exe urllist ouputfolder

urllist is a text file with url list. One url per line
outputfolder is the output directory of images.
strings.ini is the configuration file of the tools. You can control some parameters for snapping.

The ActiveX version of Html To Image allows the customer to have most flexible control on “convert html to image”.

 

WordPress plugin

One good thing of word press is that it has support for plugins. Plugins are script written by others that can enhance the functionality of word press.

Here are some useful plugins:

Keyword plugin: this plugin inserts meta keyword tag for every post.

Adsense plugin: this plugin helps do adsense easily.

Originally I was looking for a spell checker plugin for word press 2.0. Seems no such plugin yet.

Then I tried the spell checking feature in the google toolbar. Seems it can meet my requirement too.

Following is the snapshot of spell checking by google toolbar. It is interesting to see Google doesn’t add “google” as a word in their spell checker. :)

spellchecker.JPG