# Recording from sound card



## Purple_Q (Dec 26, 2009)

Is there anyway to directly record the sound output of my soundcard? I've been hunting on google like a madman for how to do that.
I always did hate OSS.
Appears to be the most difficult sound system out there.

I'm going into the chiptune market and need to be able to do this. Suggestions fellas?
  --Q


----------



## roddierod (Dec 26, 2009)

Use the vol as the recording source in whatever app you using to record. You need a full duplex sound card.


----------



## Purple_Q (Dec 27, 2009)

I really don't know if my sound card is or not (it's built in to the laptop). Presuming

```
mixer +rec vol
```
doesn't work (i'm using Audacity), and/or I don't have a full duplex card, is there any usb device to assist with this, or is it possible to use some kind of PCMCIA sound card in conjunction with what I already have?
  --Q


----------



## zeiz (Dec 27, 2009)

I guess millions want to know how to do that 
I also did my "homework" but only find this:
Loop "out" to "in" with standard audio cable.
It works fine but no sound on speakers 
Would appreciate better solution.


----------



## Deleted member 9563 (Dec 27, 2009)

No solutions here, but I've seen software to split an audio stream from an internet radio broadcast. It seems to me the solution is the same here. The idea is simply to split the stream. Could tee be used?


----------



## roddierod (Dec 27, 2009)

In Audacity, set the drop down box for recording source to vol.

With the mixer set the rec vol to a low number so you don't clip the signal until you see how things work. Something like:

```
mixer rec 8
```

You may have to adjust the IGain, mine is at 53.

Press the record button on Audcity. This works for me, FreeBSD 8.

I don't use a laptop or usb for sound, so I can't say anything about that.


----------



## zeiz (Dec 27, 2009)

Trying to follow. Cannot find the drop down box to set recording source to *vol*. The only one found contains: Line CD Mic Monitor - that's it.
Also cannot find where to set IGain:

```
$ mixer
Mixer vol      is currently set to  93:93
Mixer pcm      is currently set to  75:75
Mixer rec      is currently set to   8:8
Recording source: cd
$
```


----------



## roddierod (Dec 27, 2009)

That's the drop down I'm talking about. This my mixer output


```
roddierod@atomizer$ mixer
Mixer vol      is currently set to  14:14
Mixer bass     is currently set to  64:64
Mixer treble   is currently set to  98:98
Mixer pcm      is currently set to  91:91
Mixer speaker  is currently set to   0:0
Mixer line     is currently set to  93:93
Mixer mic      is currently set to 100:100
Mixer cd       is currently set to  75:75
Mixer rec      is currently set to   8:8
Mixer igain    is currently set to  53:53
Mixer ogain    is currently set to  26:26
Mixer line1    is currently set to  75:75
Mixer phin     is currently set to   0:0
Mixer phout    is currently set to   0:0
Mixer video    is currently set to   0:0
Recording source: vol
```

Perhaps your sound card isn't capable, not sure.


----------



## zeiz (Dec 27, 2009)

Perhaps. Is it?

```
$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA VIA VT1708B_1 PCM #0 Analog> at cad 0 nid 1 on hdac0 kld snd_hda [MPSAFE] (1p:2v/1r:2v channels duplex default)
pcm1: <HDA VIA VT1708B_1 PCM #1 Digital> at cad 0 nid 1 on hdac0 kld snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex)
pcm2: <HDA NVidia MCP78 HDMI PCM #0 Digital> at cad 3 nid 1 on hdac0 kld snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex)
```


```
$ dmesg (quoted)
hdac0: <NVidia MCP78 High Definition Audio Controller> mem 0xfcf78000-0xfcf7bfff irq 22 at device 7.0 on pci0
hdac0: HDA Driver Revision: 20091113_0138
hdac0: [ITHREAD]
hdac0: HDA Codec #0: VIA VT1708B_1
hdac0: HDA Codec #3: NVidia MCP78 HDMI
pcm0: <HDA VIA VT1708B_1 PCM #0 Analog> at cad 0 nid 1 on hdac0
pcm1: <HDA VIA VT1708B_1 PCM #1 Digital> at cad 0 nid 1 on hdac0
pcm2: <HDA NVidia MCP78 HDMI PCM #0 Digital> at cad 3 nid 1 on hdac0
```


----------



## roddierod (Dec 28, 2009)

```
roddierod@atomizer$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <nVidia nForce4> at io 0x9000, 0x8800 irq 9 bufsz 16384  [MPSAFE] (1p:1v/1r:1v channels duplex default)
roddierod@atomizer$
```

I recall people having issues with the hda driver, but as it doesn't apply to me, I didn't follow it closely


----------



## zeiz (Dec 28, 2009)

Integrated sound chip too? Strange...why I don't have same...
I'll try on another box where SB16-Live! plays. Who knows... I'll report then.


----------



## zeiz (Dec 28, 2009)

