Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jul 2005 19:57:16 +0800
From:      Ariff Abdullah <skywizard@MyBSD.org.my>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        freebsd-multimedia@freebsd.org, mat@cnd.mcgill.ca
Subject:   Re: Massive sound changes / fix (24/32bit pcm support, new sampling rate converter, various fixes)
Message-ID:  <20050707195716.780c01a9.skywizard@MyBSD.org.my>
In-Reply-To: <20050707120503.5878d347@Magellan.Leidinger.net>
References:  <20050707064603.6c295451.skywizard@MyBSD.org.my> <20050707120503.5878d347@Magellan.Leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 7 Jul 2005 12:05:03 +0200
Alexander Leidinger <Alexander@Leidinger.net> wrote:
> On Thu, 7 Jul 2005 06:46:03 +0800
> Ariff Abdullah <skywizard@MyBSD.org.my> wrote:
> 
> > System wide changes
> > ===================
> > 
> > 1. sys/soundcard.h
> >    * Add definition for AFMT_(U|S)24_(B|L)E. This is somehow
> >      contradict with OSS/Voxware definition of 24bit, but
> >      anyway...
> 
> Can you explain this a little bit more please? Being incompatible
> isn't good (I haven't looked at the files, so I may understand
> something wrong).
>

OSS define AFMT_x32_xE as:
	1) 32bit data, packed within 32bit (4bytes) boundary.
	2) 24bit data, packed within 32bit (4bytes) boundary where the data
	   is stored in the 24 most significant bits and least significant 8
	   bits are not used and should be set to 0.

While this might hold true in few cases, lots of application (notably
mplayer, sweep) really deal / produce 24bit as what they should meant
to be: 24bit data / 3bytes per sample. In this case, I have decided to
handle 24bit pcm separately so the in-kernel conversion space did not
confuse itself with 32bit variant.

Here is a hint for you: After applying the patch and replacing
/usr/include/sys/soundcard.h with the patched version
(/usr/src/sys/sys/soundcard.h), recompile mplayer, and use it to
*abuse* this new format. Something like:

	mplayer -af resample=128000:0:0,format=u24be somefile..

This will let mplayer doing the conversion + resample from any ->
128khz/u24be and directly play it to /dev/dsp. Notice that the
in-kernel conversion *really* doing it job properly. Also note that,
mplayer 24bit seeking/pausing is buggy, they should do it within 24bit
boundary anyway.

I can't think of any other applications that really can play 24/32
bit pcm files *directly*, except mplayer. Most applications tend to do
conversion from 24bit to sign/float 32 for processing, notably
audacity, and to sign 16 le for playing.

Don't worry about incompatibilities. It doesn't break anything. You
don't have to recompile anything (except mplayer, and that is because
to enable the long-awaited disabled feature).


--

Ariff Abdullah
MyBSD

http://www.MyBSD.org.my (IPv6/IPv4)
http://staff.MyBSD.org.my (IPv6/IPv4)
http://tomoyo.MyBSD.org.my (IPv6/IPv4)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050707195716.780c01a9.skywizard>