JACK in Elphel cameras: Difference between revisions

From ElphelWiki
Jump to navigation Jump to search
Landy (talk | contribs)
No edit summary
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 7: Line 7:
  [root@Elphel353 /]# jackd -dalsa -dhw:0 -n3 -p512 -s -S
  [root@Elphel353 /]# jackd -dalsa -dhw:0 -n3 -p512 -s -S


jackd 0.116.2
jackd 0.116.2
Copyright 2001-2005 Paul Davis and others.
Copyright 2001-2005 Paul Davis and others.
jackd comes with ABSOLUTELY NO WARRANTY
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
under certain conditions; see the file COPYING for details
JACK compiled with System V SHM support.
JACK compiled with System V SHM support.
loading driver ..
loading driver ..
creating alsa driver ... hw:0|hw:0|512|3|48000|0|0|nomon|swmeter|soft-mode|16bit
creating alsa driver ... hw:0|hw:0|512|3|48000|0|0|nomon|swmeter|soft-mode|16bit
control device hw:0
control device hw:0
configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 3 periods
configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
ALSA: use 3 periods for playback
playback and capture sample rates do not match (48000 vs. 24000)
'''playback and capture sample rates do not match (48000 vs. 24000)'''
 
if You have different samplerate for capture/playback(as example, on my USB sound card)
if You have different samplerate for capture/playback(as example, on my USB sound card)
cancel jackd via ctrl-c and restart it via next command
cancel '''jackd''' via ctrl-c and restart it via next command
   
   
[root@Elphel353 /]# jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S
[root@Elphel353 /]# jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S


You can start JACK server in foreground as
You can start JACK server in background as
  jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S 1>/dev/null &
  jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S 1>/dev/null &


