Re: implementing loudspeaker crossovers using Sox + LADSPA plugins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not sure I read this thoroughly enough to have it right, but...

I think the biggest inevitable problem here is synchronization: If you're trying to make two processes send
sound to devices in real time at the same time, you will generally not be able to be sure they are in perfect
sync, resulting in echo effects, inaccurate sense of audio location of sounds in the room, etc. Even if you
could get SoX to send sound two ways simultaneously from a single process, there's no guarantee that the two
devices being sent to would be in perfect sync either.

I'm inferring from the subject of this thread, which refers to speaker crossover implementation, that the goal
is real-time simultaneous output on two devices from a single input stream.

On Wed, Jun 22, 2016 at 09:12:45PM +0200, Erich Eckner wrote:
Hi Frank,

i think, sox can't duplicate audio without "buffering" in a file.
However, (in linux) there are other commands, which can copy the data,
e.g. "tee".
I think fiddling around with named pipes and tee, you should be able to
do the trick:

mkfifo sound
mkfifo sound_copy
sox -M "|sox sound -p remix 1 $left_channel_effects" "|sox sound_copy -p
remix 2 $right_channel_effects" $output $effects_to_both

and then in a separate terminal/thread:

sox $stereo_input -p | tee sound > sound_copy

Hmm, I just tried it and it doesn't work, also

sox $stereo_input -p | tee sound sound_copy > /dev/null

as second command doesn't work. Probably some buffering issue (feeding
the pipes from two separate sox commands works)?
Maybe someone else knows how to make this idea work?

Cheers,
Erich

On 22.06.2016 19:19, francolargo wrote:
> Greetings Eric,
> 
> I'm part of a small group that is interested in DSP using ARMhf boards like
> RPi and BBB.  Sox has been a great tool for simpler tasks, but now I would
> like to try the objective of the original poster, Charlie.  I'm using SoX to
> process a stream from a 2-channel ALSA 'recording' source and send filtered
> output to a different 2-channel ALSA plug.  ...it works great like this: 
> 
> sox --buffer 1024 -r 48000 -c 2 -t alsa hw:1,0 -t alsa plug:filter1 gain -h
> fir /usr/filter/fir2peak48mild.txt
> 
> This also works with LADSPA filters like this:
> 
> sox --buffer 1024 -r 48000 -c 2 -t alsa hw:1,0 -t alsa plug:filter1 ladspa
> ACDf 21 1 0 240 0.707 0 0 ladspa ACDf 21 1 0 240 0.707 0 0
> 
> However, I'm stuck when I try to split clone the streaming source using the
> syntax in your message:
> Eric Wong wrote
>> 	sox -M \
>> 	    "|sox i.wav -p remix 1v1 highpass $XO highpass $XO $HI_FX1" \
>> 	    "|sox i.wav -p remix 1v1 lowpass $XO lowpass $XO $LO_FX1" \
>> 	    "|sox i.wav -p remix 2v1 highpass $XO highpass $XO $HI_FX2" \
>> 	    "|sox i.wav -p remix 2v1 lowpass $XO lowpass $XO $LO_FX2" \
>> 	    output.wav \
>> 	    remix -m 1,2 3,4
> 
> Inserted into the above, this:
> ???|sox -t alsa hw:1,0 -p remix 1v1 ladspa ACDf 21 1 0 240 0.707 0 0 ladspa
> ACDf 21 1 0 240 0.707 0 0???  \
> 
> produces three of these alerts:
> "sox FAIL formats: can't open input  `hw:1,0': snd_pcm_open error: Device or
> resource busy"
> 
> Other attempts to specify and clone the inputs all failed as well:
> "sox FAIL sox: Not enough input filenames specified"
> 
> If you have any advice on getting SoX to clone an ALSA streaming source
> (e.g., a stereo signal from 'hw:1,0') for input into multiple effect chains,
> it would be much appreciated.  As well, any additional advice in correctly
> defining each sub-stream for ALSA output would undoubtedly help.  Output
> could go via hardware (hw:0,0), or via user space into an ALSA plug.  Either
> way, SoX offers advantages in the ability to combine a multitude of useful
> effects.  [Think: a digital-level "miniDSP" using a RPi...]  We just need to
> better understand channel creation and management for continuous streaming.
> 
> Many thanks in advance!
> 
> Frank


-- 
Doug Lee                 dgl@xxxxxxxx                http://www.dlee.org
SSB BART Group           doug.lee@xxxxxxxxxxxxxxxx   http://www.ssbbartgroup.com
No one alive is beyond hope; every second of life is a chance.
(08/29/02)

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux