Adding spatializer to Phonon?

tim tej at melbpc.org.au
Mon Feb 21 21:27:25 CET 2011


Hi,

I"m interested in adding a 'spatializer' to music playing programs like
Amarok. Spacializers are designed to overcome the problems with
listening to music and watching movies through headphones. Without
special processing the music sounds unnatural, like it is 'in your head'
and the stereo separation is too extreme - everything seems to come from
one side, the middle, or the other, rather than from various points
across or around the 'sound stage'.

Spatializers attempt to fix this by simulating the sounds your ears
would get listening to 2 or more speakers in a real room. This involves
simulating the sound coming into the left ear from the right speaker,
etc. The processing involves delays, attenuation which varies by
frequency, resonances within the room, and phase effects. It can be
quite CPU intensive. Some of the commercial products use GPUs to offload
the processing from the CPU.

In the sonic ecosystem the spatializers occupy a similar position to,
say graphic equalizers, in that they take the signal, enhance it, and
pass it on to the next processor in the chain, and eventually it gets
played.

Programs like bs2b (http://bs2b.sourceforge.net/), Dolby Headphone
(http://www.timefordvd.com/tutorial/pf/DolbyHeadphone.shtml), and Smyth
Realizer (http://www.smyth-research.com/technology.html), and the VLC
spatializer
(http://www.online-tech-tips.com/software-reviews/vlc-09-media-player-review/) deal with this issue and provide a more enjoyable listening experience. Audacious music player supports the bs2b plugin via LADSPA support.

Programs like sox (using earwax) and Audacity support various
spatializers as part of their processing of music files.

Now Amarok is my favourite player but it doesn't really have a plugin
architecture, which makes it messy to adding something like bs2b. They
suggested that maybe such a feature would best be added to Phonon where
it could be shared by all players.

My questions are

- Would you agree with this? Would Phonon be the right place to add a
spatializer? If not, what is a better place?

- If so is there any documentation on how to do this, or sample
implementations eg an implementation of an equalizer within Phonon?

- If this is the wrong place to ask, what would the right place to ask
be?

Thanks,
Tim Josling

On Mon, 2011-02-21 at 17:59 +0100, phonon-backends-request at kde.org
wrote:
> Send Phonon-backends mailing list submissions to
> 	phonon-backends at kde.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://mail.kde.org/mailman/listinfo/phonon-backends
> or, via email, send a message with subject or body 'help' to
> 	phonon-backends-request at kde.org
> 
> You can reach the person managing the list at
> 	phonon-backends-owner at kde.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Phonon-backends digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Review Request: Fix return value in StreamReader::read
>       (Harald Sitter)
>    2. Re: Review Request: Phonon KDED module: Improve finding
>       virtual	devices from ALSA (Harald Sitter)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 21 Feb 2011 16:46:38 -0000
> From: "Harald Sitter" <sitter at kde.org>
> Subject: Re: Review Request: Fix return value in StreamReader::read
> To: "Harald Sitter" <sitter at kde.org>,	"Phonon Backends"
> 	<phonon-backends at kde.org>,	"Phonon" <kde-multimedia at kde.org>, "Kamil
> 	Klimek" <naresh at tlen.pl>
> Message-ID: <20110221164638.22906.3718 at vidsolbach.de>
> Content-Type: text/plain; charset="utf-8"
> 
> 
> 
> > On Feb. 21, 2011, 4:31 p.m., Harald Sitter wrote:
> > > Splendid, I only fixed this in the GStreamer backend when I was fighting with the streamer impl. Indeed we must not indicate an error when 0 bytes were received as this is a perfectly valid scenario (e.g. when the abstractstreamer is waiting for data to arrive, like in the case of a QIODevice's read function).
> 
> http://commits.kde.org/phonon-vlc/b2f9011f096bda05026fe9df4d5c552359132a07
> Please close this request.
> Thank you :)
> 
> 
> - Harald
> 
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100701/#review1559
> -----------------------------------------------------------
> 
> 
> On Feb. 21, 2011, 12:26 p.m., Kamil Klimek wrote:
> > 
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://git.reviewboard.kde.org/r/100701/
> > -----------------------------------------------------------
> > 
> > (Updated Feb. 21, 2011, 12:26 p.m.)
> > 
> > 
> > Review request for Phonon and Phonon Backends.
> > 
> > 
> > Summary
> > -------
> > 
> > length parameter was treated as required size to read. It caused for files with id3v1 tags to end playback at begining of the file, because ret value was treated by libvlc as error. Reading id3v1 tags caused to seek almost to end of file and read not as much data as was put in length parameter. After returning length > 0 (we read at least something) everything started to work fine.
> > 
> > 
> > Diffs
> > -----
> > 
> >   vlc/streamreader.cpp 89045da 
> > 
> > Diff: http://git.reviewboard.kde.org/r/100701/diff
> > 
> > 
> > Testing
> > -------
> > 
> > 
> > Thanks,
> > 
> > Kamil
> > 
> >
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.kde.org/pipermail/phonon-backends/attachments/20110221/24f19be3/attachment-0001.htm 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 21 Feb 2011 16:58:47 -0000
> From: "Harald Sitter" <sitter at kde.org>
> Subject: Re: Review Request: Phonon KDED module: Improve finding
> 	virtual	devices from ALSA
> To: "Harald Sitter" <sitter at kde.org>,	"Trever Fischer"
> 	<tdfischer at fedoraproject.org>
> Cc: KDE Runtime <kde-core-devel at kde.org>, Phonon
> 	<kde-multimedia at kde.org>,	Phonon Backends <phonon-backends at kde.org>
> Message-ID: <20110221165847.23232.7074 at vidsolbach.de>
> Content-Type: text/plain; charset="utf-8"
> 
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100700/#review1562
> -----------------------------------------------------------
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1342>
> 
>     Is this ever coming back? If not, please remove it completely, if it is please add a comment and ultimately a TODO or FIXME.
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1343>
> 
>     Style: left curly brace goes on the same line as the start of the statement
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1347>
> 
>     "Fix *the*" maybe?
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1344>
> 
>     Style: left curly brace goes on the same line as the start of the statement
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1345>
> 
>     Style: left curly brace goes on the same line as the start of the statement
> 
> 
> 
> phonon/kded-module/phononserver.cpp
> <http://git.reviewboard.kde.org/r/100700/#comment1346>
> 
>     The rationale of this is not really convincing, if only the VLC backend has problems, then the VLC backend should change the name accordingly.
>     Also R?mi Denis-Courmont indicated on the phonon-backends list that it should use plughw anyway.
>     
>     Please reevaluate and if possible at all move this logic to the phonon-vlc backend.
> 
> 
> - Harald
> 
> 
> On Feb. 21, 2011, 11:23 a.m., Casian Andrei wrote:
> > 
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://git.reviewboard.kde.org/r/100700/
> > -----------------------------------------------------------
> > 
> > (Updated Feb. 21, 2011, 11:23 a.m.)
> > 
> > 
> > Review request for KDE Runtime, Phonon, Phonon Backends, Harald Sitter, and Trever Fischer.
> > 
> > 
> > Summary
> > -------
> > 
> > Modifications on findVirtualDevices in PhononServer, to make it find usable capture devices for Phonon-VLC, at least. Phonon audio capture works with the provided devices. Also made a couple of mostly irelevant improvements.
> > 
> > The Phonon KDED module was not providing any usable capture devices. Only some iec958 digital devices showed up, which didn't work at all. VLC needs a default analog ALSA device, like hw:CARD=SB, in my case.
> > 
> > Solid is not returning any audio devices on my system. I do not know if it works properly on other systems, but I will investigate further.
> > 
> > This is the commit message:
> > 
> > Phonon KDED module: Improve finding virtual devices from ALSA
> >     
> >     PhononServer was not finding any usable capture devices. It
> >     was skipping almost all useful devices. Commented out the
> >     block for skipping those.
> >     
> >     Prevent devices with empty names when their description
> >     is empty. This should not happen, but it's just in case.
> >     
> >     Eliminate any front, center, rear, surround virtual devices from
> >     capture device candidates.
> >     
> >     Additionaly, there will be only one device with an unique id, with
> >     one or more access descriptors.
> >     
> >     Replace default: with hw: for capture devices, to enable capture
> >     working with Phonon-VLC.
> > 
> > Because Solid doesn't give me any audio devices, I cannot test for the cases when it actually works. However, I believe that it doesn't work on most systems.
> > 
> > The other iec958 digital stuff devices show up as advanced.
> > 
> > 
> > Diffs
> > -----
> > 
> >   phonon/kded-module/phononserver.cpp 44f857e 
> > 
> > Diff: http://git.reviewboard.kde.org/r/100700/diff
> > 
> > 
> > Testing
> > -------
> > 
> > Restarted KDED and ran kcmshell4 phonon, viewed the audio devices. All looks ok. No bogus devices.
> > 
> > Tested the capture demos from Phonon (currently they have a buggy interface, will be fixed), and they worked fine. Audio capture works ok with the Phonon-VLC backend. Audio-video capture also works if you get around the demo's interface bugs. 
> > 
> > Don't know what happens when Solid actually works for audio devices, if these changes interfere with Phonon's functionality in that case.
> > Not tested on other systems to see if any bogus devices appear out of nowhere.
> > 
> > Amarok still works :P
> > 
> > 
> > Screenshots
> > -----------
> > 
> > Capture devices in Phonon config
> >   http://git.reviewboard.kde.org/r/100700/s/79/
> > 
> > 
> > Thanks,
> > 
> > Casian
> > 
> >
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.kde.org/pipermail/phonon-backends/attachments/20110221/80877b8e/attachment.htm 
> 
> ------------------------------
> 
> _______________________________________________
> Phonon-backends mailing list
> Phonon-backends at kde.org
> https://mail.kde.org/mailman/listinfo/phonon-backends
> 
> 
> End of Phonon-backends Digest, Vol 43, Issue 6
> **********************************************




More information about the Phonon-backends mailing list