How to perform a CD ripping session |
|
A CD ripper, CD grabber or CD extractor is a piece of software designed for "ripping" raw digital audio (in format commonly called CDDA) from a compact disc to a file or other output with a CD-ROM or DVD-ROM drive in a PC.
Before starting a CD ripping session, Audio Sound Recorder needs to be initialized: for this purpose it's mandatory a call to the InitRecordingSystem method; the best place to call this method is usually the container form initialization function: for example, when using Visual C#, it will be the Form_Load function.
Now the control needs to know where and how ripped sound data will be stored; the first thing to decide is the output format of the ripped sound: for this purpose you need to set the EncodeFormats.ForCdRipping property to one of the available encoding formats.
Each encoding format set into the EncodeFormats.ForCdRipping property have its own settings which can be controlled through sub-properties of the EncodeFormats property: for example, if the chosen encoding format should be ENCODING_FORMAT_WAV you would have to modify settings of the EncodeFormats.WAV property, if chosen encoding format should be ENCODING_FORMAT_MP3 you would have to modify settings of the EncodeFormats.MP3 property and so on for the remaining accepted encoding formats.
Before starting a recording session, you could have the need to resample incoming sound data, for example for reducing the final recording size: for this purpose you should check the EncodeFormats.ResampleMode property and choose which of the available resample modes would best fit your needs.
At this point we can proceed in two different ways:
1. | Ripping single CD tracks through the CdRippingStart method which needs to know the following: |
• | the input CD drive: installed CD drives can be enumerated using the GetCdDrivesCount method and their friendly description can be retrieved through the GetCdDriveDesc method. |
• | the CD audio track: the total number of available audio tracks on the given CD can be obtained using the GetCdNumTracks method: remember that CD tracks are 1-based so the first track will be identified by the index 1 instead of 0. |
• | the output file location: if an absolute pathname is specified, it can be a file on the system hard disk or, if the pathname is left empty, a memory file that can be used at a later time, for example in order to perform a custom encrypting before saving it to a file on disk. |
The current ripping session can be stopped at any time through the CdRippingStop method.
The container application is notified about the start of the CD ripping session through the CallbackForRecordersEvents delegate which is invoked with the nEvent parameter set to the following values:
• | EV_CD_RIPPING_START invoked once at the beginning |
• | EV_CD_RIPPING_PERC invoked multiple times reporting the current advancement percentage inside the nDataLow3 parameter |
• | EV_CD_RIPPING_SIZE invoked multiple times reporting the current size in bytes inside the combination of the nDataHigh3 and nDataLow3 parameters |
• | EV_CD_RIPPING_STOP invoked as soon as the ripping session is completed |
2. | Ripping multiple CD tracks at once through ripping automation methods: |
• | the ripping automation session is initialized through the CdRippingAutomationInit method: this method allows setting up the input CD drive and the output mode: you can decide to store each single track into a separate output file or to store all tracks inside a single output file: in this latest case you can also set the amount of silence that will be inserted between each ripped track. Installed CD drives can be enumerated using the GetCdDrivesCount method and their friendly description can be retrieved through the GetCdDriveDesc method. |
• | CD tracks to rip are added to the automation through the CdRippingAutomationTrackAdd method: the total number of available audio tracks on the given CD can be obtained using the GetCdNumTracks method: remember that CD tracks are 1-based so the first track will be identified by the index 1 instead of 0. If the session was initialized to store each track into a separate output file, you can also specify the output pathname: if an absolute pathname is specified, it can be a file on the system hard disk or, if the pathname is left empty, a memory file that can be used at a later time, for example in order to perform a custom encrypting before saving it to a file on disk. |
• | the ripping session is started through the CdRippingAutomationExec method. |
The current ripping automation session can be stopped at any time through the CdRippingStop method.
The container application is notified about the CD ripping automation session through the CallbackForRecordersEvents delegate which is invoked with the nEvent parameter set to the following values:
• | EV_CD_RIPPING_AUTOMATION_START invoked once at the beginning |
• | EV_CD_RIPPING_PERC invoked multiple times reporting the current advancement percentage of each single track inside the nDataLow3 parameter |
• | EV_CD_RIPPING_AUTOMATION_TOTAL_PERC invoked multiple times reporting the advancement of the overall ripping automation session |
• | EV_CD_RIPPING_SIZE invoked multiple times reporting the current size in bytes of each single track inside the combination of the nDataHigh3 and nDataLow3 parameters |
• | EV_CD_RIPPING_AUTOMATION_STOP invoked as soon as the ripping automation session is completed |
In either cases you can limit the ripped track's range through a call to the CdRippingSetRange method and reduce the overall output size through resampling: for this purpose you can define resampling parameters through the CdRippingSetResampleParams method.
After completing the ripping of a single CD audio track, output formats like WMA, MP3, OGG Vorbis and MP4 can add song information to the output file through the use of tags: tag's information can be obtained through public Internet databases that support the CDDB protocol: if the CddbAddTagOnCdRipping property is set to True and if an Internet connection is available and open, the control can automatically retrieve and add this information to the output file tags: see the How to get Audio CD info using CDDB servers section for details. Note that CDDB information about the CD album can be retrieved from the server before starting the CD ripping session so, information like the song title and the author name, can be easily used to compose the output file name that will be sent to the CdRippingStart method.
Another feature that can be used before starting a CD ripping session is the ability of the control to retrieve the cover art of the CD inserted inside the CD drive: see the How to get a CD cover picture section for details.
An important feature for CD ripping session is the ability to normalize the level of audio tracks: see the How to perform a CD ripping session with tracks Normalization tutorial for details.
A couple of samples of usage of CD ripping in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package:
- CdRipper
- CdRipperAutomation