Ok, now we can look avialable audio channels.
Ok, now we can look avialable audio channels.
(login another telnet session, session #2, if You not started jackd as foreground)
(login another telnet session, session #2, if You not started jackd as foreground)
[root@Elphel353 /]# jack_lsp
 
system:capture_1
[root@Elphel353 /]# jack_lsp
system:capture_2
system:capture_1
system:playback_1
system:capture_2
system:playback_2
system:playback_1
system:playback_2


For test output channels starting simple software metronom
For test output channels starting simple software metronom
   
   
[root@Elphel353 /]# jack_metro -b 120 &
[root@Elphel353 /]# jack_metro -b 120 &
   
   
Look at avialable channels:
Look at avialable channels:
   
   
[root@Elphel353 /]# jack_lsp
[root@Elphel353 /]# jack_lsp
system:capture_1
system:capture_1
system:capture_2
system:capture_2
system:playback_1
system:playback_1
system:playback_2
system:playback_2
metro:120_bpm
metro:120_bpm
   
   
Connect headphones to audio card. Now "connect" metronom output to playback channels of soundcard as
Connect headphones to audio card. Now "connect" metronom output to playback channels of soundcard as
[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_1
[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_2


You can hear "beep" in headphones.
[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_1
Ok, disconnect metronom from output channels
[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_2
[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_1
 
[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_2
You can hear "beep" in headphones. Ok, disconnect metronom from output channels
 
[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_1
[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_2
 
For dump audio to wav files You can use utility '''''timemachine'''''


For dump audio to wav files You can use timemachine
[root@Elphel353 /]# timemachine -c1 -t1 -p/var/tmp/hdd/tm -f wav -n dmpaudio  
[root@Elphel353 /]# timemachine -c1 -t1 -p/var/tmp/hdd/tm -f wav -n dmpaudio  
   
   
where /var/tmp/hdd - path to directory where stored dump file
where /var/tmp/hdd - path to directory where stored dump file
tm - prefix of file, filename look as "tm2009-09-27T05:08:44.wav"
tm - prefix of file, filename look as "tm2009-09-27T05:08:44.wav"
dmpaudio - the JACK name timemachine will use
dmpaudio - the JACK name timemachine will use


Connect, for example, metro:120_bpm to dmpaudio:in_1. Go to session #2 and enter
Connect, for example, metro:120_bpm to dmpaudio:in_1. Go to session #2 and enter
   
   
[root@Elphel353]# jack_connect metro:120_bpm dmpaudio:in_1
[root@Elphel353]# jack_connect metro:120_bpm dmpaudio:in_1
[root@Elphel353]# jack_lsp -c
[root@Elphel353]# jack_lsp -c
system:capture_1
system:capture_1
system:capture_2
system:capture_2
system:playback_1
system:playback_1
system:playback_2
system:playback_2
metro:120_bpm
metro:120_bpm
     dmpaudio:in_1
     dmpaudio:in_1
dmpaudio:in_1
dmpaudio:in_1
     metro:120_bpm
     metro:120_bpm
   
   
Go to session #3 and enter "start"
Go to session where started ''timemachine'' and enter "start"
waiting some time - enter "stop"
waiting some time - enter "stop". Now You can play *.wav file and hear "beep"
Now You can play *.wav file and hear "beep"
 
Ok, disconnect metro:120_bpm from dmpaudio:in_1  
Ok, disconnect metro:120_bpm from dmpaudio:in_1  
[root@Elphel353]# jack_disconnect metro:120_bpm dmpaudio:in_1
and connect mic sound card to timemachine
[root@Elphel353]# jack_connect system:capture_1 dmpaudio:in_1
Go to session #1, enter command ''"start"''. Now You starting record from mic. Playing some time and stop record
Enter command ''"stop"''.
Trying play dumped ''wav'' file - You can hear sound from mic.
You can mixing two or more sources to dump file - use ''jack_connect'' for it.


'''timemachine''' have next options:


Go to session #1 and enter "start"
  Usage ./timemachine: [-h] [-i] [-c channels] [-n jack-name]                                             
waiting some time - enter "stop"
Now You can play *.wav file and hear "beep"
Ok, disconnect metro:120_bpm from dmpaudio:in_1 and connect audio capture channel to our dump program
Connect mic to sound card.
[root@Elphel353]# jack_disconnect metro:120_bpm dmpaudio:in_1
[root@Elphel353]# jack_connect system:capture_1 dmpaudio:in_1
Go to session #1, enter command "start". Now You starting record from mic. Playing some time and stop record
Enter command "stop". Trying play dumped wav file - You can hear sound from mic.
Ok, now mixing two sources to dump file, go to session #2
Usage ./timemachine: [-h] [-i] [-c channels] [-n jack-name]                                             
         [-t buffer-length] [-p file prefix] [-f format]                                                 
         [-t buffer-length] [-p file prefix] [-f format]                                                 
         [-a] [-b begin-threshold] [-e end-threshold] [-T end-time]
         [-a] [-b begin-threshold] [-e end-threshold] [-T end-time]
         [port-name ...]
         [port-name ...]
         -h      show this help
         -h      show this help
         -i      interactive mode (console instead of X11) also enabled
         -i      interactive mode (console instead of X11) also enabled
Line 117: Line 119:
         -e      specify threshold below which automatic recording will end
         -e      specify threshold below which automatic recording will end
         -T      specify silence length before automatic recording ends
         -T      specify silence length before automatic recording ends
         channels must be in the range 1-8, default 2
         channels must be in the range 1-8, default 2
         jack-name, default "TimeMachine"
         jack-name, default "TimeMachine"
Line 126: Line 127:
         end-threshold, default -35.0 dB
         end-threshold, default -35.0 dB
         end-time, default 10 secs
         end-time, default 10 secs
You can start ''timemachine'' via options '''"-a" "-b" "-e"''' and record audio automaticaly

Latest revision as of 13:38, 17 November 2009

This is example how using JACK on camera

- connect USB sound card to camera

- login via telnet and start jackd:

[root@Elphel353 /]# jackd -dalsa -dhw:0 -n3 -p512 -s -S
jackd 0.116.2
Copyright 2001-2005 Paul Davis and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK compiled with System V SHM support.
loading driver ..
creating alsa driver ... hw:0|hw:0|512|3|48000|0|0|nomon|swmeter|soft-mode|16bit
control device hw:0
configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
playback and capture sample rates do not match (48000 vs. 24000) 

if You have different samplerate for capture/playback(as example, on my USB sound card) cancel jackd via ctrl-c and restart it via next command

[root@Elphel353 /]# jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S

You can start JACK server in background as

jackd -dalsa -dplug:hw:0 -n3 -p512 -s -S 1>/dev/null &

Ok, now we can look avialable audio channels. (login another telnet session, session #2, if You not started jackd as foreground)

[root@Elphel353 /]# jack_lsp
system:capture_1
system:capture_2
system:playback_1
system:playback_2

For test output channels starting simple software metronom

[root@Elphel353 /]# jack_metro -b 120 &

Look at avialable channels:

[root@Elphel353 /]# jack_lsp
system:capture_1
system:capture_2
system:playback_1
system:playback_2
metro:120_bpm

Connect headphones to audio card. Now "connect" metronom output to playback channels of soundcard as

[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_1
[root@Elphel353 /]# jack_connect metro:120_bpm system:playback_2

You can hear "beep" in headphones. Ok, disconnect metronom from output channels

[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_1
[root@Elphel353 /]# jack_disconnect metro:120_bpm system:playback_2

For dump audio to wav files You can use utility timemachine

[root@Elphel353 /]# timemachine -c1 -t1 -p/var/tmp/hdd/tm -f wav -n dmpaudio 

where /var/tmp/hdd - path to directory where stored dump file

tm - prefix of file, filename look as "tm2009-09-27T05:08:44.wav"

dmpaudio - the JACK name timemachine will use

Connect, for example, metro:120_bpm to dmpaudio:in_1. Go to session #2 and enter

[root@Elphel353]# jack_connect metro:120_bpm dmpaudio:in_1
[root@Elphel353]# jack_lsp -c
system:capture_1
system:capture_2
system:playback_1
system:playback_2
metro:120_bpm
   dmpaudio:in_1
dmpaudio:in_1
   metro:120_bpm

Go to session where started timemachine and enter "start" waiting some time - enter "stop". Now You can play *.wav file and hear "beep"

Ok, disconnect metro:120_bpm from dmpaudio:in_1

[root@Elphel353]# jack_disconnect metro:120_bpm dmpaudio:in_1

and connect mic sound card to timemachine

[root@Elphel353]# jack_connect system:capture_1 dmpaudio:in_1

Go to session #1, enter command "start". Now You starting record from mic. Playing some time and stop record Enter command "stop". Trying play dumped wav file - You can hear sound from mic. You can mixing two or more sources to dump file - use jack_connect for it.

timemachine have next options:

Usage ./timemachine: [-h] [-i] [-c channels] [-n jack-name]                                             
       [-t buffer-length] [-p file prefix] [-f format]                                                 
       [-a] [-b begin-threshold] [-e end-threshold] [-T end-time]
       [port-name ...]
       -h      show this help
       -i      interactive mode (console instead of X11) also enabled
               if DISPLAY is unset
       -c      specify number of recording channels
       -n      specify the JACK name timemachine will use
       -t      specify the pre-recording buffer length
       -p      specify the saved file prefix, may include path
       -s      use safer characters in filename (windows compatibility)
       -f      specify the saved file format
       -a      enable automatic sound-triggered recording
       -b      specify threshold above which automatic recording will begin
       -e      specify threshold below which automatic recording will end
       -T      specify silence length before automatic recording ends
       channels must be in the range 1-8, default 2
       jack-name, default "TimeMachine"
       file-prefix, default "tm-"
       buffer-length, default 10 secs
       format, default 'w64', options: wav, w64
       begin-threshold, default -35.0 dB
       end-threshold, default -35.0 dB
       end-time, default 10 secs

You can start timemachine via options "-a" "-b" "-e" and record audio automaticaly