linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-07  9:03 Iain Sandoe
  2000-08-07 19:18 ` Henry Worth
  0 siblings, 1 reply; 23+ messages in thread
From: Iain Sandoe @ 2000-08-07  9:03 UTC (permalink / raw)
  To: Henry Worth, Takashi Oe; +Cc: linuxppc-dev, matthias pfisterer


On  Mon, Aug 7, 2000,  Henry Worth  wrote:
> Takashi Oe wrote:
>>
>> On Sun, 6 Aug 2000, Henry Worth wrote:
>>
>> [...]
>> > This won't help in the esd case, it always sets the device to
>> > AFMT_S16_BE for 16 bit data on big endian systems (also doesn't deal
>> > with
>> > unsigned 16 bit data streams). Whereas the XMMS esd output plugin always
>> > passes the data through unchanged (little endian in the case of .wav).
>>
>> Does xmms' esd output plugin work with 16bit .wav at all on x86?  Since
>> sox works just fine with 16bit .wav, and it doesn't do any byte swapping
>> either as far as I know (which is not much admittedly), I'm very much
>> inclined to think xmms+esd is plain broken with respect to 16bit wav.
>>
>> Takashi Oe
>
> The esd daemon sets the output to native endiness, so on an x86
> everyone is little endian and all should be well, but I haven't
> tried it.

so long as the last thing in the chain (i.e. the one that talks to /dev/dsp)
is prepared to:

*either* re-set the AFMT of /dev/dsp
       (depending on the format of the stream presented to it)
*or* leave /dev/dsp AFMT at one setting
       AND do the necessary conversions

everything will be OK.

Of course, there are other solutions - but these would depend on each app
"knowing" that the server only accepts input in format "XXX" which seems
broken to me... (although it has a certain simplicity - if there's a way of
telling the client apps that this is the case).

Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-08 22:19 Henry Worth
  0 siblings, 0 replies; 23+ messages in thread
From: Henry Worth @ 2000-08-08 22:19 UTC (permalink / raw)
  To: linuxppc-dev


Well, my Pismo which was increasingly unstable this weekend
is now refusing to boot even from the MacOS CD's. So I probably
won't be able to work on this for at least a few days. I'm
hoping it will boot after having the battery out a few hours
(it worked a couple times this weekend) and that
reinitalizing the firmware and MacOS partitions will help,
if that or a full disk initialization doesn't help it will
probably be off to the shop.

But, just before it powered itself off last night, I found
the likely cause of the abends from the xmms_CdRead plugin.
It's actually in the xmms package code in ~/xmms/input.c. I
don't have the sources available, but can describe the
problem for anyone who's interested in trying to fix it.

There is a routine near the top of the file that uses GTK
byte swapping macros to perform the LE to NE conversion.
The problem is the classic macro mistake of passing
complex expressions with side effects as macro parms. In
this case it's of the form something like (this is from
memory):

  left[i] = GINT16_FROM_LE( (*ptr++) );
  right[i] = GINT16_FROM_LE( (*ptr++) );

The macro expands to use the argument several times
(see the *SWAP* macros in glib.h), so the pointer is
incremented too many times causing a seg fault. The
non-optimized case just happened to have enough readable
memory following the buffer to not fault (and optimizations
on the loop probably had impacts as well), similarly the
.wav player plugin uses a different buffering scheme that
just accidentally avoids faults (likewise the x86 was probably
lucky due to different run-time conditions, provided the
MACRO doesn't simply end up a NOP).

The fix is to find all such occurences and do the incrementing
outside the macro call. I think I've seen similar code in other
parts of the package, so a general inspection is in order. This
should also fix the visualization displays and make the xmms_CdRead
plugin usable for the analog CD challenged Macs.

Good Luck,
Henry


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-07 19:35 Iain Sandoe
  2000-08-07 21:49 ` Henry Worth
  0 siblings, 1 reply; 23+ messages in thread
From: Iain Sandoe @ 2000-08-07 19:35 UTC (permalink / raw)
  To: Henry Worth; +Cc: Takashi Oe, linuxppc-dev, matthias pfisterer


