Solved How to record audio from computer

I try desperately to record audio from my computer, but it seems impossible.

here is output from mixer(8):
Code:
Mixer vol  is currently set to  50:50
Mixer pcm  is currently set to  90:90
Mixer speaker  is currently set to  50:50
Mixer line  is currently set to  50:50
Mixer mic  is currently set to  67:67
Mixer mix  is currently set to  74:74
Mixer rec  is currently set to 100:100
Mixer igain  is currently set to  78:78

cat /dev/sndstat:

Code:
pcm0: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm4: <Realtek ALC1200 (Rear Analog 7.1/2.0)> (play/rec) default
pcm5: <Realtek ALC1200 (Front Analog)> (play/rec)
pcm6: <Realtek ALC1200 (Rear Digital)> (play)
pcm7: <Realtek ALC1200 (Onboard Digital)> (play)

sysctl.config
Code:
hw.snd.default_unit=4
dev.pcm.4.play.vchans=4
dev.pcm.4.rec.vchans=4

/boot/loader.conf
Code:
sound_load="YES"
snd_driver_load="YES"
snd_uaudio_load="YES"
speaker_load="YES"


cat /boot/device.hints
Code:
hint.hdaa.0.nid20.config="as=3 seq=0"
hint.hdaa.0.nid26.config="as=2 seq=14"
hint.hdaa.0.nid25.config="as=2 seq=15"
hint.hdaa.0.nid33.config="as=3 seq=15"

The sound works perfectly for reading. Regarding the recording, it's been several days since I tear my hair.

Can someone help me please?
 
The simplest player and record is still cat of course: cat /dev/dspW > bla; cat bla > /dev/dspW

Also nice to check if you've setup the default recording source correctly: cat /dev/dspW > /dev/dspW
 
What is the recording source you're trying to use, line-in, microphone? Or are you trying to record the sounds that are playing back from an audio player or some other application?
 
No, still nothing. Currently, I have in my audio mixer(xfce) 2 tabs that appears
  1. [Playback] with Volume, pcm, record and in-gain
  2. [Capture] with Speaker, line-in, Microphone, Mixer
all that is in the capture tab does not work, because everything is off and I can not activate one of them.

If I remove these lines in sysctl.conf

Code:
dev.pcm.4.play.vchans=4
dev.pcm.4.rec.vchans=4

The capture tab disappears
 
# cat /dev/sndstat give me this result:

Code:
pcm0: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm4: <Realtek ALC1200 (Rear Analog 7.1/2.0)> (play/rec) default
pcm5: <Realtek ALC1200 (Front Analog)> (play/rec)
pcm6: <Realtek ALC1200 (Rear Digital)> (play)
pcm7: <Realtek ALC1200 (Onboard Digital)> (play)

and by doing # apropos Realtek ALC1200

Code:
re(4)  - RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver
rgephy(4)  - RealTek RTL8168/8169/8110/8211 series 10/100/1000 Gigabit Ethernet PHY driver
rl(4)  - RealTek 8129/8139 Fast Ethernet device driver
rsu(4)  - Realtek RTL8188SU/RTL8192SU USB IEEE 802.11b/g/n wireless network device
rsufw(4)  - Firmware Module for Realtek driver
rue(4)  - RealTek RTL8150 USB to Fast Ethernet controller driver
urtw(4)  - Realtek RTL8187B/L USB IEEE 802.11b/g wireless network device
urtwn(4)  - Realtek RTL8188CU/RTL8188RU/RTL8188EU/RTL8192CU USB IEEE 802.11b/g/n wireless network device
urtwnfw(4)  - Firmware Module for Realtek Wireless driver
ALC1200: nothing appropriate

Is not there a driver problem?
 
It looks like your system has allocated 2 analog recording sources: Rear/pcm4 and Front/pcm5
pcm4: <Realtek ALC1200 (Rear Analog 7.1/2.0)> (play/rec) default
pcm5: <Realtek ALC1200 (Front Analog)> (play/rec)

Your setup presently should be recording from the rear input jack pcm4. A simple test would be to set the default to pcm5 and try to record on the front jack.

If it is just a matter of selecting the active jack, you would have two long term options: Toggle the recording source or group the front recording jack with the rear line-out jack.
 
