User talk:Balsa: Difference between revisions
m (→Redirecting stderr and stdout to a file: new section) |
(→Editing Resource Limits page: new section) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 73: | Line 73: | ||
Sample Encoding: 8-bit Unsigned Integer PCM<br/> | Sample Encoding: 8-bit Unsigned Integer PCM<br/> | ||
OK, it plays as unsigned 8bit. Success.<br/> | OK, it plays as unsigned 8bit. Success.<br/> | ||
== JACK network audio over UDP == | |||
On the end with the physical sound hardware (master): | |||
jackd -r -T -d alsa -i1 -n 10 -o1 -p 4096 -r 8000 -S | |||
-i num input channels | |||
-n nperiods | |||
-o num output channels | |||
-p period, must be power of 2. | |||
-r sample rate | |||
-S prefer 16bit int over 32 bit. | |||
Do last (third): | |||
jack_netsource -h <hostname> | |||
jack_netsource -h <hostname> -m 1400 -P 1 -C 1 -o 0 -i 0 -l 10 -b 16 | |||
-m set maximum transmit unit (MTU) | |||
-P -C -o -i number of sound and midi in/out channels. | |||
-l buffer in number of periods. | |||
-b 16 bits per sample. | |||
FIXME - how to set sample rate? | |||
On the virtual end (remote): | |||
jackd -r -d net | |||
jackd -r -T -d net -i 1 -o 1 -I 0 -O 0 -r 8000 -p 4096 -n 10 -b 16 | |||
-r not realtime -c -a0 | |||
-T temporary, close when all clients gone. | |||
-d net use device net. | |||
-i -o -I -O num channels for sound/midi | |||
-r sample rate | |||
-p 4096 frames per period | |||
-n 10 buffer size in num periods | |||
-b 16 use 16 bits/sample | |||
-c use CELT compression | |||
-a 0 do not use autoconfig, just start | |||
--[[User:Balsa|Balsa]] 01:47, 20 March 2011 (EDT) | |||
== Simple tests from command line == | == Simple tests from command line == | ||
Line 246: | Line 283: | ||
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST) | --[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST) | ||
== Sandbox and/or Editing Help pages on slackwiki? == | |||
If anyone knows if there exists a sandbox or an Help:Editing page here on slackwiki.org, please let me know. If not, I might try to create one. Advice welcome.<br> | |||
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST) | |||
A [[User:Balsa/Sandbox|sand-filled box]] labelled "Testing" | |||
--[[User:Balsa|Balsa]] 05:02, 8 April 2011 (EDT) | |||
== NTP log file configuration documentation == | |||
look for /usr/share/doc/ntp-doc/html/ntpd.html<br> | |||
It may be in a different place.<br> | |||
Use a http reader, like lynx to view it.<br> | |||
Go to "The Configuration File", then "Miscellaneous Options".<br> | |||
Scroll down to the "logconfig" and "logfile" headings.<br> | |||
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.<br> | |||
--[[User:Balsa|Balsa]] 02:26, 23 February 2011 (EST) | |||
== Editing Resource Limits page == | |||
Having recently run into some limits issues myself (and spending an hour or two learning about them), I am going to revise and extend the original [[Resource_Limits]] page. <br> | |||
Current goals: | |||
<ul> | |||
<li>Clarify where the ulimit documentation is. Slackware 12.2.0 (at least) has only a programmer's man page for ulimit. The shell builtin is documented in the shell's own man page.</li> | |||
<li>Steer users away from any programming manual pages. The above man page [ULIMIT(3)] says, "POSIX.1-2008 marks ulimit() as obsolete." This is potentially confusing; users may try to use non-existent getrlimit commands.</li> | |||
<li>ULIMIT(3) also says: "Warning: This routine is obsolete. Use getrlimit(2), setrlimit(2), and sysconf(3) instead. For the shell command ulimit(), see bash(1)." Same issue as above." </li> | |||
<li>Clarify whether or not ulimit is a shell builtin by letting the user test for it; if it is builtin, then matters become somewhat shell-specific.</li> | |||
<li>Expand the scope of the original article beyond increasing the limit for open files.</li> | |||
<li>Add a new section pointing to the README.limits file (as provided by the shadow package) as an alternate way of dealing with limits.</li> | |||
</ul> | |||
[[User:Balsa/Resource_Limits_Working_Draft|Resource Limits Working Draft]] | |||
--[[User:Balsa|Balsa]] 19:05, 16 August 2011 (CDT) |
Latest revision as of 00:05, 17 August 2011
Hi.
Balsa 03:28, 3 February 2011 (EST)
ALSA
/etc/asound.names
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.
/etc/asound.conf
I do not know what this is currently.
/etc/asound.state
Ditto.
strace - handy utility to see what programs are doing. strace -e file [some program and its args if relevant] - only shows file related stuff.
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)
strace -e file arecord -v -d 5 -t au test4.au ----> <snip>
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip>
Very interesting, indeed. This gives us the default ALSA device used by arecord, in my case it was /dev/snd/pcmC0D0c. Cross referencing with /etc/asound.names doesn't get us far, because I still don't know the mappings between that file and the stuff in /dev/snd. Some speculation may be in order.
grep -i capture -B 1 /etc/asound.names -->
name 'hw:0,4'
comment 'Physical Device - ALC268 Analog (Capture)'
--
name 'plughw:0,4'
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'
Hmm.
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au
This opens /dev/snd/pcmC0D4c, and says "Recording Sparc Audio 'test5.au' : Unsigned 8 bit, Rate 8000 Hz, Mono" but exits with "arecord: set_params:954: Sample format non available".
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.
TODO: Look at source code. Edit: nevermind.
Let's try one more thing - that /etc/asound.names gave me an idea...
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au
Hot dog it worked!
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3
sox test5.au -d --> Lots of clipping, noisy.
sox au: header size 24 is too small
Input File : 'test5.au'
Channels : 1
Sample Rate : 8000
Precision : 8-bit
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors
Sample Encoding: 8-bit Signed Integer PCM
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k
sox effects: rate clipped 120593 samples; decrease volume?
sox sox: alsa: output clipped 61507 samples; decrease volume?
Done.
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?
man sox
sox -u test5.au -d
sox formats_i: `test5.au': overriding encoding type
Sample Encoding: 8-bit Unsigned Integer PCM
OK, it plays as unsigned 8bit. Success.
JACK network audio over UDP
On the end with the physical sound hardware (master): jackd -r -T -d alsa -i1 -n 10 -o1 -p 4096 -r 8000 -S -i num input channels -n nperiods -o num output channels -p period, must be power of 2. -r sample rate -S prefer 16bit int over 32 bit.
Do last (third): jack_netsource -h <hostname> jack_netsource -h <hostname> -m 1400 -P 1 -C 1 -o 0 -i 0 -l 10 -b 16 -m set maximum transmit unit (MTU) -P -C -o -i number of sound and midi in/out channels. -l buffer in number of periods. -b 16 bits per sample. FIXME - how to set sample rate?
On the virtual end (remote):
jackd -r -d net
jackd -r -T -d net -i 1 -o 1 -I 0 -O 0 -r 8000 -p 4096 -n 10 -b 16
-r not realtime -c -a0
-T temporary, close when all clients gone.
-d net use device net.
-i -o -I -O num channels for sound/midi
-r sample rate
-p 4096 frames per period
-n 10 buffer size in num periods
-b 16 use 16 bits/sample
-c use CELT compression
-a 0 do not use autoconfig, just start
--Balsa 01:47, 20 March 2011 (EDT)
Simple tests from command line
netstat - man netstat
look for services that you don't know, read their manual pages. See if the service would be better listening to fewer interfaces [like localhost]. Use the ps command to figure out what's running. Try the netstat flags "--inet -anp" and read what they mean in the netstat manual.
look at /etc/fstab
man fstab man mount
Read a security article [fixme] about this file and the options. Skim the LVM and partitions pages here on slackwiki. Read about the noexec option (don't use this without understanding the consequences)
Try "hostname --fqdn" and see what it does. Check the exim page or qmail page to see about local mail delivery. Some security tools (and other stuff too) will email you when important events occur.
Read about the sudo and su commands.
--Balsa 16:15, 20 February 2011 (EST)
Exim - local mail only - setup and testing
Setup: not written yet.
Testing / Debugging:
The following are draft quality only. ps -efw | grep -i -e exim | grep -v grep
- Lists running exim processes.
netstat --inet -anp | grep -i -e exim -e 25 -e mail
- See if anything is listening on port 25.
ls -l /var/log
look for mail or exim4 directory, and mail.??? and mail.???? files.
ls -l /var/ look for mail, queue, or spool. Do a ls -l in any directories found above.
Mail might be in ~/Mail
Read the Mutt HOWTO on slackwiki.org.
Read the qmail HOWTO as well.
tail -f /var/log/exim4/mainlog (if it exists) The -f flag makes tail follow the file, so its best used on another virtual console or with screen. There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.
Try the mail command out.
man mail
echo "Testing local mail, sent on `date` to the local system" \ | mail -s "Test of Local Mail" username@localhost.localdomain
Note that username@localhost.localdomain may not work.
Try hostname --fqdn
look in /etc/hosts
Testing the MTA with telnet on a certain port:
telnet localhost 25
HELO localhost
MAIL FROM: username@localhost.localdomain
RCPT TO: username@localhost.localdomain
DATA
SUBJECT: Testing mail via telnet
This is the message body.
Check if it worked with your favorite mail reader or by looking in the files listed above. End message body with a "." on a line by itself. .
QUIT
Once local mail delivery works, you can setup cron jobs (see cron page on slackwiki, and man cron) and the output (if any) will be mailed to you.
Octave: simple functions
Find the Octave tutorial by typing doc at the Octave command line.
Navigate to * Introduction:: A brief introduction to Octave.
Then go to * Simple Examples::
The tutorial is quite brief, and gives few examples of functions.
This page will demo how to make simple functions, and how to call one function from another.
octave:11> function fn = fn ( p )
> fn = p*20
> endfunction
octave:10> function sn = sn ( a )
> sn = a * (1/2)
> endfunction
octave:12> function tn = tn( p, a )
> tn = sn(a)+fn(p)
> endfunction
octave:17> function excess = excess( p, a, bs )
> excess = bs - tn(p,a)
> endfunction
octave:18> excess(p,a,bs)
sn = 517.50
fn = 2140
tn = 2657.5
excess = -1452.5
ans = -1452.5
octave:28> function trade = trade ( p, a, bs, lt )
> trade = excess(p,a,bs)/lt
> endfunction
octave:26> function newacres = newacres (p, a, bs, lt, na )
> newacres = a+trade(p,a,bs,lt)
> endfunction
octave:36> p=107; a=1013; bs=3017; lt=25;
octave:37> newacres(p,a,bs,lt,na)
sn = 506.50
fn = 2140
tn = 2646.5
excess = 370.50
trade = 14.820
newacres = 1027.8
ans = 1027.8
octave:38> p=114; a=1027; bs=3095; lt=23;
octave:39> newacres(p,a,bs,lt,na)
sn = 513.50
fn = 2280
tn = 2793.5
excess = 301.50
trade = 13.109
newacres = 1040.1
ans = 1040.1
--Balsa 13:17, 21 February 2011 (EST)
Getmail
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).
In a getmail configuration file:
[destination]
type = Maildir
path = ~/Maildir/
This will write your email directly to the ~/Maildir/ directory in Maildir format.
--Balsa 13:23, 21 February 2011 (EST)
Redirecting stderr and stdout to a file
/bin/true &> foo
This may be helpful in the "Piping" section here on slackwiki.
--Balsa 13:34, 21 February 2011 (EST)
Sandbox and/or Editing Help pages on slackwiki?
If anyone knows if there exists a sandbox or an Help:Editing page here on slackwiki.org, please let me know. If not, I might try to create one. Advice welcome.
--Balsa 13:38, 21 February 2011 (EST)
A sand-filled box labelled "Testing" --Balsa 05:02, 8 April 2011 (EDT)
NTP log file configuration documentation
look for /usr/share/doc/ntp-doc/html/ntpd.html
It may be in a different place.
Use a http reader, like lynx to view it.
Go to "The Configuration File", then "Miscellaneous Options".
Scroll down to the "logconfig" and "logfile" headings.
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.
--Balsa 02:26, 23 February 2011 (EST)
Editing Resource Limits page
Having recently run into some limits issues myself (and spending an hour or two learning about them), I am going to revise and extend the original Resource_Limits page.
Current goals:
- Clarify where the ulimit documentation is. Slackware 12.2.0 (at least) has only a programmer's man page for ulimit. The shell builtin is documented in the shell's own man page.
- Steer users away from any programming manual pages. The above man page [ULIMIT(3)] says, "POSIX.1-2008 marks ulimit() as obsolete." This is potentially confusing; users may try to use non-existent getrlimit commands.
- ULIMIT(3) also says: "Warning: This routine is obsolete. Use getrlimit(2), setrlimit(2), and sysconf(3) instead. For the shell command ulimit(), see bash(1)." Same issue as above."
- Clarify whether or not ulimit is a shell builtin by letting the user test for it; if it is builtin, then matters become somewhat shell-specific.
- Expand the scope of the original article beyond increasing the limit for open files.
- Add a new section pointing to the README.limits file (as provided by the shadow package) as an alternate way of dealing with limits.
Resource Limits Working Draft --Balsa 19:05, 16 August 2011 (CDT)