Skype is a free voice software, which can point to point with computers for free voice calls, and it charges the low cost with calls directly to the fixed telephone or mobile phone, Skype offers excellent quality and won the favor of many users all over the world, I am a faithful user of Skype, below is my Skype screenshots:
Why we need a Skype call recording system?
I often use Skype with my Taiwan compatriots when I was in mainland, sometimes my business requires a call recording on Skype: www.purecalifornia.co.uk for retaining purpose, I have this in my mind about that time, however, Skype official did not provide call recording capabilities, we have to find our own way to figure it out, luckily I can build my own "Skype recorder" with C++, this is the reason why I love programming.
How to develop your own call recorder for Skype with Skype public API?
The programming ideas and source code contributions out and encourage one another, hoping to give the programming friends who are interested to provide a little help, then I‘ll be satisfied.
At the beginning of writing this program, I tried using a conventional tape recording of a sound recording, since it is a Skype call recording, we are hoping to own and each other‘s voice sound simultaneously recorded. First of all, we want each other‘s voice can be recorded, it can only choose "Stereo Mix" channel recording, but this time the sound "microphone" channel will be discarded, which means that the other party will not hear me in Skype speak; secondly, we have to be my own voice recorded, also open the "microphone" channel recording, but during a Skype call, "microphone" channel has been occupied by Skype, which means our program cannot be recorded again, it seems the normal recording mode does not work in such case.
Inside of Skype public API
So, I think the underlying Windows audio processing mechanism, any voice audio data processing software to the end are inseparable from the underlying Windows audio Win32 API function, see the following screenshot:
With these functions, I find a way to use the Windows system hooks to detour original address of these audio functions used by Skype voice calls. The Skype program calls these APIs before they come into my Win32 API functions, I will obtain the Skype‘s audio data "secretly" with a copy parts passed to my own application, then the function returned to Skype, so you can mysteriously call in the voice data taken out, together with their own mp3 compression module to save the audio data to a disk file.
Key to record the audio data from a Skype call
All the above is the whole idea of recording Skype, now I am going to introduce the code.
Since our program needs to be embedded into the Skype program, so we can only use the form dll to write this program, now I need to modify the class to write a Win32 API function address, where I direct reference to the book "Windows core programming", I had the source code provided in this class that can modify the address Win32 API function when we modify the address after a good API function, Skype calls previously six function system automatically , then call our function, see the code:
At this point, Skype audio streams in a Skype call (the other party and myself speak voice) have been "stolen", as long as it can be compressed into mp3 format, it is ok to download the file to playback, I use the "hw_mp3_enc. DLL library" to encode the recording stream, the quality is great, and it can be used to make a telephone recording as well.
There is an interesting feature for Skype call recording, it’s possible to insert the other side of the sound into the left channel, which means my own voice is on the right track, just like two people face to face in the dialogue. Since it is not difficult to understand, we can learn it from the above code, in fact, the input and output of audio data are acquired independently, they are incorporated into the mp3 files by saving the input data in the left channel and output of data storage for the right channel.
Now that is called "Skype call recorder", besides having a recording function, there is an automatic reply function included, in order to achieve this function, we need to have two steps:
A) When the incoming call is ringing, switching the recording channel to the "stereo mixing", and play the prepared audio file into the Skype call.
B) After the call is ended. Using the waveInPrepareHeader function to replace recorded sound from the microphone, using this method is difficult to control, but can find a lot of strange effect, such as phone voice, etc.
There is something else need to pay attention, which is the program hooks, by intercepting the Skype audio data, and it’s execution efficiency is very high, for slow processing operations (such as: mp3 compressed data, data saving, etc.) is the best working in the other thread processing, otherwise it will affect the quality of Skype calling, cause intermittent feeling, and call recording data may be lost.