well emu10k1 gives more opportunities than hda:

```
$ mixer
Mixer vol      is currently set to  97:97
Mixer pcm      is currently set to  75:75
Mixer speaker  is currently set to  75:75
Mixer line     is currently set to  75:75
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  75:75
Mixer rec      is currently set to   8:8
Mixer igain    is currently set to  97:97
Mixer ogain    is currently set to  50:50
Mixer line1    is currently set to  75:75
Mixer phin     is currently set to   0:0
Mixer phout    is currently set to   0:0
Mixer video    is currently set to  75:75
Recording source: vol
```
Audacity frontend now shows box with *Vol* Line Mic CD Line1 PhoneIn PhoneOut Video. 
Looks good and I tried to record a song from youtube. Audacity shows gorizontal blue line and records a silence. At the same time terminal is full with lines: _PortAudio: read interrupted!_
What I did wrong?


----------



## roddierod (Dec 28, 2009)

I just tried it and did not get the PortAudio errors.

I don't know. The only difference is that I enabled the parametric eq function in the new sound driver.


----------



## Ian_Robinson (Mar 26, 2010)

The likely problem is that Audacity is not configured for your sound card.  If you were to click through the menus (Edit > Preferences) to the "Audio I/O" tab will reveal what Audacity thinks your sound card is.  On mine, for example, the entry was /dev/dsp which was wrong.

To solve the problem:

1.  Find the hidden audacity configuration "dot file" (.audacity) in your home directory. 

2.  Copy it to .audacity.old so you can have it as a back up.

3.  Open .audacity in a text editor.

4.  Find the section labeled [AudioIO] and change the /dev/whatever to the name of your sound device.  For my Intel/AC'97 snd_ich, it was /dev/pcm0.  See the Code box below.  



```
[AudioIO]
PlaybackDevice=/dev/pcm0
RecordingDevice=/dev/pcm0
```

5.  Save the file and restart Audacity.  

6.  Select "Vol" in the pick-box as the sound source.  


Ian Robinson
Salem, Ohio


----------



## Jester_Racer (May 28, 2011)

Ian_Robinson said:
			
		

> 4.  Find the section labeled [AudioIO] and change the /dev/whatever to the name of your sound device.  For my Intel/AC'97 snd_ich, it was /dev/pcm0.  See the Code box below.
> 
> 
> ```
> ...



Hi!

I have a problem: I don't have any pcmX in /dev. 
Here is my *cat /dev/sndstat* output:

```
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA Realtek ALC888 PCM #0 Analog> (play/rec)
pcm1: <HDA Realtek ALC888 PCM #1 Analog> (play/rec) default
pcm2: <HDA Realtek ALC888 PCM #2 Digital> (play)
pcm3: <HDA ATI R6xx HDMI PCM #0 HDMI> (play)
```

So I should have /dev/pcm[0,1,2,3] devices right? But I don't have any of them.
I have only /dev/mixer[0,1,2,3] and /dev/dsp[0.0, 1.0, 2.0, 3.0]

If I select /dev/dsp in audacity, I don't have any vol in the menu. :S
What should I use?


----------



## adamk (May 28, 2011)

Jester_Racer said:
			
		

> Hi!
> 
> I have a problem: I don't have any pcmX in /dev.
> Here is my *cat /dev/sndstat* output:
> ...



There are no /dev/pcm devices.  /dev/dsp* are the correct ones.  Not all sound cards support recording the 'vol' control.  I don't think I've ever seen an HDA card that  supported that option.

You could use OSSv4 from ports and configure it to enable the loopback vmix device.  That will give you a separate /dev/oss/oss_hdaudio0/loop0 that you can record from.

Adam


----------



## Jester_Racer (May 28, 2011)

Thank you for the information.
Seems like my card don't support it either.
I'll try OSS.


----------



## devmazumdar (May 30, 2011)

Jester_Racer said:
			
		

> Thank you for the information.
> Seems like my card don't support it either.
> I'll try OSS.



OSS has a virtual loop back driver called audioloop

http://opensound.hg.sourceforge.net...d426/kernel/drv/oss_audioloop/oss_audioloop.c


----------



## teckk (May 31, 2011)

`$ ffmpeg -f oss -i /dev/dsp0.0 -vn -acodec libmp3lame -ab 128k output.mp3`

Will capture the output of your sound card and encode to 128k .mp3 in the above example.

Turn your record up a little.

You'll also need to start ffmpeg first and then start the media playing or ffmpeg will tell you that the device is busy.


----------



## User7 (May 13, 2015)

`ffmpeg -f oss -i /dev/dsp0.0 -vn -acodec libmp3lame -ab 128k output.mp3`

I do that, is record but in file is no any sound....


----------



## datasmurf (Nov 12, 2015)

`ffmpeg -f oss -i /dev/dsp -vn -ab 128k output.ogg`
Set the correct dsp device. Then it will work.


----------

