[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] two soundcards



Hello, Peter!

Thank you for your help and thoughts regarding soundcard support. As I said on the list - the project has been delayed and there is no more preassure for me to solve the case in near future.

But I want to continue thinking about quadrophonic sound and / or surround sound. Maybe I need to sort out some terminology.

For me a channel is a mono wire or a mono speaker. For stereo I'd have two channels (Left and Right), for Surround 5.1 I'd have 6 channels. As shown in http://en.wikipedia.org/wiki/Surround (2006-04-21).

I think SDL treats a 'channel' as a thing that you can pan; a sound is being played on one channel and it is sent to a left or right speaker, probably both of them at once, but with different volumes on each speaker to position the sound. A sound source may be stereo, though. If it is then panning would affect the percentage of volume each of the two speakers will emmit.

Maybe it would be a good approach to keep that way of treating 'channels' in SDL - if one would extend it to quadrophonic playback I'd do the same trick as from mono to stereo: mono is being sent to L/R according to panning settings. I'd send Stereo to FL/FR/BL/BR (Front Left...) in the same way. Some car HiFis have it like that you can 'pan' the sound back or to front by turning a knob resistor. I am curious how SDL will implement 5.1.

-

When I first thought of using pygame to play quadrophonic sounds I thought that I could probably just have two mixer objects, one for each sound card. But that approach is not likely to be taken in SDL currently.
http://www.libsdl.org/faq.php?action=listentries&category=9#10
And there are cards that have 6 channels on one card. The same approach is taken for Video drivers. No I think that the problem of having > 1 sound card and the problem of having > 1 video card are quite similar - and SDL will not really want to support that cases by itself, but rather use ALSA etc to circumvent interference with layers too burried too far in the hardware wirings.


Is there any mechanism in SDL that would allow to bind a single speaker (something that allows to grab speaker 1, speaker 2, speaker 3... and then assign sounds to them)? That would do the trick imho.

Regards
Gogo.



Peter Shinners wrote:
On Thu, 2006-04-20 at 20:04 +0200, Georg Bernhard wrote:
we want to play sounds on 4 channels, 'positioning' a sound in a room. It is an art project in vienna, austria, we consider an installation with quadrophonic sound. we have samples of sounds, as wav or mp3. our system would pick one of the sounds (randomly) and pan it around in the room by changing the volume of each channel.

Pygame isn't quite ready for this, I think the OpenAL suggestion would be a better lead.

If you are set on using Pygame, it will require a bit of work. I'd use
ALSA to link the two sound cards into a single sound device. SDL
recently added support for 4-channel audio, but it will require a small
tweak to the Pygame api to pass in the right values. From there, I'm not
sure how the panning would work. SDL_mixer includes a stereo panning
filter, but I don't think it handles more that 2 channels?