Tag Archives: audio record

Record audio with multiple sound cards

Our audio record object can support recording with multiple sound cards. You can do like this:

1. Create multiple audio record objects at initialization time like this. (Take VB.Net as example)

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private rec As AudioCtl.CAudioRecord
    Private rec1 As AudioCtl.CAudioRecord
 
#Region ” Windows Form Designer generated code ”
    Public Sub New()
        MyBase.New()

        ‘This call is required by the Windows Form Designer.
        InitializeComponent()
        ‘Add any initialization after the InitializeComponent() call
        rec = New AudioCtl.CAudioRecord
        rec1 = New AudioCtl.CAudioRecord
        rec.SetSilenceLevel(1000)
    End Sub

 

2. Then the record objects can be used independently by setting the device index to different sound cards. You can record different source line for different sound cards and save the audio in different output files.

Record left and right channel independently

As we know, normal sound card supports stereo channels. In some cases, you may just want mono channel data. You can combine two mono channel signals into stereo one so it can be captured by one sound card.   

Our audio record component  support recording the left and right channel to different files.

Here is an example in script.

Set WshShell = WScript.CreateObject(“WScript.Shell”)

set rec = CreateObject(“AudioCtl.AudioRecord.1″)

rec.DeviceIndex = 0

rec.DeviceLineIndex = 3

‘test save to mp3

rec.WaveFormatIdx = 15

rec.SetOutputFileName “stereo.mp3″

 

‘set the wave format for the left and right channel

rec.WaveFormatIdxLR = 5

rec.SetOutputFileNameL “L.mp3″

rec.SetOutputFileNameR “R.mp3″

 ’start recording

rec.StartRecord 2, 44100

WScript.Sleep 10000

rec.StopRecord

 

‘Test, save to wav

rec.FileFormat = 0

rec.WaveFormatIdx = 31

rec.SetOutputFileName “stereo.wav”

‘set channel wave format 

rec.WaveFormatIdxLR = 30

rec.SetOutputFileNameL “L.Wav”

rec.SetOutputFileNameR “R.Wav”

 

rec.StartRecord 1, 44100

WScript.Sleep 10000

rec.StopRecord

set rec = NOthing

 

 

Record Skype calls

Have you ever wanted to record skype conversations?

When you are doing skype, there are two sound streams. One is the microphone input, which is your own voice. The other is the remote voice from the one you are chatting with. The two sound streams needs to be mixed and recorded in real time.

Audio Record Expert can help you do that. I just tried it with logitech quickcam, which has a build-in audio USB device.

Do the following:

1. Set the logitech microphone as default voice capturing device. This can be done in control panel.

2. Run Audio record expert, select the “Logitech microphone” to capture. The source combo is empty, just ignore it.

skyperec.JPG

3. now, start recording and start your skype and make call. (Skype will use the logitech microphone to record as well.

4. Upon finishing conversation, you can stop recording. What you get is a full recording of both parties in the conversation. See, It is easy to record your skype interview now.

 

Note, I use the WMA speech codec since it will produce the smallest and good quality of voice recording.

I think the logictech capture driver does something special so it can capture the audio output of the other sound card on my PC, which skype uses to output the remote voice.

 

 

 

Delay between StopRecord and StartRecord

A customer wants to do a quick start recording after stop recording when using our Active Audio Record object. He is concerning about the delay between the two calls.

I would say the delay is pretty small. The time is spent by the two calls, which is dependent on the sound card reaction speed for stopping recording and restarting a new one. I believe it would be milisecond level for the sound card nowadays.

Use Active Audio Play Object in C#

Our Audio Record component has  simple playback functions for mp3, wma, ogg or wave files.

You can use play object in C# easily like the record object since it is a standard COM object like the record one.

In the C# project, assume you have added the AudioCtl.dll as reference. The following is a function to play mp3, wav or wma files.

        private void PlayFile(string filename)

       {

            AudioCtl.CAudioPlay play = null;

            play = new AudioCtl.CAudioPlayClass();

            play.PlayFile(filename);

        }

Remember you need to install Windows media format SDK to play mp3, wma files.

http://www.guangmingsoft.net/activetts/wmfdist.exe

DSCN1323.JPG

 

TTS on Windows

 

DSCN1300.JPG

  

Windows currently has two speech APIs. One is SAPI4 on Windows 2000. The other is SAPI5 since Windows XP.

However, it is possible to use SAPI5 on windows 2000 or even windows 9x. You can install Speech SDK 5.1 which has included SAPI and some free TTS voices as well as speech recognition engines.

Our TTS products, Active TTS/Speak Aloud support both SAPI4 and SAPI5 voices. It also means they depend on SAPI4 or SAPI5. So the machines should have SAPI4/SAPI5 and some TTS voices installed beforehand.

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