Re: [ecasound] starting ecasound at boot, in a terminal window

From: Joel Roth <joelz@email-addr-hidden>
Date: Mon Jun 26 2017 - 22:50:05 EEST

john gibby wrote:
> I read that carefully Joel, very interesting. Will follow what you send
> next... :)

Hi John,

Here is a simple script that exits saying "found audio!"
when audio is substantially present at ALSA soundcard channel 1.
It simply spawns a new copy of Ecasound every 2s.

This, or something like it, could drive your configuration
switching.

Have a nice day!

Joel

--
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
while (1){
	my $command = 'ecasound -i alsa,default -ev -t 2 -o null';
	#my $command = 'ecasound -i:select,10,30,/home/jroth/music/tmh.wav -ev -t 2 -o null';
	open my $fh, "-|", $command;
	my $rx = qr/Pos\s+-([123])0dB:[_ ]+(\d+)/;
	my $count = 0;
	my $matches;
	while (<$fh>){
		chomp;
		next unless my($n, $ch1) = /$rx/;
		say STDERR;
		$count += $ch1; 
	}
	#say $count;
	say("found audio!"), exit if $count > 5000;
}
__END__
40k samples for one channel, 2s of mild organ music
13k samples for one channel, 2s of low voice continuuous into mike
__DATA__
Pos  -10dB: __206742 __280703 
Pos  -20dB: _1177971 _1203440 
Pos  -30dB: _1035427 __988797
 