Aaah, you don't see that last line from mixer?
Code:
$ mixer
Mixer vol  is currently set to 100:100
...
Recording source: line
Any different with mixer -f /dev/mixer5 ?

Juha
 
No Sound when i switch to pcm5
Toggle the recording source or group the front recording jack with the rear line-out jack.
How to do that?

Herer is the output from # mixer -f /dev/mixer5

Code:
Mixer vol  is currently set to  75:75
Mixer pcm  is currently set to  63:63
Mixer rec  is currently set to  70:70
Mixer igain  is currently set to  81:81
Mixer monitor  is currently set to  62:62
Recording source: monitor

But monitor is off and cannot activate
 
mixer5 shows a recording source. 4 doesn't. Both are play/rec in sndstat. Funny.

The whizz bang XFCE mixer might be causing unnecessary trouble, so could the hint.hdaa lines, unless you know better. I would remove all changes, reboot, take a long walk, and start by checking what is what in default conditions. ps ax > /dev/dsp4 etc should buzz a little, or a lot, when playback settings are changed. cat -vet /dev/dsp5 etc should show flowing junk, which changes as you change record settings. Maybe you know all this already.

Juha


BTW, what happens when there is only one recording source in a dsp device? Would that surprise some program so much to make it misbehave?
 
Maybe you know all this already.

No, i'm a nub

I put everything to zero, just loading snd_driver and hw.snd.default_unit=5

ps ax > /dev/dsp4 etc should buzz a little

yes

cat -vet /dev/dsp5 etc should show flowing junk

give me this kind of response:

Code:
~~~~~~~~~~~}~~~~~}}~~~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}~~~~}~~~~~~~}~~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}~~}~}~~~~~~~~~~~~~~~~}~}~~~}~~}}~~~~~~~~~~~~}~~~~~~~~~~~~~~~~~~~~~~~~}~}}~~~~~~~~}~~~}}~~~~~~~~~}~}}~~~~~~~~}~~~}~~}~~~~~~~~~~~~~~~}~~~~~~}}~~~~}~}~~~~~~~~~~~~~~~}}~}~~~}}}}}}}~}}}~~~}}~}}}~~}}~}~~~~~~~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}~~}~~~~~~~}~~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~}~~}~~~~~~~~~~~~~~~~~~~~~~~~~~~~}~~~~~~~~~}~~}~}~~~~~~~~~~~~~~~~~~~~}~~}~~~~~~~~~~~~~~~~~~~~~~~}~~~}~~~~~~~~~~~~~~~~

and I have no sound with pcm5
 
I put everything to zero, just loading snd_driver and hw.snd.default_unit=5

If you are running FreeBSD 10.*, you do not need to load snd_driver. The realtek 1200 driver is based on snd_hda and in FreeBSD 10.0 and above snd_hda is statically compiled into the generic kernel.

Recording source: monitor

Usually "monitor" implies a laptop with a built-in mic at the top of the screen bezel.
 
Can you supply the make and model of your system on the off chance someone has already worked this out. Also your pin assignments with # sysctl -a | grep hda
 
In order to help you, it is necessary to know where you are plugging the mic into: your dmesg says you have front and rear audio. The rear green jack is nid24 and the front is nid25. If the cables are not hooked up to nid25, it will still show in the system messages but not function.
Can you supply the make and model of your system
 
