On 06/09/19 19:09, Scott wrote:
Let me state the goal up front. I have a room with
several speakers
installed. It's not a traditional home theater setup; there's a
subwoofer, and then 8 speakers. 8.1, if you will. It's not used for
movies or other commercially recorded multitrack audio.
There's also 2 computers involved; one is an older raspberry pi running
the usual raspian, the other is a previous generation Intel NUC running
recent Linux Mint.
My goal is to be able to drive each channel independently, from my own
software. I'm not trying to play movies through this setup; this is
strictly a non-commercial attempt to play special effects (thunder,
wind, forest noises) on demand, by starting and stopping .wav files as
needed.
If the NUC were able to handle 8 channels, you could get for under ~ 150
$/€ an usb card with 8(+) channel putput. For your use case (playback
only) the ESI Gigaport ones come to mind and they reportedly work on Linux.
There are also much (much) cheaper usb deivices marketed as 7.1 which
essentially have 3 stereo outputs + sub (front L/R, Mid L/R, Rear L/R,
Sub)... Maybe you could adapt your set-up to a 6 speaker one (depending
on room etc.), but then I'm not sure about the output quality.
Then there are other affordable 8 output usb interfaces which have the
advantage of being potentially re-usable (or re-sellable), once your
project is over.
My two cents.
Lorenzo.
What I have today is that the raspberry pi determines what needs to be
played and when, and since it doesn't handle 9 channels of audio by
itself, it sends network messages to the NUC to cue it to play some of
the sounds. The pi has 4 channels of output, gotten by plugging in 2
cheap Pluggable USB external USB->stereo devices. Two channels go into
the sub; the other two drive a pair of speakers. The NUC has 3 of the
same cheap USB audio devices, giving six channels for the other
speakers. In both cases the software is spawning (and killing) aplay and
using -D to pick the stereo device to use. All that actually works fine;
happily, the latency of sending messages and spawning aplay isn't a problem.
In some cases the pi will decide it needs to play different audio clips
to the same speaker simultaneously; I need ALSA's ability to mix inputs
to a single output to keep working. (Currently my software limits things
to 3 sounds at a time on any given channel.)
It's important to me that when I play a sound intended to come out of
the front left speaker, /it actually go to that speaker/.
You can probably guess my problem: on any reboot, the cheap USB devices,
which don't have serial numbers, get randomly assigned to ALSA devices.
On the pi, in ALSA, sysdefault:CARD=Device and sysdefault:CARD=Device_1
both show up, but it's random which speakers they drive. Ditto for the 3
devices on the NUC. Result: when the pi decides to generate a flash of
lightning in the lights on the left, the thunder comes out of the front.
Or bird sounds end up in the subwoofer.
Basically I'm doing it wrong. How do I do it right?
Note that my recorded sources are generally all stereo .wav files; when
I want sound to come out of just one speaker, I mix that sound file to
put everything into one channel. That's maybe not ideal, but I'm
comfortable messing with the audio files and used to thinking of the
outputs as 5 groups of 2 channels each. But I'm not wedded to that and
would be ok with controlling channels independently.
I am fine with using either or both computers to produce sounds.
Experience says that the pi doesn't handle more than two USB devices
without running out of bandwidth, which is why it's currently 2 devices
on the pi and 3 on the NUC. But that's changeable.
I keep looking at the HDMI outputs on both these devices and wondering
if that's not a total of 16 channels of audio that won't move around,
that I could be using. Maybe I could dump USB entirely. But I keep
reading articles online that suggest that using HDMI audio on Linux just
doesn't work well?
I'm trying to keep costs down. I already have the 5 USB audio devices
and they work, so if I could get them to stop moving randomly I could
call it done. If I have to buy different USB audio devices, or HDMI
audio extractors, I want to spend $$, maybe 1$$ and definitely not $$$$.
I'm willing to move the audio duties between the two computers (if the
NUC can drive all 10 channels, 8 from HDMI and 2 from a single USB
device, that works.) Rewriting my software isn't a problem, but the time
and expense of buying hardware, trying it, realizing it won't work,
having to send it back/take a loss, lather rinse repeat, is exactly what
I need to avoid.
I did experiment with an HDMI audio extractor once, a few years ago.
When I got it to work at all I discovered that it would somehow go to
sleep during periods of silence, and then when audio signal was
presented, it had a "wake up" period of over a half second, during which
the audio was dropped. That ruined a number of effects.
I've experimented with using the headphone output on the pi. The audio
quality was too low. I don't need the highest of audio fidelity for
this, but the sub gets driven as low as 8Hz and the upper end is around
18Khz, and when I play crickets I want it to sound like there are
crickets in the room. The pi's headphone output wasn't convincing.
Basically: what do I need to buy that's known to Just Work Every Time?
And will keep working for years?
Level of expertise: application programming on linux, not a problem.
Configuring ALSA is scary and I'd need step by step instructions. Once
we get into modprobe and custom drivers I'm acutely nervous. These
computers do other important things and I don't want them bricked.
Solid suggestions welcome, please nothing of the "well you could try..."
variety. I'm sure someone on this list has been here and done this. What
did you use? TIA.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user(a)lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-user