How to record from files, memory or clipboard
Recording from a file stored on your hard-disk (or inside your pen drive or inside a memory buffer) must not be confused with a simple "file load": when you record from a file you have the possibility to perform a resampling and an automatic format conversion of sound data stored inside the file; suppose that you have a song, 3:31 minutes long, stored inside a CD quality WAV file (uncompressed, 44100 Hz, Stereo, 16 bits per sample): this kind of file requires almost 37 Mbytes of space: with a few methods call, Audio Sound Recorder for .NET can record sound data directly from this file, resampling with a lower quality (for example 11025 Hz, Mono), converting the sound format to MP3 and, finally, store it again inside your hard-disk or inside a memory buffer for further uses.
In order to start recording from a file, the component needs to be initialised: for this purpose it's mandatory a call to the InitRecordingSystem method; the best place to call this method is usually the container form initialisation function: for example, when using Visual C#, it will be the Form_Load function.
After initialization you need to predispose a couple of settings as for any sound card based recording session; the first thing to decide is the output format of the recorded sound: for this purpose you need to set the EncodeFormats.ForRecording property to one of the available encoding formats.
Each encoding format set into the EncodeFormats.ForRecording 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.
Now we can start the file recording session calling the StartFromFile or StartFromFileRaw methods which need to know 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, recorded sound data are stored inside a memory buffer that can be used at a later time, for example in order to perform a custom encrypting session before saving it to a file on disk.
The recording range can be limited through the SetRecordingRange method.
If your source file is available in CF_WAVE format inside the system clipboard, you can record directly from the system clipboard using the StartFromClipboard method: you can know if a CF_WAVE format sound is available inside the system clipboard calling the IsSoundAvailableInClipboard method.
Each of the mentioned recording sessions will cause the control to fire a RecordingStarted event. After completing the recording session the control will fire the RecordingStopped event. Advancement can be controlled through the RecordingPerc event.
As for a regular sound card based recording session, after completing a file based recording sessions you have the possibility to start a new one without discarding the existing one: for this purpose you need to define how the new recording session will behave through a call to the SetRecordingMode method: this will allow appending the new recording session to the existing one or inserting/mixing/overwriting the new recording session to a given position of the existing one: see the SetInsertPos, SetMixingPos and SetOverwritePos methods for defining where the new recording session will be inserted/mixed/overwritten. It's important to note that file based recording sessions can be merged/mixed with previous recording sessions performed through a sound card.
In case you should need to split the recording session in separate files containing the left and right channels respectively, you could use of the following methods:
|•||StartSplitFromClipboard for recording sessions from clipboard|
|•||StartSplitFromURL for recording sessions from an Internet URL|
|•||StartSplitFromZipFile for recording sessions from a ZIP file|