n  Mon, Aug 7, 2000, Henry Worth  wrote:
> On Mon, 7 Aug 2000, Iain Sandoe wrote:
>
>> On  Mon, Aug 7, 2000,  Henry Worth  wrote:
>> >
>> > The esd daemon sets the output to native endiness, so on an x86
>> > everyone is little endian and all should be well, but I haven't
>> > tried it.
>>
>> so long as the last thing in the chain (i.e. the one that talks to /dev/dsp)
>> is prepared to:
>>
>> *either* re-set the AFMT of /dev/dsp
>>        (depending on the format of the stream presented to it)
>> *or* leave /dev/dsp AFMT at one setting
>>        AND do the necessary conversions
>>
>> everything will be OK.
>
> In the case of the esd daemon it does the ioctls to set the format
> to signed native endiness, and they even do some error checking.

OK. so the facilities of the driver are irrelevant when using esd.

You must make sure that everything you present to esd is native-endian and
signed :-)

which is what I meant by other solutions .... below...

>
>> Of course, there are other solutions - but these would depend on each app
>> "knowing" that the server only accepts input in format "XXX" which seems
>> broken to me... (although it has a certain simplicity - if there's a way of
>> telling the client apps that this is the case).
>
> It looks like esd is going for simplicity. Since they are mixing
> digital sound streams to integrate sound sources on the desktop,
> they ultimately need to get all the incoming data streams into native
> endiness to do the mixing.

Well, I suppose, (being picky :-) it doesn't have to be the native-endian -
just the *same* for all the items to be mixed...

>I assume they just chose to put the
> burden on the clients (I'll be charitable and not assume LE blindness
> and that the setting to native endiness was a quick hack when the
> endiness issue was brought to their attention). They would also
> need common sample rates, but I haven't looked into how much the
> daemon will do to up/down-convert, but expect that is limited as
> well.

In the case of a mixing deamon like this it is OK, (as I was driving at
above) - *providing* that the clients have some way of "knowing" the
requirement on their outputs.

You've specified it - "all input to esd must be native-endian".

So you must supply the conversion prior to sending it to esd.

> I'll put together a patch for the XMMS esd plugin, but I
> need to look into portability issues for the endiness test and
> optimal byte swapping, any suggestions?  It could also
> use an unsigned->signed conversion.

I'm not sure you can "fix" this - it seems to be a design decision - which
may make that plug unsuitable for your application - but it is still
notionally 'correct' in terms of its own implementation.

Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-06 21:07 Henry Worth
  0 siblings, 0 replies; 23+ messages in thread
From: Henry Worth @ 2000-08-06 21:07 UTC (permalink / raw)
  To: linuxppc-dev


References: <398A91CA.F8D3C489@student.ethz.ch>

Michel Dänzer wrote:
>
> Henry Worth wrote:
>
> > Rebuilding the kernel to use SCSI generic devices with IDE SCSI
> > emulation produced much better, even usable, results. At startup
> > there are still a couple of dropouts in the first few seconds,
> > but after that the playback is clean across multiple tracks (even
> > with a concurrent kernel compile). Piping cdparanoia to /dev/null
> > shows data rates of 187sectors/sec at all -S settings (and default).
> > From the the drive's spin-up sounds it seems to always be in
> > high-speed mode, but unlike the ATAPI driver, there is little
> > head movement noise.
>
> Does it also improve audio grabbing? With 2.2.15, both IDE and SCSI emulation
> almost killed the system...
>

Haven't seen any instability between the two interfaces
(2.2.17pre15-ben1, though I have had a number of sponstaneous
powerdowns when using the modem this weekend -- the PMU gets testy
when it doesn't get immediate attention, a problem with at least the
recent kernels -- haven't used the modem much with the early
Pismo capable kernels). With cdparanoia's error correction enabled
the SCSI interface is about 30-50% faster ripping tracks (~2-3X). With
the error correction disabled (-Z), both interfaces are the same
speed (~6X) and I get files that compare identically.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-06  9:38 Iain Sandoe
  2000-08-06 13:26 ` Takashi Oe
  2000-08-06 18:36 ` Henry Worth
  0 siblings, 2 replies; 23+ messages in thread
