Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import .CDA tracks from a CD in windows 10 universal app?

I need to import tracks from a CD but so far I am unable in doing so. I can successfully import .mp3 or many other audio formats from a CD. For importing purpose first I scan files and folder of a CD. Then I show the list of files to user and copy files that user selects from list.

Here is my code for scanning a Directory or a CD:

    List<StorageFile> allTrackFiles = null;
    private async Task GetFiles(StorageFolder folder)
    {
        if(!scanningRemovableTask)
        {
            return;
        }
        try
        {

        if(allTrackFiles == null)
        {
            allTrackFiles = new List<StorageFile>();
        }
        var items = await folder.GetItemsAsync();

        foreach (var item in items)
        {
                if (item.GetType() == typeof(StorageFile))
                {
                    StorageFile storageFile = item as StorageFile;
                    allTrackFiles.Add(storageFile);

                    var basicProperties  = await storageFile.GetBasicPropertiesAsync();
                    var musicProperties = await storageFile.OpenReadAsync();
                }
                else
                    await GetFiles(item as StorageFolder);
        }

        }
        catch(Exception e)
        {

        }
    }    

I pass the CD path to this function and it creates a list of files for me. This code works fine when CD has only .mp3 or any famous Audio format. But it creates trouble when CD has .CDA extension tracks. As we know that .CDA files are itself doesn't play, they are just shortcuts to the original media files.

Now, this is where I am stuck right now. How to read .CDA files or import .CDA files media to our local Directory in universal windows app.

like image 486
Waqas Ahmed Khan Avatar asked Oct 04 '16 07:10

Waqas Ahmed Khan


People also ask

How do I open a .CDA file in Windows 10?

Double click on a CDA file, and usually, Windows Media Player will be launched to play the audio track. Alternatively, you can right click on a CDA file, head to Open with, and choose another . cda player to open it. VLC Media Player, iTunes, RealPlayer, and Winamp all can play CDA files.

What program will play .CDA files?

Files in CDA format can be opened with Apple iTunes, VideoLAN VLC media player and other audio player in Mac Os, Microsoft Windows based and Linux platforms.

How do I rip a CDA file to Windows Media Player?

This how to use it to extract CDA files: Open Windows Media Player, click “Rip Music from CD” and click “OK.” Windows Media Player will automatically open on screen. Choose whether or not you'd like to copy protect your songs from the dialog box on screen and click “I Agree” then “OK.”

Can you rip Wavs from a CD?

When you rip music from a CD, you're copying songs from an audio CD to your PC. During the ripping process, the Player compresses each song and stores it on your drive as a Windows Media Audio (WMA), WAV, or MP3 file.


1 Answers

Short answer: This is not possible with CDA files.

Long answer: A CDA file is just a stub file generated by Windows for each audio track on the CD. These files do not contain the actual audio data. All they contain is where on the disc each track starts and stops. If the file is "copied" from the CD to a computer, it cannot be used on its own because it is only a shortcut to part of the disc. An audio CD is not formatted as a file system disk. It cannot be accessed as files. That is why windows creates the CDA files. It displays the CD as a drive with files for the tracks just for easy viewing.

You will have to use a library that can load the actual audio tracks from the disk, not as files but as audio tracks. The proper way to use the CDA would be to use it as a reference to the actual audio track, rip that to a file, then load the ripped file.

You can use the native Windows Media Interface for ripping audio tracks. I also found a Code Project Tutorial that seems to be using a custom ripper. They should get you going in the right direction.

like image 120
Jaguir Avatar answered Sep 26 '22 02:09

Jaguir