User talk:Balsa

From SlackWiki
Revision as of 08:28, 3 February 2011 by Balsa (talk | contribs) (Discussed arecord and got it to record some microphone audio.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hi.

Balsa 03:28, 3 February 2011 (EST)


ALSA /etc/asound.names

   Gives names and descriptions for ALSA hardware devices.  Very useful when using arecord and its '-D, --device=NAME' command line options.

/etc/asound.conf

   I do not know what this is currently.

/etc/asound.state

   Ditto.

strace - handy utility to see what programs are doing. strace -e file [some program and its args if relevant] - only shows file related stuff.

arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.

sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)

strace -e file arecord -v -d 5 -t au test4.au ----> <snip>

   Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip>
   Very interesting, indeed.  This gives us the default ALSA device used by arecord, in my case it was /dev/snd/pcmC0D0c.  Cross referencing with /etc/asound.names doesn't get us far, because I still don't know the mappings between that file and the stuff in /dev/snd.  Some speculation may be in order.

grep -i capture -B 1 /etc/asound.names -->

               name 'hw:0,4'
               comment 'Physical Device - ALC268 Analog (Capture)'

--

               name 'plughw:0,4'
               comment 'Physical Device With Conversions - ALC268 Analog (Capture)'

Hmm.

Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au This opens /dev/snd/pcmC0D4c, and says "Recording Sparc Audio 'test5.au' : Unsigned 8 bit, Rate 8000 Hz, Mono" but exits with "arecord: set_params:954: Sample format non available".

strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.

TODO: Look at source code. Edit: nevermind.

Let's try one more thing - that /etc/asound.names gave me an idea... strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au Hot dog it worked! open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4 open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3

sox test5.au -d --> Lots of clipping, noisy. sox au: header size 24 is too small

Input File  : 'test5.au' Channels  : 1 Sample Rate  : 8000 Precision  : 8-bit Duration  : 00:05.00 = 40000 samples ~ 375 CDDA sectors Sample Encoding: 8-bit Signed Integer PCM

100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k sox effects: rate clipped 120593 samples; decrease volume? sox sox: alsa: output clipped 61507 samples; decrease volume? Done.

Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?

man sox

sox -u test5.au -d sox formats_i: `test5.au': overriding encoding type Sample Encoding: 8-bit Unsigned Integer PCM OK, it plays as unsigned 8bit. Success.