From: Iain Sandoe @ 2000-08-06  9:38 UTC (permalink / raw)
  To: Henry Worth, linuxppc-dev; +Cc: Matthias Pfisterer


Hi Henry,
 Sun, Aug 6, 2000, Henry Worth wrote:
> Iain Sandoe wrote:

>> I've been using the xmms CVS tree (www.xmms.org and follow the links).  It
>> works fine with .wavs of different sample rates etc.  [xmms --version ==
>> 1.2.1].

> Which output plugin do you use?  And was that on a Pismo?

OSS - and no, but on several different machines (I don't yet have a pismo -
my portable is a Lombard).

You, Matthias & Ben are (at the moment) chief pismo sound testers :-)

> Looking at eSound and the XMMS ESD output plugin, they simply can't work
> with little endian formats like .wav on a big endian machine. The esd
> daemon
> uses, and sets the output device to, native endiness (there isn't even a
> parm to indicate endiness of the incoming data buffer). The XMMS ESD
> output plugin completely ignores endiness of the incoming data stream
> and
> passes it through unchanged (versions 0.9.5, 1.2.1, 1.2.2). A quick hack
> to swap bytes in the ESD plugin fixed playback of .wav files. The small
> files that had worked before were all 8-bit mono format.

OK - there's a lot of this in apps that came from x86 - they assume that the
output is LE.

If you use my back-port - I "fixed" (kludged) the default dsp settings to
44.1k, 16 bit , stereo LE -- to be compatible with x86 progs that don't
bother to set things up :-(

> OTOH, the OSS output plugin appears to correctly pass the data stream's
> endiness to the sound device, but a quick hack to swap data bytes also
> fixed its playback problems.

??? this is strange - if it tells the truth (endianess, sample rate, depth &
stereo/mono) - I think it should work...  there's no need to swap bytes at
all with the audio - the hardware can do it...

> I need to dig into the code some more, but
> are we sure the AWACS Screamer in the Pismo isn't one of those variants
> that only supports big-endian data?

This is news to me see below.... (have you any reference for this issue?)

> A quick test forcing the
> AFMT_*_[LB]E
> value to either value for the IOCTL doesn't make a difference.

The awacs, screamer and burgundy chips *all* have an endian-swap capability
AFAICT.  So, providing you tell the driver what you are supplying - it will
work OK:

""If you set dmasound_awacs to the *correct settings for the data you pass
to it* - it works.""

I have tested (yesterday - on a screamer) with:
44.1k LE stereo
22050 LE stereo
11025 A & mu Mono
8000 mu (into /dev/audio as well)

I'll increase the coverage as/when I have time (it was incidental to some
other testing).

What you could send me that would be *very* helpful is:

a dump of any device-tree contents that relate to sound.

I need to be able to try and build different mixer abstractions on the basis
of which machine we have - because this is where most of our difficulty
lies.

========

There is a residual "gottcha".

If you machine *only* supports 44.1k playback (we shall see - from
device-tree sample-rates stuff)... then:

If you try and playback low sample rate stuff, it needs to be "up-converted"
to 44.1k.

The kernel driver can only afford to implement a fairly simple algorithm for
this... and it is, for that reason, fairly 'nasty' in sound.

You would be much better off using some off-line process (which can make use
of FP) to do the up-conversions.

other than that - I can, at the moment (at least with the back-port) see no
reason why the sound output will not work properly.

Getting sound in-out to work is a different matter (I believe you have no CD
connection through the screamer no?)

HTH
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-04 13:05 Iain Sandoe
  0 siblings, 0 replies; 23+ messages in thread
From: Iain Sandoe @ 2000-08-04 13:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Henry Worth, linuxppc-dev


[...]
>>From the the drive's spin-up sounds it seems to always be in
>>high-speed mode, but unlike the ATAPI driver, there is little
>>head movement noise.
>
> I think the problem is more with cdparanoia. I think it's more or less
> synchronous, it doesn't have a thread that collects datas while another
> outputs sounds. I've looked at cdparanoia sources some time ago, and I
> think and intermediate step of buffering is necessary.

