User talk:Balsa: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Discussed arecord and got it to record some microphone audio.)
 
m (some formatting cleanup)
Line 4: Line 4:




ALSA
 
/etc/asound.names
== ALSA ==
 
/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.
     Gives names and descriptions for ALSA hardware devices.  Very useful when using arecord and its '-D, --device=NAME' command line options.


/etc/asound.conf
/etc/asound.conf<br/>
     I do not know what this is currently.
     I do not know what this is currently.


/etc/asound.state
/etc/asound.state<br/>
     Ditto.
     Ditto.


Line 21: Line 23:
sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)
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>
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>
     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.
     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  -->   
grep -i capture -B 1  /etc/asound.names  -->  <br/>
                 name 'hw:0,4'
                 name 'hw:0,4'<br/>
                 comment 'Physical Device - ALC268 Analog (Capture)'
                 comment 'Physical Device - ALC268 Analog (Capture)'<br/>
--
--<br/>
                 name 'plughw:0,4'
                 name 'plughw:0,4'<br/>
                 comment 'Physical Device With Conversions - ALC268 Analog (Capture)'
                 comment 'Physical Device With Conversions - ALC268 Analog (Capture)'<br/>


Hmm.
Hmm.


Lets try: strace -e file arecord -v -d 5 -t au  -D hw:0,4  test5.au
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".
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
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.
Same deal, but opens /dev/snd/pcmC0D0c instead.  Strange, since that is the same as the default.


TODO:  Look at source code.  Edit: nevermind.
TODO:  Look at source code.  Edit: nevermind.


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


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


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


100%  00:05.00 [00:00.00] of 00:05.00 Out:240k  [!=====|=====!]Hd:0.0 Clip:182k
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?
sox effects: rate clipped 120593 samples; decrease volume?<br/>
sox sox: alsa: output clipped 61507 samples; decrease volume?
sox sox: alsa: output clipped 61507 samples; decrease volume?<br/>
Done.
Done.<br/>


Aha!  The recording is unsigned 8bit, but the playback was signed 8bit.  How does one change this?
Aha!  The recording is unsigned 8bit, but the playback was signed 8bit.  How does one change this?
Line 67: Line 69:
man sox
man sox


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

Revision as of 03:36, 4 February 2011

Hi.

Balsa 03:28, 3 February 2011 (EST)


ALSA

/etc/asound.names

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

/etc/asound.conf

   I do not know what this is currently.

/etc/asound.state

   Ditto.

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

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

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

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

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

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

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

--

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

Hmm.

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

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

TODO: Look at source code. Edit: nevermind.

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

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

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

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

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

man sox

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