https://www.slackwiki.com/api.php?action=feedcontributions&user=Balsa&feedformat=atomSlackWiki - User contributions [en]2024-03-28T11:05:34ZUser contributionsMediaWiki 1.40.0https://www.slackwiki.com/index.php?title=User:Balsa/Resource_Limits_Working_Draft&diff=511User:Balsa/Resource Limits Working Draft2011-08-17T00:08:16Z<p>Balsa: Resource Limits page working draft</p>
<hr />
<div>= Purpose =<br />
<br />
This page does not attempt to explain the different types of system resource limits or when it is (or is not) appropriate to change them; see '''man ulimit''' and [[http://google.com Google]] for that discussion.<br />
<br />
However, some users run into problems with the linux kernel's default limit settings, so we'll attempt to explain how to modify them to suit their special needs.<br><br />
<br />
Also covered:<br />
<ul><br />
<li>How to display the system resource limits.</li><br />
</ul><br />
<br />
<br />
= Overview =<br />
<br />
<br />
The default settings provided by the kernel are sane values for most multi-user machines.<br><br />
However, the defaults may be different depending on your FIXME[distribution/kernel?].<br><br />
The examples that follow may have different limits than your system. The limits in the examples are not necessarily better. This page does not endorse or recommend any particular limits.<br><br />
Depending on your shell, the examples may be different, and the commands may need to be modified.<br><br />
<br />
Issuing the command '''ulimit -Ha''' should show all the ''Hard'' limits.<br />
Example:<br />
user@host:~$ ulimit -Ha<br />
core file size (blocks, -c) unlimited<br />
data seg size (kbytes, -d) unlimited<br />
file size (blocks, -f) unlimited<br />
pending signals (-i) 8118<br />
max locked memory (kbytes, -l) 32<br />
max memory size (kbytes, -m) unlimited<br />
open files (-n) 1024<br />
pipe size (512 bytes, -p) 8<br />
POSIX message queues (bytes, -q) 819200<br />
stack size (kbytes, -s) unlimited<br />
cpu time (seconds, -t) unlimited<br />
max user processes (-u) 8118<br />
virtual memory (kbytes, -v) unlimited<br />
file locks (-x) unlimited<br />
<br />
and '''ulimit -Sa''' should show all the ''Soft'' limits:<br />
user@host:~$ ulimit -Sa<br />
core file size (blocks, -c) 0<br />
data seg size (kbytes, -d) unlimited<br />
file size (blocks, -f) unlimited<br />
pending signals (-i) 8118<br />
max locked memory (kbytes, -l) 32<br />
max memory size (kbytes, -m) unlimited<br />
open files (-n) 1024<br />
pipe size (512 bytes, -p) 8<br />
POSIX message queues (bytes, -q) 819200<br />
stack size (kbytes, -s) 8192<br />
cpu time (seconds, -t) unlimited<br />
max user processes (-u) 8118<br />
virtual memory (kbytes, -v) unlimited<br />
file locks (-x) unlimited<br />
<br />
<br />
The first command shows the hard limits set by the kernel, and the second command shows the soft limits set by the user(Verify?). An unprivileged user can increase the soft limit (up to the hard limit value), and he is also able to lower the hard limit (but then is unable to increase it, as an unprivileged user cannot raise the hard limit at all).<br />
<br />
There are some situations which might require a larger hard limit for users, and the obvious "solution" is to add a line in /etc/profile to increase it. However, this will not work, because normal users cannot increase their hard limits (as indicated above).<br />
<br />
<br />
<br />
= Solution #1: ''/sbin/initscript'' =<br />
<br />
To increase the hard limits for users, you will need to create '''/sbin/initscript''' and place appropriate commands inside it. The easiest way is to copy the file '''/sbin/initscript.sample''' to '''/sbin/initscript''' and edit the copy, but you are certainly free to "roll your own." If you decide to create your own, make sure it is executable or it will not work.<br><br />
Note: If /sbin/initscript.sample does not exist, you may find reading the initscript manual page helpful.<br><br />
Using the following '''/sbin/initscript''' file:<br />
<br />
PATH=/bin:/sbin:/usr/bin:/usr/sbin<br />
export PATH<br />
<br />
# Increase the hardlimit for open files<br />
ulimit -Hn 4096<br />
<br />
# Execute the program.<br />
eval exec "$4"<br />
<br />
You should get the following after a reboot:<br />
user@host:~$ ulimit -Hn<br />
4096<br />
<br />
user@host:~$ ulimit -n<br />
1024<br />
<br />
Notice that the hardlimit is now 4096 (as specified in /sbin/initscript), but the softlimit is still 1024. In other words, you will still need to use /etc/profile (or some other shell init file - see below for recommendation) to raise the desired users' softlimits. With some creative scripting, you can be more selective about which users have what limits.<br />
<br />
Rather than editing the system /etc/profile, it's recommended to create a custom file in /etc/profile.d and make it executable. This way, you don't have to worry about trying to merge your changes to /etc/profile when doing Slackware upgrades to new versions.<br />
<br />
<br />
<br />
<br />
= Solution #2: README.limits and the ''shadow'' package =<br />
<br />
To increase the hard limits for users, you should read the README.limits file provided by the shadow package which is very likely already installed. See the "''Other Resources''" section to find its location.<br />
<br />
Here is an example /etc/limits file.<br />
# /etc/limits contains user resource limits.<br />
# See limits(5).<br />
#<br />
# Format:<br />
# <username> <limits-string><br />
#<br />
# default entry is '*' for username<br />
#<br />
# Valid flags are:<br />
# A: max address space (KB)<br />
# C: max core file size (KB)<br />
# D: max data size (KB)<br />
# F: maximum filesize (KB)<br />
# M: max locked-in-memory address space (KB) [only for root on Linux 2.0.x]<br />
# N: max number of open files<br />
# R: max resident set size (KB) [no effect on Linux 2.0.x]<br />
# S: max stack size (KB)<br />
# T: max CPU time (MIN)<br />
# U: max number of processes<br />
# L: max number of logins for this user<br />
# I: max nice value (0..39 translates to 20..-19)<br />
# O: max real time priority (0..MAX_RT_PRIO)<br />
#<br />
# Examples:<br />
# the default entry<br />
#* L2 D6144 R2048 S2048 U32 N32 F16384 T5 C0 I20 O0<br />
# another way of suspending a user login<br />
#guest L0<br />
# this account has no limits<br />
#sysadm -<br />
<br />
Following the example in Solution #1 above, to increase the hardlimit for open files you would need to add the following line to /etc/limits:<br />
user N4096<br />
<br />
You do ''not'' need to reboot. Simply log off [Fixme: all instances?] and then log back on again.<br><br />
Apparently, [Verify?] this will set the hard and soft limits equal.<br />
<br />
Results:<br />
user@host:~$ ulimit -Hn<br />
4096<br />
<br />
user@host:~$ ulimit -Sn<br />
4096<br />
<br />
= Other Resources =<br />
<br />
Find out if ulimit is a '''''shell builtin''''' or not.<br />
If ''which'' finds an ulimit executable, then it is not a shell builtin.<br />
* '''which ulimit'''<br />
<br />
Example of a shell builtin (which returns no results):<br />
user@host: ~ $ which ulimit<br />
which: no ulimit in (/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/sbin:/sbin)<br />
<br />
The ulimit man page may not be useful if ulimit is a shell builtin. If it is a shell builtin, read your shell's man page and search for the string "ulimit". (without the quotes)<br />
* '''man bash''' <br />
* '''man ash'''<br />
* '''man dash'''<br />
* '''man sh'''<br />
* '''man ksh'''<br />
* '''man csh'''<br />
* '''man tcsh'''<br />
Otherwise,<br />
* '''man ulimit'''<br />
<br />
<br />
Read the other manual pages:<br />
* '''man initscript'''<br />
* '''man limits'''<br />
<br />
== Finding the README.limits file ==<br />
<br />
Find the package that installed the limits (5) man page: (should be shadow)<br />
* '''grep -i "limits.5.gz" /var/log/packages/*'''<br />
<br />
Find the README.limits file, replacing x.y.z.-march-n with whatever version of shadow you found above:<br />
* '''grep -i "README.limits" /var/log/packages/shadow-x.y.z.-march-n'''<br />
<br />
Alternatively, if you have slocate installed:<br />
* '''slocate README.limits'''<br />
(or the really easy way):<br />
* '''less `slocate README.limits`'''<br><br />
<br><br />
Finally, read the README.limits file, replacing x.y.z with whatever version of shadow you have installed:<br />
* '''less /usr/doc/shadow-x.y.z/README.limits'''<br />
<br />
<br />
[[Category:Tutorials]]</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=510User talk:Balsa2011-08-17T00:05:34Z<p>Balsa: /* Editing Resource Limits page */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
<br />
== JACK network audio over UDP ==<br />
<br />
On the end with the physical sound hardware (master):<br />
jackd -r -T -d alsa -i1 -n 10 -o1 -p 4096 -r 8000 -S <br />
-i num input channels<br />
-n nperiods <br />
-o num output channels<br />
-p period, must be power of 2.<br />
-r sample rate<br />
-S prefer 16bit int over 32 bit.<br />
<br />
Do last (third):<br />
jack_netsource -h <hostname><br />
jack_netsource -h <hostname> -m 1400 -P 1 -C 1 -o 0 -i 0 -l 10 -b 16<br />
-m set maximum transmit unit (MTU)<br />
-P -C -o -i number of sound and midi in/out channels.<br />
-l buffer in number of periods.<br />
-b 16 bits per sample.<br />
FIXME - how to set sample rate?<br />
<br />
<br />
On the virtual end (remote):<br />
jackd -r -d net<br />
jackd -r -T -d net -i 1 -o 1 -I 0 -O 0 -r 8000 -p 4096 -n 10 -b 16<br />
-r not realtime -c -a0<br />
-T temporary, close when all clients gone.<br />
-d net use device net.<br />
-i -o -I -O num channels for sound/midi<br />
-r sample rate<br />
-p 4096 frames per period<br />
-n 10 buffer size in num periods<br />
-b 16 use 16 bits/sample<br />
-c use CELT compression<br />
-a 0 do not use autoconfig, just start<br />
--[[User:Balsa|Balsa]] 01:47, 20 March 2011 (EDT)<br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)<br />
<br />
== Sandbox and/or Editing Help pages on slackwiki? ==<br />
<br />
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><br />
<br />
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST)<br />
<br />
A [[User:Balsa/Sandbox|sand-filled box]] labelled "Testing"<br />
--[[User:Balsa|Balsa]] 05:02, 8 April 2011 (EDT)<br />
<br />
== NTP log file configuration documentation ==<br />
<br />
look for /usr/share/doc/ntp-doc/html/ntpd.html<br><br />
It may be in a different place.<br><br />
Use a http reader, like lynx to view it.<br><br />
Go to "The Configuration File", then "Miscellaneous Options".<br><br />
<br />
Scroll down to the "logconfig" and "logfile" headings.<br><br />
<br />
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.<br><br />
<br />
--[[User:Balsa|Balsa]] 02:26, 23 February 2011 (EST)<br />
<br />
== Editing Resource Limits page ==<br />
<br />
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><br />
Current goals:<br />
<ul><br />
<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><br />
<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><br />
<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><br />
<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><br />
<li>Expand the scope of the original article beyond increasing the limit for open files.</li><br />
<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><br />
</ul><br />
<br />
[[User:Balsa/Resource_Limits_Working_Draft|Resource Limits Working Draft]]<br />
--[[User:Balsa|Balsa]] 19:05, 16 August 2011 (CDT)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=468User talk:Balsa2011-04-08T09:02:03Z<p>Balsa: Added link to sandbox.</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
<br />
== JACK network audio over UDP ==<br />
<br />
On the end with the physical sound hardware (master):<br />
jackd -r -T -d alsa -i1 -n 10 -o1 -p 4096 -r 8000 -S <br />
-i num input channels<br />
-n nperiods <br />
-o num output channels<br />
-p period, must be power of 2.<br />
-r sample rate<br />
-S prefer 16bit int over 32 bit.<br />
<br />
Do last (third):<br />
jack_netsource -h <hostname><br />
jack_netsource -h <hostname> -m 1400 -P 1 -C 1 -o 0 -i 0 -l 10 -b 16<br />
-m set maximum transmit unit (MTU)<br />
-P -C -o -i number of sound and midi in/out channels.<br />
-l buffer in number of periods.<br />
-b 16 bits per sample.<br />
FIXME - how to set sample rate?<br />
<br />
<br />
On the virtual end (remote):<br />
jackd -r -d net<br />
jackd -r -T -d net -i 1 -o 1 -I 0 -O 0 -r 8000 -p 4096 -n 10 -b 16<br />
-r not realtime -c -a0<br />
-T temporary, close when all clients gone.<br />
-d net use device net.<br />
-i -o -I -O num channels for sound/midi<br />
-r sample rate<br />
-p 4096 frames per period<br />
-n 10 buffer size in num periods<br />
-b 16 use 16 bits/sample<br />
-c use CELT compression<br />
-a 0 do not use autoconfig, just start<br />
--[[User:Balsa|Balsa]] 01:47, 20 March 2011 (EDT)<br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)<br />
<br />
== Sandbox and/or Editing Help pages on slackwiki? ==<br />
<br />
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><br />
<br />
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST)<br />
<br />
A [[User:Balsa/Sandbox|sand-filled box]] labelled "Testing"<br />
--[[User:Balsa|Balsa]] 05:02, 8 April 2011 (EDT)<br />
<br />
== NTP log file configuration documentation ==<br />
<br />
look for /usr/share/doc/ntp-doc/html/ntpd.html<br><br />
It may be in a different place.<br><br />
Use a http reader, like lynx to view it.<br><br />
Go to "The Configuration File", then "Miscellaneous Options".<br><br />
<br />
Scroll down to the "logconfig" and "logfile" headings.<br><br />
<br />
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.<br><br />
<br />
--[[User:Balsa|Balsa]] 02:26, 23 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User:Balsa/Sandbox&diff=467User:Balsa/Sandbox2011-04-08T08:56:58Z<p>Balsa: A prototype sandbox.</p>
<hr />
<div>'''Some bold text''' <br />
''Some italicised text'' <br />
'''''Some bold and italicised text ''''' <br />
<s>Strike-through</s><br><br />
An internal link: [[User_talk:Balsa]]<br><br />
Math: <math>2+2=4</math><br />
*A really short list<br><br />
A space at the beginning of the line.<br />
<p>A paragraph tag. <br />
<font color="blue"> Font tag colour test. </font><br />
{| <br />
| style="background:green; color:blue" | Test<br />
| of<br />
| style="background:black; color:green" | Colours.<br />
|}<br />
A signature with timestamp: --[[User:Balsa|Balsa]] 04:56, 8 April 2011 (EDT)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=466User talk:Balsa2011-03-20T05:47:30Z<p>Balsa: /* ALSA */ jack UDP draft added</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
<br />
== JACK network audio over UDP ==<br />
<br />
On the end with the physical sound hardware (master):<br />
jackd -r -T -d alsa -i1 -n 10 -o1 -p 4096 -r 8000 -S <br />
-i num input channels<br />
-n nperiods <br />
-o num output channels<br />
-p period, must be power of 2.<br />
-r sample rate<br />
-S prefer 16bit int over 32 bit.<br />
<br />
Do last (third):<br />
jack_netsource -h <hostname><br />
jack_netsource -h <hostname> -m 1400 -P 1 -C 1 -o 0 -i 0 -l 10 -b 16<br />
-m set maximum transmit unit (MTU)<br />
-P -C -o -i number of sound and midi in/out channels.<br />
-l buffer in number of periods.<br />
-b 16 bits per sample.<br />
FIXME - how to set sample rate?<br />
<br />
<br />
On the virtual end (remote):<br />
jackd -r -d net<br />
jackd -r -T -d net -i 1 -o 1 -I 0 -O 0 -r 8000 -p 4096 -n 10 -b 16<br />
-r not realtime -c -a0<br />
-T temporary, close when all clients gone.<br />
-d net use device net.<br />
-i -o -I -O num channels for sound/midi<br />
-r sample rate<br />
-p 4096 frames per period<br />
-n 10 buffer size in num periods<br />
-b 16 use 16 bits/sample<br />
-c use CELT compression<br />
-a 0 do not use autoconfig, just start<br />
--[[User:Balsa|Balsa]] 01:47, 20 March 2011 (EDT)<br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)<br />
<br />
== Sandbox and/or Editing Help pages on slackwiki? ==<br />
<br />
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><br />
<br />
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST)<br />
<br />
== NTP log file configuration documentation ==<br />
<br />
look for /usr/share/doc/ntp-doc/html/ntpd.html<br><br />
It may be in a different place.<br><br />
Use a http reader, like lynx to view it.<br><br />
Go to "The Configuration File", then "Miscellaneous Options".<br><br />
<br />
Scroll down to the "logconfig" and "logfile" headings.<br><br />
<br />
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.<br><br />
<br />
--[[User:Balsa|Balsa]] 02:26, 23 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=463User talk:Balsa2011-02-23T07:26:21Z<p>Balsa: /* NTP log file configuration documentation */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)<br />
<br />
== Sandbox and/or Editing Help pages on slackwiki? ==<br />
<br />
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><br />
<br />
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST)<br />
<br />
== NTP log file configuration documentation ==<br />
<br />
look for /usr/share/doc/ntp-doc/html/ntpd.html<br><br />
It may be in a different place.<br><br />
Use a http reader, like lynx to view it.<br><br />
Go to "The Configuration File", then "Miscellaneous Options".<br><br />
<br />
Scroll down to the "logconfig" and "logfile" headings.<br><br />
<br />
There you will find a way to eliminate the "kernel time sync status change 6001" messages from syslog.<br><br />
<br />
--[[User:Balsa|Balsa]] 02:26, 23 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=462User talk:Balsa2011-02-21T18:38:57Z<p>Balsa: /* Sandbox and/or Editing Help pages on slackwiki? */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)<br />
<br />
== Sandbox and/or Editing Help pages on slackwiki? ==<br />
<br />
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><br />
<br />
--[[User:Balsa|Balsa]] 13:38, 21 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=461User talk:Balsa2011-02-21T18:34:55Z<p>Balsa: /* Redirecting stderr and stdout to a file */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)<br />
<br />
== Redirecting stderr and stdout to a file ==<br />
<br />
/bin/true &> foo<br><br />
<br />
This may be helpful in the "Piping" section here on slackwiki.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:34, 21 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=460User talk:Balsa2011-02-21T18:23:27Z<p>Balsa: /* Getmail */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)<br />
<br />
== Getmail ==<br />
<br />
One of getmail's biggest features is writing directly to Maildir. This obviates the need for a Mail Transport Agent (MTA).<br><br />
<br />
In a getmail configuration file:<br />
<br />
[destination]<br><br />
type = Maildir<br><br />
path = ~/Maildir/<br><br />
<br />
This will write your email directly to the ~/Maildir/ directory in Maildir format.<br><br />
<br />
--[[User:Balsa|Balsa]] 13:23, 21 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=459User talk:Balsa2011-02-21T18:17:52Z<p>Balsa: /* Octave: simple functions */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.<br />
<br />
== Octave: simple functions ==<br />
<br />
Find the Octave tutorial by typing doc at the Octave command line.<br><br />
Navigate to * Introduction:: A brief introduction to Octave.<br><br />
Then go to * Simple Examples::<br><br />
The tutorial is quite brief, and gives few examples of functions.<br><br />
This page will demo how to make simple functions, and how to call one function from another.<br><br />
<br />
octave:11> function fn = fn ( p )<br><br />
> fn = p*20<br><br />
> endfunction<br><br />
<br />
octave:10> function sn = sn ( a )<br><br />
> sn = a * (1/2)<br><br />
> endfunction<br><br />
<br />
octave:12> function tn = tn( p, a )<br><br />
> tn = sn(a)+fn(p)<br><br />
> endfunction<br><br />
<br />
octave:17> function excess = excess( p, a, bs )<br><br />
> excess = bs - tn(p,a)<br><br />
> endfunction<br><br />
<br />
octave:18> excess(p,a,bs)<br><br />
sn = 517.50<br><br />
fn = 2140<br><br />
tn = 2657.5<br><br />
excess = -1452.5<br><br />
ans = -1452.5<br><br />
<br />
octave:28> function trade = trade ( p, a, bs, lt )<br><br />
> trade = excess(p,a,bs)/lt<br><br />
> endfunction<br><br />
<br />
octave:26> function newacres = newacres (p, a, bs, lt, na )<br><br />
> newacres = a+trade(p,a,bs,lt)<br><br />
> endfunction<br><br />
<br />
octave:36> p=107; a=1013; bs=3017; lt=25;<br><br />
octave:37> newacres(p,a,bs,lt,na)<br><br />
sn = 506.50<br><br />
fn = 2140<br><br />
tn = 2646.5<br><br />
excess = 370.50<br><br />
trade = 14.820<br><br />
newacres = 1027.8<br><br />
ans = 1027.8<br><br />
octave:38> p=114; a=1027; bs=3095; lt=23;<br><br />
octave:39> newacres(p,a,bs,lt,na)<br><br />
sn = 513.50<br><br />
fn = 2280<br><br />
tn = 2793.5<br><br />
excess = 301.50<br><br />
trade = 13.109<br><br />
newacres = 1040.1<br><br />
ans = 1040.1<br><br />
<br />
--[[User:Balsa|Balsa]] 13:17, 21 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=458User talk:Balsa2011-02-20T22:24:21Z<p>Balsa: /* Exim - local mail only - setup and testing */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)<br />
<br />
== Exim - local mail only - setup and testing ==<br />
<br />
Setup: not written yet.<br />
<br />
<br />
<br />
Testing / Debugging:<br />
<br />
The following are draft quality only.<br />
ps -efw | grep -i -e exim | grep -v grep<br />
#Lists running exim processes.<br />
netstat --inet -anp | grep -i -e exim -e 25 -e mail<br />
#See if anything is listening on port 25.<br />
<br />
<br />
ls -l /var/log<br />
look for mail or exim4 directory, and mail.??? and mail.???? files.<br />
<br />
ls -l /var/<br />
look for mail, queue, or spool.<br />
Do a ls -l in any directories found above.<br />
<br />
Mail might be in ~/Mail<br />
<br />
Read the Mutt HOWTO on slackwiki.org.<br />
<br />
Read the qmail HOWTO as well.<br />
<br />
tail -f /var/log/exim4/mainlog (if it exists)<br />
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.<br />
There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.<br />
<br />
<br />
Try the mail command out.<br />
man mail<br />
<br />
echo "Testing local mail, sent on `date` to the local system" \<br />
| mail -s "Test of Local Mail" username@localhost.localdomain<br />
<br />
Note that username@localhost.localdomain may not work.<br />
<br />
Try hostname --fqdn<br />
<br />
look in /etc/hosts<br />
<br />
<br />
Testing the MTA with telnet on a certain port:<br />
<br />
telnet localhost 25<br />
<br />
HELO localhost<br />
<br />
MAIL FROM: username@localhost.localdomain<br />
<br />
RCPT TO: username@localhost.localdomain<br />
<br />
DATA<br />
<br />
SUBJECT: Testing mail via telnet<br />
<br />
This is the message body.<br />
<br />
Check if it worked with your favorite mail reader or by<br />
looking in the files listed above.<br />
End message body with a "." on a line by itself.<br />
.<br />
<br />
QUIT<br />
<br />
<br />
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.</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=457User talk:Balsa2011-02-20T21:15:06Z<p>Balsa: /* Simple tests from command line */ new section</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/><br />
<br />
== Simple tests from command line ==<br />
<br />
netstat - man netstat<br />
<br />
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.<br />
<br />
look at /etc/fstab<br />
<br />
man fstab<br />
man mount<br />
<br />
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)<br />
<br />
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.<br />
<br />
Read about the sudo and su commands.<br />
<br />
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)</div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=452User talk:Balsa2011-02-04T03:46:40Z<p>Balsa: more formatting cleanup</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/></div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=451User talk:Balsa2011-02-04T03:36:51Z<p>Balsa: some formatting cleanup</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
<br />
== ALSA ==<br />
<br />
/etc/asound.names<br/><br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br/><br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br/><br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br/><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br/><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br/><br />
name 'hw:0,4'<br/><br />
comment 'Physical Device - ALC268 Analog (Capture)'<br/><br />
--<br/><br />
name 'plughw:0,4'<br/><br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/><br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br/><br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br/><br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br/><br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br/><br />
Hot dog it worked!<br/><br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br/><br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br/><br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br/><br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br/><br />
Channels : 1<br/><br />
Sample Rate : 8000<br/><br />
Precision : 8-bit<br/><br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br/><br />
Sample Encoding: 8-bit Signed Integer PCM<br/><br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br/><br />
sox effects: rate clipped 120593 samples; decrease volume?<br/><br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/><br />
Done.<br/><br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br/><br />
sox formats_i: `test5.au': overriding encoding type<br/><br />
Sample Encoding: 8-bit Unsigned Integer PCM<br/><br />
OK, it plays as unsigned 8bit. Success.<br/></div>Balsahttps://www.slackwiki.com/index.php?title=User_talk:Balsa&diff=450User talk:Balsa2011-02-03T08:28:32Z<p>Balsa: Discussed arecord and got it to record some microphone audio.</p>
<hr />
<div>Hi. <br />
<br />
[[User:Balsa|Balsa]] 03:28, 3 February 2011 (EST)<br />
<br />
<br />
ALSA<br />
/etc/asound.names<br />
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.<br />
<br />
/etc/asound.conf<br />
I do not know what this is currently.<br />
<br />
/etc/asound.state<br />
Ditto.<br />
<br />
strace - handy utility to see what programs are doing.<br />
strace -e file [some program and its args if relevant] - only shows file related stuff.<br />
<br />
arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.<br />
<br />
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)<br />
<br />
strace -e file arecord -v -d 5 -t au test4.au ----> <snip><br />
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip><br />
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.<br />
<br />
grep -i capture -B 1 /etc/asound.names --> <br />
name 'hw:0,4'<br />
comment 'Physical Device - ALC268 Analog (Capture)'<br />
--<br />
name 'plughw:0,4'<br />
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br />
<br />
Hmm.<br />
<br />
Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au<br />
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".<br />
<br />
strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au<br />
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.<br />
<br />
TODO: Look at source code. Edit: nevermind.<br />
<br />
Let's try one more thing - that /etc/asound.names gave me an idea...<br />
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au<br />
Hot dog it worked!<br />
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4<br />
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3<br />
<br />
sox test5.au -d --> Lots of clipping, noisy.<br />
sox au: header size 24 is too small<br />
<br />
Input File : 'test5.au'<br />
Channels : 1<br />
Sample Rate : 8000<br />
Precision : 8-bit<br />
Duration : 00:05.00 = 40000 samples ~ 375 CDDA sectors<br />
Sample Encoding: 8-bit Signed Integer PCM<br />
<br />
100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k<br />
sox effects: rate clipped 120593 samples; decrease volume?<br />
sox sox: alsa: output clipped 61507 samples; decrease volume?<br />
Done.<br />
<br />
Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?<br />
<br />
man sox<br />
<br />
sox -u test5.au -d<br />
sox formats_i: `test5.au': overriding encoding type<br />
Sample Encoding: 8-bit Unsigned Integer PCM<br />
OK, it plays as unsigned 8bit. Success.</div>Balsa