>From my IRQ latency measurements I would think that there was *no* chance
without the intermediate step.  On my Lombard, CD access over IDE can mask
IRQs for 2 >>ms<<<  which also means you need to make sure the audio frag
sizes are sensible as well... i.e. don't try 2 frags of 256 bytes - it won't
work as things stand.

Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-04 12:57 Benjamin Herrenschmidt
  0 siblings, 0 replies; 23+ messages in thread
From: Benjamin Herrenschmidt @ 2000-08-04 12:57 UTC (permalink / raw)
  To: Henry Worth, linuxppc-dev


>
>Using the ATAPI CD drivers there are underruns with significant
>dropouts every couple of seconds. Various hdparms and cdparanoia
>parms were tried with no significant change. These include various
>transfers modes and cdparanoia's buffer (-n) and speed (-S)
>parms and various data formats. Piping cdparanoia out to /dev/null
>showed data rates of 46 sectors/sec at -S1, 65sps at -S8, and
>133sps at -S12 and above (also the default and no significant
>changes with different transfer modes and -n values). At the higher
>speeds (>-S11) there is a high-level of continuous head-seek noise,
>suggesting a lot of overruns and reseeks on the CD i/f side.
>
>Rebuilding the kernel to use SCSI generic devices with IDE SCSI
>emulation produced much better, even usable, results. At startup
>there are still a couple of dropouts in the first few seconds,
>but after that the playback is clean across multiple tracks (even
>with a concurrent kernel compile). Piping cdparanoia to /dev/null
>shows data rates of 187sectors/sec at all -S settings (and default).
>From the the drive's spin-up sounds it seems to always be in
>high-speed mode, but unlike the ATAPI driver, there is little
>head movement noise.

I think the problem is more with cdparanoia. I think it's more or less
synchronous, it doesn't have a thread that collects datas while another
outputs sounds. I've looked at cdparanoia sources some time ago, and I
think and intermediate step of buffering is necessary.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: CDDA playback on Pismo (and other newer models)
@ 2000-08-04  9:16 Iain Sandoe
  2000-08-04 20:40 ` Henry Worth
  2000-08-06  8:09 ` Henry Worth
  0 siblings, 2 replies; 23+ messages in thread
From: Iain Sandoe @ 2000-08-04  9:16 UTC (permalink / raw)
  To: Henry Worth, linuxppc-dev


Hi Henry,
 Fri, Aug 4, 2000, Henry Worth wrote:
> Additionally there seems to be some clipping occuring somewhere
> in the A/D or mixer/preamp. It's independent of output
> volume on either the internal speakers or external port, and
> only occurs, consistently, on a few tracks I've tried. But in
> general using .aiff format instead of .wav seems to sound a
> bit better, with perhaps a bit less clipping (haven't tried
> the latest damsound patches).

The latest patches will (probably) not help this... although the output from
them will help me in debugging where we're at - and they do fix on or two
other pismo-related issues.

it is likely (a) either the app not really setting up /dev/dsp properly. or
(b) issues with the mixer abstraction which are still being worked on.

Try opening the oss mixer (e.g. kmixer) and making sure that the monitoring
channel is full *up*.  I know this sounds strange (but at least with CDs)
for me it stops the distortion.

This stuff is being actively worked on... and I will post with patch/URL
if/when the results are more positive.

> I'd like to give XMMS a try, but the XMMS in LPPC2K and updates
> and builds of newer versions all generate white noise on .wav
> files (endiness?). Has anyone been able to get XMMS to work on
> a Pismo? And where can I find the XMMS CDDA playback plugin?

I've been using the xmms CVS tree (www.xmms.org and follow the links).  It
works fine with .wavs of different sample rates etc.  [xmms --version ==
1.2.1].

I don't think the 'standard' CD plugin routes the audio from disk to
/dev/dsp -- it seems to do the same as other media players and start the CD
player but use the local routing of audio on the mixer.  will check some
more on this.

Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* CDDA playback on Pismo (and other newer models)
@ 2000-08-04  5:18 Henry Worth
  2000-08-04  9:50 ` Michel Dänzer
  2000-08-04 15:56 ` Nelson Abramson
  0 siblings, 2 replies; 23+ messages in thread
