Page 1 of 11

pCD 1.5 - CD-audio player

Posted: Fri 01 May 2009, 18:14
by zigbert
This is a standalone cd-audio player.
The code could as well be used in other projects to include cd player feature.
It won't add ANY new dependencies since it uses only cdda2wav (icedax) and aplay.
The code is very simple (easy to understand) - it is only 4Kb.
Language support

Sigmund Berglund


Download
username: puppy
password: linux

pCD-1.5 (4 kb)

Image

Posted: Fri 01 May 2009, 18:54
by Dingo
tried on puppy 3.01 (2.6.21.7 kernel)

it shows an error:

Code: Select all

# expr: syntax error
cdda2wav: No such device or address. Cannot open '/dev/sr0'. Cannot open SCSI driver.
cdda2wav: For possible targets try 'cdda2wav -scanbus'.
Use the script scan_scsi.linux to find out more.
Probably you did not define your SCSI device.
Set the CDDA_DEVICE environment variable or use the -D option.
You can also define the default device in the Makefile.
For possible transport specifiers try 'cdda2wav dev=help'.
aplay: playback:2018: read error
to solve Cannot open '/dev/sr0 changed this to '/dev/hdc in func

statrted again, but another message is showed (I think this time is CD fault)

Code: Select all

Type: ROM, Vendor 'HL-DT-ST' Model 'CD-RW GCE-8525B ' Revision '1.03' MMC+CDDA
569344 bytes buffer memory requested, transfer size 131072 bytes, 4 buffers, 55 sectors
cdda2wav: Read TOC CD Text failed (probably not supported).
#Cdda2wav version 2.01.01a23_linux_2.6.18.6_i686_athlon-4, real time sched., soundcard, libparanoia support
AUDIOtrack pre-emphasis  copy-permitted tracktype channels
      1-18           no              no     audio    2
Table of Contents: total tracks:18, (total time 76:39.00)
  1.( 8:39.30),  2.( 6:07.42),  3.( 4:57.10),  4.( 3:35.53),  5.( 1:44.52),
  6.( 7:08.18),  7.( 5:30.20),  8.( 1:39.40),  9.( 3:15.00), 10.( 2:49.47),
 11.( 3:14.43), 12.( 2:23.30), 13.( 5:59.20), 14.( 5:49.27), 15.( 2:32.73),
 16.( 2:49.70), 17.( 3:38.15), 18.( 4:44.10)

Table of Contents: starting sectors
  1.(      33),  2.(   38988),  3.(   66555),  4.(   88840),  5.(  105018),
  6.(  112870),  7.(  144988),  8.(  169758),  9.(  177223), 10.(  191848),
 11.(  204570), 12.(  219163), 13.(  229918), 14.(  256863), 15.(  283065),
 16.(  294538), 17.(  307283), 18.(  323648), lead-out(  344958)
CDINDEX discid: 6u42dJRdZoVIkKOY2SLS3s_xCuY-
CDDB discid: 0x2311f712
CD-Text: not detected
CD-Extra: not detected
cdda2wav: Incorrect start track setting: 0
Please use -help or consult the man page for help.
aplay: playback:2018: read error

Posted: Fri 01 May 2009, 19:39
by vovchik
Dear Dingo and Zigbert,

This device setting worked for me in Puppy 3.01:

Code: Select all

cdda2wav -Igeneric_scsi -D/dev/hdd -t $CDDA -Owav - | aplay &
The only think I do not see is the tracks list if the CD does not have an entry in the cddb database. I don't even get a 1-xx track list with times, although I see that data in the terminal.

With kind regards,
vovchik

Posted: Fri 01 May 2009, 19:53
by zigbert
does Puppy 3 include the cddb_query command. I think plinej first used it in his pcdripper. It is possible to use cdda2wav to read cddb info, but it is much slower than cddb_query.

vovchik
does it work to use /dev/cdrom. I could include an CD-player option, but the easiest would be to use /dev/cdrom. -like this

cdda2wav -Igeneric_scsi -D/dev/cdrom -t $CDDA -Owav - | aplay &

This works for me in Puppy 4.12 as well as

cdda2wav -t $CDDA -Owav - | aplay &


Sigmund

Posted: Fri 01 May 2009, 20:22
by vovchik
Dear Sigmund,

Both methods you propose work for me under Puppy 3.01, as well as my own hard-coded one. I have a symlink in /dev from hdd to cdrom, and your second suggestion may be the best one, since it is not device-specific. I installed Plinej's package, so I have cddb_query on my system. It would be nice to get the raw cdda2wav data such as:

Code: Select all

Table of Contents: total tracks:11, (total time 74:26.56)
  1.( 4:03.68),  2.( 6:57.50),  3.( 4:04.20),  4.( 3:29.74),  5.( 5:47.25),
  6.( 6:36.57),  7.( 4:28.33),  8.( 7:13.63),  9.( 3:59.00), 10.( 3:29.27),
 11.(24:16.14)
into the track list in cases where the CD does not have a cddb entry. What do you think?

With kind regards,
vovchik

Posted: Fri 01 May 2009, 20:32
by zigbert
It would be nice to get the raw cdda2wav data such as:
Code:
Table of Contents: total tracks:11, (total time 74:26.56)
1.( 4:03.68), 2.( 6:57.50), 3.( 4:04.20), 4.( 3:29.74), 5.( 5:47.25),
6.( 6:36.57), 7.( 4:28.33), 8.( 7:13.63), 9.( 3:59.00), 10.( 3:29.27),
11.(24:16.14)

into the track list in cases where the CD does not have a cddb entry. What do you think?
You miss the length detection????? Let's see where this leads us ........ Not VERY important as I see it, but ...........


Sigmund

