Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Accessing wave files from an Audio-CD... I need '.wav', not '.cda'

Author
Message
Vidiot
20
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 17th Jul 2010 08:24
This isn't really a DBPro question, but I don't know where else to ask it. I want to access the digital audio directly off an audio-CD but there's a problem. On some of my computers, Audio-CDs appear as a series of wave files (Track01.wav Track02.wav... and so on) that contain the actual trachk data. But on this laptop, audio-CDs appear as a series of 1KB '.CDA' files. These files somehow point to the audio so that windows media player can open them, but I can't.

I'd like to be able to open them both via the LOAD SOUND, and by the OPEN TO READ commands.

Can someone tell me how or why it is I see ".CDA" files rather than ".WAV" files and what I can do about it?

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Jul 2010 14:07
Isn't there specific CDAudio commands built into DBP? If not, then get the excellent enhanced audio plugin which does have them.

My signature is NOT a moderator plaything! Stop changing it!
Slartibardfast
16
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Magrathea
Posted: 17th Jul 2010 17:15
As far as I know, an Audio CD is a different format, hence the need for 'Rippers' that convert them to WAV or other digital format which are more friendly (WAV/AVI/etc...)

All that it would need is some decoder function(s) to allow a program to read these, but there my knowledge stops.

As User indicates, there is a plugin that allows you to do this?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jul 2010 17:29 Edited at: 17th Jul 2010 23:23
Why not use the Help file??????

It took me two minutes to find the relevant command which I've never used before and the following snippet worked perfectly first time.



Edit There seems to be an annoying problem with the built-in commands - they don't detect when the track has finished playing.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Jul 2010 23:55
Or use enhanced audio. Which works perfectly.

My signature is NOT a moderator plaything! Stop changing it!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2010 00:09 Edited at: 18th Jul 2010 00:45
Which command/commands do you use to check whether the current track has finished? I couldn't see one from the thread.

Edit Actually none of the commands are recognized by the compiler. How do you manage to get the Enhanced Audio dll to work?

Edit2 Ignore first edit - I was being stupid. I needed to install the first version of the plug-in first.

However, there seems to be no way of testing whether the CD audio track has finished so this Plug-in (v1.55) seems no better than the built-in DBPro commands as far as .cda files are concerned. What have I missed?
Vidiot
20
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 18th Jul 2010 04:28 Edited at: 18th Jul 2010 05:33
Thanks Gandalf for the info and the sarcasm. I needed the one, not the other. Why be that way? Does it make you feel superior?

I looked at all the 'sound' commands. I was unaware that there was a seperate catagory of 'music' commands too. Seems kinda redundant if you ask me because they are all sound commands after all.

@Mobiius: I have the 'enhancements' add on but I can't seem to get the Encode To OGG VORBIS command to function. So for now, the rest of the OGG sound functions are useless to me. According to the docs it only works with wav files anyways. I don't know of any other function within the 'enhancement' add-on that would help me. Or do you mean a different add-on.

EDIT: I found the Enhanced Audio dll you were speaking of. And it seems to have everythig I was looking for! Thanks again!!!

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2010 12:19
Quote: "EDIT: I found the Enhanced Audio dll you were speaking of. And it seems to have everythig I was looking for! Thanks again!!!"


I seem to be the only one that can't get the plug-in to work completely with .cda files. Have you managed to find the function which detects whether a CD Audio track is still playing? I can find the right function for the other audio files but there doesn't seem to be one for the CD Audio section.

It's your turn to feel superior now.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jul 2010 15:48
Ahhh, Now I see a flaw in the plugin. Having read the keywords file, there doesn't appear to be any kind of commands which even tell you which track is playing, let alone when it's finished.

That's a shame, because this plugin is far superior to the standard DBP commands. (Just don't ask it to play MP3's encoded at 160kbps, or try to read ID3 information from a file without ID3 information. It just crashes.)

I'm using it for an in car computer front end I'm writing. I even figured out how to get the album art from an MP3.
Video located here...

My signature is NOT a moderator plaything! Stop changing it!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jul 2010 17:00
Thanks for that.

I guess the only solution for now is to write your own function. The .cda file is only 44 bytes long and contains the track duration data. Once we know how that is coded I guess it's a simple matter to read the relevant bytes and calculate the duration ourselves and check with DBPro's timer() function whether the track should have finished. Here's what I've found so far from Wotsits format:



I haven't translated that into plain English yet but it looks like a start.
Vidiot
20
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 18th Jul 2010 19:56
@Gandalf: Me superior? Never! LOL Ok, I did a search for a description of 'HSG format' and all I could find was the article you quoted from. Is HSG japaneese for track/Sector/block or something simple like that?


Thanks again for some more really useful information. But it leads to the next question: Does anyone know a function within DBPro or any add-on that would allow me to open a sector off a CD? To use the .cda file's information, I would need to access sectors that don't appear as a part of a file. I don't have the 'c' skills to write my own DLL. Heck, I have enough trouble using the DLLs that have already been preped specifically for DBPro.

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Jul 2010 01:56
I don't know about sectors but the following snippet shows you how you can play selected tracks from a CD Audio disk. This uses the native DBPro commands and no plug-ins.

The demo code plays tracks starting with Track 3. I'm sure you can tweak it if necessary.

I couldn't get the Enhanced Audio plug-in to work in the same way.



Thanks for raising this question - I've learnt something useful by working on it.
Vidiot
20
Years of Service
User Offline
Joined: 15th May 2006
Location: TN
Posted: 20th Jul 2010 05:37
Thanks for that snipit. It worked great. I really appreciate the help and encouragement.

The project was to create a subset of the features of an existing program designed to play back multiple simultaneous audio files in a live theatre or show situation. The existing program really just creates a cue list that can be saved as a show and makes it easy to play the tracks or edit the order of the tracks or rename tracks. Ultimately, what I'd like to add is the ability to rip CDs within the program. Right now, they use Windows Media Players to rip the tracks and I can continue to do that while I build the parts of this program that I can.

And even if I can't reach the objective of riping CDs myself, I'll still learn a lot along the way.

The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2010 15:30
Quote: "There seems to be an annoying problem with the built-in commands - they don't detect when the track has finished playing"

I think I read somewhere that if you use something like the following it detects it fine but I haven't tried it...



I'll have to try it later...

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2010 16:22
That will start playing the current track, then immediately stop it, and finally start it again. How would all that help?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2010 16:30
Quote: "That will start playing the current track, then immediately stop it, and finally start it again. How would all that help?"

When your PC isn't working and you turn it off then on again, how does that help? I don't know but have you tried it?

I just read it somewhere on the forums, someone said they did that and it detected "music playing" again...

Maybe it resets something that doesn't initialise properly the first time (not that I've tried it myself you understand)

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2010 16:46
Quote: "When your PC isn't working and you turn it off then on again, how does that help? I don't know but have you tried it?"


Point taken - I'll try it. Seems a clumsy hack though.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2010 16:57
What did you just call me?

I may be a clumsy hack but at least I'm a drunk too!

...just kidding, yeah it sounds clumsy but if the DBP command doesn't work what else can you do? I'd try it myself but no speakers here at work!

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2010 17:00
Quote: "what else can you do"


Use my snippet?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2010 17:14
Quote: "Use my snippet?"

Point taken. I just thought I'd post it as a possible solution to the "music playing" bug in case anyone was having that problem.

Login to post a reply

Server time is: 2026-07-25 16:20:05
Your offset time is: 2026-07-25 16:20:05