From: Henry Worth @ 2000-08-04  5:18 UTC (permalink / raw)
  To: linuxppc-dev


As most of you know, the newer Mac models lack analog CD playback
capabilities. So I've been experimenting with using cdparanoia
piped through play for CD playback on my Pismo with
2.2.17pre15-ben1 (btw, very stable so far).

Using the ATAPI CD drivers there are underruns with significant
dropouts every couple of seconds. Various hdparms and cdparanoia
parms were tried with no significant change. These include various
transfers modes and cdparanoia's buffer (-n) and speed (-S)
parms and various data formats. Piping cdparanoia out to /dev/null
showed data rates of 46 sectors/sec at -S1, 65sps at -S8, and
133sps at -S12 and above (also the default and no significant
changes with different transfer modes and -n values). At the higher
speeds (>-S11) there is a high-level of continuous head-seek noise,
suggesting a lot of overruns and reseeks on the CD i/f side.

Rebuilding the kernel to use SCSI generic devices with IDE SCSI
emulation produced much better, even usable, results. At startup
there are still a couple of dropouts in the first few seconds,
but after that the playback is clean across multiple tracks (even
with a concurrent kernel compile). Piping cdparanoia to /dev/null
shows data rates of 187sectors/sec at all -S settings (and default).
>From the the drive's spin-up sounds it seems to always be in
high-speed mode, but unlike the ATAPI driver, there is little
head movement noise.

So, any thoughts as to whether this a lack of sufficent buffering
in the CDDA path of the ATAPI CD driver? Or, more general
performance problems in the ATAPI CD or low-level drivers?

I'll also be looking at cdparanoia (v9.7), it does diffentiate
between ATAPI and SCSI interfaces, so it might not be reading
ATAPI devices in an optimal manner. I'll also be giving cdda2wav
a try now that I have SCSI emulation built in (btw, you don't
need to leave the ATAPI cd driver out of the build, just use
the hd[n]=ide-scsi boot parm to switch).

Additionally there seems to be some clipping occuring somewhere
in the A/D or mixer/preamp. It's independent of output
volume on either the internal speakers or external port, and
only occurs, consistently, on a few tracks I've tried. But in
general using .aiff format instead of .wav seems to sound a
bit better, with perhaps a bit less clipping (haven't tried
the latest damsound patches).

I'd like to give XMMS a try, but the XMMS in LPPC2K and updates
and builds of newer versions all generate white noise on .wav
files (endiness?). Has anyone been able to get XMMS to work on
a Pismo? And where can I find the XMMS CDDA playback plugin?

TIA,
Henry

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2000-08-08 22:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-08-07  9:03 CDDA playback on Pismo (and other newer models) Iain Sandoe
2000-08-07 19:18 ` Henry Worth
2000-08-08  5:02   ` Takashi Oe
2000-08-08  7:01     ` Henry Worth
  -- strict thread matches above, loose matches on Subject: below --
2000-08-08 22:19 Henry Worth
2000-08-07 19:35 Iain Sandoe
2000-08-07 21:49 ` Henry Worth
2000-08-06 21:07 Henry Worth
2000-08-06  9:38 Iain Sandoe
2000-08-06 13:26 ` Takashi Oe
2000-08-06 18:36 ` Henry Worth
2000-08-07  1:25   ` Takashi Oe
2000-08-07  5:02     ` Henry Worth
2000-08-04 13:05 Iain Sandoe
2000-08-04 12:57 Benjamin Herrenschmidt
2000-08-04  9:16 Iain Sandoe
2000-08-04 20:40 ` Henry Worth
2000-08-04 21:03   ` Benjamin Herrenschmidt
2000-08-06  8:09 ` Henry Worth
2000-08-04  5:18 Henry Worth
2000-08-04  9:50 ` Michel Dänzer
2000-08-04 15:56 ` Nelson Abramson
2000-08-04 19:45   ` Henry Worth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).