> On Tue, Jun 20, 2017 at 6:00 AM, Joel Roth <joelz@email-addr-hidden> wrote:
> 
> > john gibby wrote:
> > >  I have one chainsetup for watching movies, and a different one for my
> > > Pianoteq piano application (included below).  I would like the piano
> > > crossover to come up automatically when I start the computer, but I want
> > it
> > > to be convenient to change the chainsetup, for when we want to watch a
> > > movie.
> >
> >
> > Hi,
> >
> > First, thanks for this application example, which is to
> > switch between to Ecasound setups, possibly sensing a signal
> > in a priority input channel and switching over to that
> > channel when an audio source is present.
> >
> > I have been looking into how near this application would be
> > possible under Nama, which aspires to be a sort of Bat
> > Utility Belt for audio processing with Ecasound.
> >
> > To start with, I ported John's Ecasound chain setup to Nama
> > commands, omitting the presets and replacing the chorder
> > operators with Nama's routing conventions. That's all
> > I'll cover in this posting.
> >
> > Here's his setup:
> >
> >
> > > -n:crossover_3chan_piano_cs \
> > >           -a:pre1    -pf:./pre1.ecp  -f:f32_le,5,48000 -i:jack -o:loop,1
> > \
> > >           -a:pre2,woofer,center,rear -f:f32_le,5,48000 -i:loop,1 \
> > >           -a:pre2    -pf:./pre2.ecp  -o:loop,2 \
> > >           -a:mid,tweeter             -f:f32_le,5,48000 -i:loop,2 \
> > >           -a:woofer  -pf:./woofer.ecp    -chorder:1,3,0,0,0,0,0,0,0,0 \
> > >           -a:mid     -pf:./mid.ecp       -chorder:0,0,1,2,0,0,0,0,0,0 \
> > >           -a:tweeter -pf:./tweeter.ecp   -chorder:0,0,0,0,1,2,0,0,0,0 \
> > >           -a:center  -pf:./center_nodelay.ecp
> > -chorder:0,0,0,0,0,0,3,0,0,0  \
> > >           -a:rear    -pf:./rear.ecp      -chorder:0,0,0,0,0,0,0,0,4,5 \
> > >           -a:woofer,mid,tweeter,center,rear -f:f32_le,10,48000 -o:jack \
> > >           -a:all -z:mixmode,sum -z:nodb -B:rtlowlatency -b:64
> >
> > Here's the track listing the results after running
> > crossover.nms, my port of the above. You can see most of the
> > routing: e.g. the source and destination of each track.
> >
> >  No. Name       Requested  Status  Source                Destination
> >  Vol   Pan
> > ============================================================
> > ====================
> >   1  Main                  OFF     --                    --
> >  --    --
> >   2  Mixdown               OFF     --                    --
> >  --    --
> >   3  pre1                  MON     1/2/3/4/5             --
> >  --    --
> >   4  pre2                  MON     pre1                  --
> >  --    --
> >   5  woofer                MON     pre1                  1/2
> > --    --
> >   6  center                MON     pre1                  7
> > --    --
> >   7  rear                  MON     pre1                  9/10
> >  --    --
> >   8  mid                   MON     pre2                  3/4
> > --    --
> >   9  tweeter               MON     pre2                  5/6
> > --    --
> >
> > And here is the chain setup, showing additional channel
> > routing. You can also see how Nama uses jack_multi to route
> > soundcard inputs and outputs. The chain IDs below correspond
> > to the track numbers above.
> >
> > # ecasound chainsetup file
> >
> > # general
> >
> > -z:mixmode,sum -G:jack,Nama,send -b 256 -z:db,100000 -z:nointbuf
> > -f:f32_le,10,48000
> >
> > # audio inputs
> >
> > -a:3 -i:jack_multi,system:capture_1,system:capture_2,system:
> > capture_3,system:capture_4,system:capture_5
> > -a:4,5,6,7 -i:loop,pre1_out
> > -a:8,9 -i:loop,pre2_out
> >
> > # post-input processing
> >
> > -a:5 -chmove:3,2
> > -a:6 -chmove:3,1
> > -a:7 -chmove:4,1 -chmove:5,2
> >
> > # audio outputs
> >
> > -a:3 -o:loop,pre1_out
> > -a:4 -o:loop,pre2_out
> > -a:5 -o:jack_multi,system:playback_1,system:playback_2
> > -a:6 -o:jack_multi,system:playback_7
> > -a:7 -o:jack_multi,system:playback_9,system:playback_10
> > -a:8 -o:jack_multi,system:playback_3,system:playback_4
> > -a:9 -o:jack_multi,system:playback_5,system:playback_6
> >
> > Okay, here is the script responsible for the above. Note
> > that tracks can be connected without specifying a loop
> > device.
> >
> > # crossover.nms
> >
> > # create tracks and move them to the Aux bus (avoiding automated routing)
> >
> > add-tracks pre1 pre2 woofer center rear mid tweeter
> > for        pre1 pre2 woofer center rear mid tweeter; move-to-bus Aux
> >
> > select-track pre1
> > set-track width 5
> >
> > for pre2 woofer center rear; source track pre1
> >
> > woofer # equivalent to 'select-track woofer'
> > add-effect chmove 3 2
> > stereo
> > send 1 # send output to soundcard starting at channel 1
> >
> > for mid tweeter; source track pre2
> >
> > mid
> > stereo
> > send 3 # send output to soundcard starting at channel 3
> >
> > tweeter
> > stereo
> > send 5
> >
> > center mono
> > add-effect chmove 3 1
> > send 7
> >
> > rear
> > stereo
> > afx chmove 4 1 # shortcut for 'add-effect'
> > afx chmove 5 2
> > send 9
> >
> > for Aux; remove-fader-effect pan; remove-fader-effect vol
> > Main off; rffx vol; rffx pan # shortcut for 'remove-fader-effect'
> >
> > cheers,
> >
> > --
> > Joel Roth
> >
> >
> >
> > ------------------------------------------------------------
> > ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Ecasound-list mailing list
> > Ecasound-list@email-addr-hidden
> > https://lists.sourceforge.net/lists/listinfo/ecasound-list
> >
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Ecasound-list mailing list
> Ecasound-list@email-addr-hidden
> https://lists.sourceforge.net/lists/listinfo/ecasound-list
-- 
Joel Roth
  
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://lists.sourceforge.net/lists/listinfo/ecasound-list
Received on Tue Jun 27 00:15:01 2017

This archive was generated by hypermail 2.1.8 : Tue Jun 27 2017 - 00:15:01 EEST