Jack capture
Contingut
Aquesta és l'aplicació que fan servir el Jeremy (Autostatic) i d'altres quan graben vídeos per a Youtube
- Website: http://www.notam02.no/arkiv/src/
- Description: small simple program to capture whatever sound is going out to your speakers
- Author: Kjetil Matheussen
- jack_capture-0.9.56.tar.gz
Compilo sense problemes. (si em dóna l'error error: sndfile.h: No such file or directory, aleshores sudo apt-get install libsndfile-dev)
To record what you hear, just run
$ jack_capture
To list advanced options, run
$ jack_capture --advanced-options
$ ./jack_capture --advanced-options
jack_capture [--bitdepth n] [--channels n] [--port port] [filename]
[ -b n] [ -c n] [ -p port]
"bitdepth" is by default FLOAT. It can be set to either 8, 16, 24 or 32. (for relevant formats)
"channels" is by default 2.
"port" is by default set to the two first physical outputs. The "port" argument can be
specified more than once.
"filename" is by default auotogenerated to "jack_capture_<number>.<format>"
Additional arguments:
[--duration n] or [-d n] -> Recording is stopped after "n" seconds.
[--filename-prefix s]/[-fp n] -> Sets first part of the autogeneratoed filename.
(default is "jack_capture_")
[--leading-zeros n] or [-z n] -> "n" is the number of zeros to in the autogenerated filename.
(-z 2 -> jack_capture_001.wav, and so on.) (default is 1)
[--format format] or [-f format] -> Selects fileformat provided by libsndfile.
See http://www.mega-nerd.com/libsndfile/api.html#open
(Default is wav for 1 or 2 channels, and wavex for more than 2.)
[--print-formats] or [-pf] -> Prints all sound formats provided to sndfile to screen and then
exits.
[--version] or [-v] -> Prints out version.
[--silent] or [-s] -> Suppresses some common messages printed to the terminal.
[--verbose] or [-V] -> Prints some extra information to the terminal.
[--mp3] or [-mp3] -> Writes to an mp3 file using liblame (LAME).
(the --format option has no effect using this option)
[--mp3-quality n] or [-mp3q n] -> Selects mp3 quality provided by liblame. n=0 is best, n=9 is worst.
Default n is 2. (0 uses the most amount of CPU, 9 uses the least)
[--mp3-bitrate n] or [-mp3b n] -> Selects mp3 bitrate (in kbit/s).
Default is set by liblame. (currently 128)
[--write-to-stdout] or [-ws] -> Writes 16 bit little endian to stdout. (the --format option, the
--mp3 option, and some others have no effect using this option)
[--disable-meter] or [-dm] -> Disable console meter.
[--hide-buffer-usage] or [-hbu] -> Disable buffer usage updates in the console.
[--disable-console] or [-dc] -> Disable console updates. Same as "-dm -hbu".
[--linear-meter] or [-lm] -> Use linear scale for the console meter (default is dB scale)
[--dB-meter-reference or [-dBr] -> Specify reference level for dB meter. (default=0)
[--meterbridge] or [-mb] -> Start up meterbridge to monitor recorded sound.
[--meterbridge-type] or [-mt] -> Specify type. vu (default), ppm, dpm, jf or sco.
[--meterbridge-reference]/[-mr] -> Specify reference level for meterbidge.
[--jack-transport]/[-jt] -> Start program, but do not start recording until jack transport has started rolling
When jack transport stops, the recording is also stopped, and the program ends.
[--jack-transport-multi]/[-jtm] -> Similar to --jack-transport, but do not end program when jack transport stops.
Instead, record to a new file when jack_transport starts rolling again.
(not implemented yet)
[--bufsize s] or [-B s] -> Initial/minimum buffer size in seconds. Default is 8 seconds
for mp3 files, and 4 seconds for all other formats.
[--maxbufsize] or [-MB] -> Maximum buffer size in seconds jack_capture will allocate.
Default is 40. (Buffer is automatically increased during
recording when needed. But it will never go beyond this size.)
[--filename] or [-fn] -> Specify filename.
(It's usually easier to set last argument instead)
Examples:
To record a stereo file of what you hear:
$jack_capture
To record a stereo file of what you hear in the flac format:
$jack_capture -f flac
To record a stereo file of what you hear in the ogg format:
$jack_capture -f ogg
To record a stereo file of what you hear in the mp3 format:
$jack_capture -mp3
To record a stereo file of what you hear in the wav format:
$jack_capture --port system:playback_1 --port system:playback_2
****************************************************************************
**** NOTE! The above example does _exactly_ the same as the default!!! ****
****************************************************************************
Same result as above, but using a different syntax:
$jack_capture --channels 2 --port system:playback*
To record the output from jamin:
$jack_capture --port jamin:out* sound_from_jamin.wav
To record all sound coming in to jamin:
$jack_capture --port jamin:in* sound_to_jamin.wav
To record all sound coming in and out of jamin:
$jack_capture --port jamin* sound_to_and_from_jamin.wav
To record a stereo file from the soundcard:
$jack_capture -c 2 -p system:capture*
La idea és:
- arrenco el vkeybd, Zyn i els connecto
- connecto el Zyn amb el system, com faig habitualment, de manera que puc escoltar el que vaig fent. Aleshores:
$ jack_capture
i se m'estarà gravant automàticament tot el que faig amb el vkeybd al fitxer per defecte (veure les opcions) (comprovat).
A més, he arrencat el JACK en mode duplex (amb el truco de treure el ratolí i tornar-lo a posar). De manera que connecto el system:capture i el Zyn al system:playback. Fixem-nos que puc monitoritzar pels casca tot allò que parlo pel micro. Aleshores quan faig
$ jack_capture --filename prova1.wav
estic gravant el Zyn i el micròfon al mateix temps. Aquesta és la idea del jack_capture. Gravar allò que està sonant.
(El micròfon l'escolto per un canal... s'ha de fer allò d'escoltar-lo pels dos canals). Doncs no!, el que s'ha de fer és connectar el system:capture1 als dos playback (system:playback1 i system:playback2), i ja està solucionat.
jack_record_gui diu Xdialog needed, i jack_record_gui2 sí que arrenca però em dóna error en gravar.
Exemple pràctic: jplay-sndfile (febrer 2012)
Per fer les mostres que necessito per testejar l'aplicació:
Configuro la interface a 44100, i arrenco JACK a 44100. La interface Edirol UA-25EX sampleja a 24 bits
"bitdepth" (-b) is by default FLOAT. It can be set to either 8, 16, 24 or 32. (for relevant formats)
La interface grava a 24 bits (3 bytes per mostra), i en el programa les mostres es guarden en un float (sizeof(float)=4). Per tant, no hi ha cap pèrdua d'informació. jack_capture per defecte utilitza float. També podríem ficar -b 24, però no cal doncs ja utilitza FLOAT que és la precisió que s'utilitzarà en el programa.
Com sempre, una cosa és de què és capaç la interface (mostrejar a 24 bits), i una altra és com configuro el software. Per tant, encara que gravi a 32 bits (FLOAT), les mostres seran de 24 bits.
$ jack_capture -c 1 -f wav --port system:capture_1 samples/test_44100.wav
Per comprovar que ho faig bé:
$ sndfile-info samples/test_44100.wav
Version : libsndfile-1.0.23
========================================
File : samples/test_44100.wav
Length : 1007696
RIFF : 1007688
WAVE
fmt : 16
Format : 0x3 => WAVE_FORMAT_IEEE_FLOAT
Channels : 1
Sample Rate : 44100
Block Align : 4
Bit Width : 32
Bytes/sec : 176400
fact : 4
frames : 251904
PEAK : 16
version : 1
time stamp : 1329815014
Ch Position Value
0 55893 0.167791
data : 1007616
End
----------------------------------------
Sample Rate : 44100
Frames : 251904
Channels : 1
Format : 0x00010006
Sections : 1
Seekable : TRUE
Duration : 00:00:05.712
Signal Max : 0.167791 (-15.50 dB)
$ jack_capture -b 24 -c 1 -f wav --port system:capture_1 samples/test_44100_24.wav
$ sndfile-info samples/test_44100_24.wav Version : libsndfile-1.0.23 ======================================== File : samples/test_44100_24.wav Length : 1141292 RIFF : 1141284 WAVE fmt : 16 Format : 0x1 => WAVE_FORMAT_PCM Channels : 1 Sample Rate : 44100 Block Align : 3 Bit Width : 24 Bytes/sec : 132300 data : 1141248 End ---------------------------------------- Sample Rate : 44100 Frames : 380416 Channels : 1 Format : 0x00010003 Sections : 1 Seekable : TRUE Duration : 00:00:08.626 Signal Max : 1.2232e+06 (-16.72 dB)
Què passa si la freqüència de mostreig de la interface (44100) i del JACK (48000) estan en desacord? Doncs que mana la interface física: es mostreja a 44100
Què passa si la freqüència de mostreig de la interface (48000) i del JACK (44100) estan en desacord? Mana la interface, però com que el servidor d'àudio està treballant a un menor sample rate, aquest és el que mana.
En definitiva, les coses són com han de ser: s'imposa la lògica. El millor, però, és que la interface i JACK estiguin d'acord.
Una cosa important que m'he trobat: per canviar de sample rate s'ha de desconnectar el cable USB de la interfacte i aturar totalment el JACK (no només aturar el JACK, sinó també apagar la instància del QJackCtl). Per assegurar-nos de què estem treballant amb la freqüència de mostreig correcta, fer sndfile-info
Per tant, faig una petita col.lecció de mostres:
$ jack_capture -c 1 -f wav --port system:capture_1 samples/test_44100.wav $ jack_capture -c 1 -f wav --port system:capture_1 samples/test_48000.wav $ jack_capture -c 1 -f wav --port system:capture_1 samples/test_96000.wav
Per gravar la sortida de jplay-sndfile, utilitzo jack_capture <ptr> $ jack_capture -b 16 -c 1 -f wav --port system:playback_1 output/hola.wav o bé molt millor: $ jack_capture -b 16 -c 1 -f wav --port jplay-sndfile:out output/hola.wav
Gravar el que sona des del navegador web (per ex, les 24 mazurques de http://www.diatonic.cat/index.php/24-mazurques, on es fa servir un plugin d'audio):
$ jack_capture -b 24 -c 2 -f wav --port "PulseAudio JACK Sink:rear-left" --port "PulseAudio JACK Sink:rear-right" 01_Lamodista.wav
creat per Joan Quintana Compte, octubre 2010