I don't have a microphone. Just 2 speakers + basse box on the green. But what i want is recording the sound from the line-in, sound from internet, from my computer to a file.
According to man pages examples i do this:
Code:
hint.hdac.4.cad4.nid20.config="as=1"
hint.hdac.4.cad4.nid31.config="as=2"
that works but i don't understand everything - (cad and as). and i put this in sysctl
Code:
hw.snd.verbose=1
hw.snd.default_unit=4
dev.pcm.4.play.vchanformat=s16le:3.0
this is all the config i put for the moment. when i record with audacity on line source i just have buzz
Here is a part of the command # sysctl -a | grep hdaa4
Code:
hdaa4: nid  0x  as seq device  conn  jack  loc  color  misc
hdaa4: 17 99430140 4  0  SPDIF-out  Fixed ATAPI  Onboard  Unknown 1
hdaa4: 20 01014010 1  0  Line-out  Jack  1/8  Rear  Green  0
hdaa4: 21 01011012 1  2  Line-out  Jack  1/8  Rear  Black  0
hdaa4: 22 01016011 1  1  Line-out  Jack  1/8  Rear  Orange  0
hdaa4: 23 01012014 1  4  Line-out  Jack  1/8  Rear  Grey  0
hdaa4: 24 01a19850 5  0  Mic  Jack  1/8  Rear  Pink  8
hdaa4: 25 02a19c60 6  0  Mic  Jack  1/8  Front  Pink  12
hdaa4: 26 0181305f 5  15 Line-in  Jack  1/8  Rear  Blue  0
hdaa4: 27 02214c20 2  0  Headphones  Jack  1/8  Front  Green  12
hdaa4: 28 593301f0 15 0  CD  None  ATAPI  Onboard  Unknown 1
hdaa4: 29 4015e601 0  1  Speaker  None  Optical 0x00  White  6
hdaa4: 30 01447130 3  0  SPDIF-out  Jack  RCA  Rear  Yellow  1
hdaa4: 31 411111f0 15 0  Speaker  None  1/8  Rear  Black  1
hdaa4: Patching widget caps nid=29 0x00400000 -> 0x00700000
hdaa4: Patched pins configuration:
hdaa4: nid  0x  as seq device  conn  jack  loc  color  misc
hdaa4: 17 99430140 4  0  SPDIF-out  Fixed ATAPI  Onboard  Unknown 1
hdaa4: 20 01014010 1  0  Line-out  Jack  1/8  Rear  Green  0
hdaa4: 21 01011012 1  2  Line-out  Jack  1/8  Rear  Black  0
hdaa4: 22 01016011 1  1  Line-out  Jack  1/8  Rear  Orange  0
hdaa4: 23 01012014 1  4  Line-out  Jack  1/8  Rear  Grey  0
hdaa4: 24 01a19850 5  0  Mic  Jack  1/8  Rear  Pink  8
hdaa4: 25 02a19c60 6  0  Mic  Jack  1/8  Front  Pink  12
hdaa4: 26 0181305f 5  15 Line-in  Jack  1/8  Rear  Blue  0
hdaa4: 27 02214c20 2  0  Headphones  Jack  1/8  Front  Green  12
hdaa4: 28 593301f0 15 0  CD  None  ATAPI  Onboard  Unknown 1 DISA
hdaa4: 30 01447130 3  0  SPDIF-out  Jack  RCA  Rear  Yellow  1
hdaa4: 31 411111f0 15 0  Speaker  None  1/8  Rear  Black  1 DISA
 
hint.hdac.4.cad4.nid20.config="as=1"
hint.hdac.4.cad4.nid31.config="as=2"

that works but i don't understand everything - (cad and as). and i put this in sysctl

"as" can be considered as group of pins that are associated. Groupings are either disable (as=0), outputs (line-out, speakers) or inputs (mic, line-in). A grouping cannot be both an input and an output. There is more detail in snd_hda(4)
 
Suggestion:
1) Review snd_hda(4)
2) Make your default sound unit pcm4 as described in section 7.2.3 of the handbook.
3) nid20 is the green output jack in the back of your system. Leave it alone.
4) nid27 is the front headphone jack. Assign it the same association as nid20 (as=1) and a sequence of 15 (seq=15). A seq=15 will sense the jack and mute the lower nid in that association.
5) Decide which microphone jack you want to use (Front/nid25 or Rear/nid24) Assign it as the default hdac.0 with an as=2.

Code summary:
/etc/sysctl.conf
Code:
hw.snd.default_unit=4


/boot/device.hints

Code:
hint.hdaa.4.nid27.config="as=1 seq=15    device=Headphones"
hint.hdaa.4.nid25.config="as=2 seq=15    device=mic"



Note that the seq value for nid25 determines whether it is mixed (15) or multiplexed (14) and from the man page
hint.hdac.%d.cad%d.nid%d.config
Same as hint.hdaa.%d.nid%d.config
Edit changed hints from device 0 -> 4
 
Back
Top