Posted: Fri 01 May 2009, 20:35
by zigbert
Version 0.2
See main post

Changelog
Bugfix: Detection of CD-drive
Bugfix: View blank list when no disc is detected.

Posted: Fri 01 May 2009, 20:49
by vovchik
Dear Sigmund,

The device setting is now pretty universal. I hope we hear from some other users, too. About the length detection, it is not so much that I miss it, but without anything in the track list, I cannot play the tracks I might wish to hear by pointing at them, even if they have little useful information except for the track number and the duration. Right now I just get a blank box, so no selection by point-and-click is possible.

Good work so far, and thanks.

With kind regards,
vovchik

Posted: Fri 01 May 2009, 20:58
by zigbert
Uploaded 0.2 once again.
It is now using /dev/cdrom. It failed for me without device setting

vovchik

It should show a complete list (track 1, 2, 3 ... ) even if no cddb is used. Please post the terminal output.


Sigmund

Posted: Fri 01 May 2009, 21:15
by vovchik
Dear Sigmund,

The /dev/cdrom thing works for me. Nothing in the track list, however. This is the terminal output:

Code: Select all

root$ [/usr/local/pcd]-> ./pcd
./pcd: line 34: [: 0: unary operator expected
EXIT="Ready"
Type: ROM, Vendor 'HL-DT-ST' Model 'DVDRAM GSA-4081B' Revision 'A104' MMC+CDDA
569344 bytes buffer memory requested, transfer size 131072 bytes, 4 buffers, 55 sectors
#Cdda2wav version 2.01.01a23_linux_2.6.18.6_i686_athlon-4, real time sched., soundcard, libparanoia support
AUDIOtrack pre-emphasis  copy-permitted tracktype channels
      1-11           no              no     audio    2
Table of Contents: total tracks:11, (total time 74:26.56)
  1.( 4:03.68),  2.( 6:57.50),  3.( 4:04.20),  4.( 3:29.74),  5.( 5:47.25),
  6.( 6:36.57),  7.( 4:28.33),  8.( 7:13.63),  9.( 3:59.00), 10.( 3:29.27),
 11.(24:16.14)

Table of Contents: starting sectors
  1.(       0),  2.(   18293),  3.(   49618),  4.(   67938),  5.(   83687),
  6.(  109737),  7.(  139494),  8.(  159627),  9.(  192165), 10.(  210090),
 11.(  225792), lead-out(  335006)
CDINDEX discid: 8xAlfdQoKog_BFZX_RJFQ.M8zCw-
CDDB discid: 0x8011720b
CD-Text: not detected
CD-Extra: not detected
samplefile size will be 43025180 bytes.
recording 243.9066 seconds stereo with 16 bits @ 44100.0 Hz ->'-'...
percent_done:
  0%Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
  4%CDDA=""
CDDA_ALL=""
EJECT=""
READ_DISC=""
EXIT="cancel"
With kind regards,
vovchik

Posted: Sat 02 May 2009, 00:45
by alex12
Will we see this in Puppy soon (once the bugs are out)?

Posted: Sat 02 May 2009, 05:11
by ecomoney
Thats up to the council to decide, perhaps it is a bit late for 4.2.1 though. I hope when its tested it will, so K.I.S.S.!

Doe's it require the cd/dvd wizard to be ran first?

Posted: Sat 02 May 2009, 05:40
by zigbert
All reports has been negative and from Puppy 3. Has anyone had trouble with this player in Puppy 4 ?

vovchik
It looks like something is different with bash in Puppy 3. Your output points to line 34 which contains:

while [ $NR != $TOTAL_NR ]; do

It seems to be wrong syntax in your system ???


Sigmund

Posted: Sat 02 May 2009, 06:11
by trio
Sigmund

In 4.2 newer comp, more than 1 g celeron...very long reading disc until it plays...from terminal I see 0% ...1% ...2%...3%..etc

Posted: Sat 02 May 2009, 07:03
by vovchik
Dear Sigmund,

I kept looking at line 34 of pcd last night and saw nothing wrong with it, so I don't understand. My bash is GNU bash, version 3.2.29(2)-release (i486-slackware-linux-gnu), which is pretty standard, and you have a perfectly normal "while" construction and test. I am scratching my head....

With kind regards,
vovchik

Posted: Sat 02 May 2009, 08:53
by vovchik
Dear Sigmund,

My problem hs been solved - and everything works. I recompiled libcddb from Slackware sources and everything is now OK, including my bash. It turns out that my version of libcddb was bad, failed to recognize /dev/cdrom generated a null string when executed, which then caused your logic test to fail. Nothing wrong from your side. Mea culpa!

With kind regards,
vovchik

Posted: Sat 02 May 2009, 09:05
by zigbert
Glad to hear !!!

Posted: Sat 02 May 2009, 12:05
by trio
:( :cry:

Posted: Sun 03 May 2009, 09:00
by zigbert
Dearest little Trio
Why this crying sadness ?

Posted: Sun 03 May 2009, 09:23
by Sylvander
1. "Has anyone had trouble with this player in Puppy 4 ?"
I'm running it from BoxPup 4.1.3 installed to an ext2 Linux partition on my internal HDD.
It displays all tracks on a commercial audio CD, but will only play the 1st track.
It does this if I have the program running with no disk in the drawer ["No CD found"], and then if I put a disk in and close the drawer, the 1st window still shows no disk found, but a 2nd window opens showing the 1st track info and it plays.
If I then stop that playing, and close that 2nd window, the 1st window still doesn't display any tracks.
So I click "Read disk" and the tracks are displayed.
Then I can highlight any of the listed tracks OK, but when the play button is clicked, all that happens is a dotted square appears inside the edge of the button, but the track doesn't play.

2. I really like the simplicity of this player, so I'd like to get it to work. :D