Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2017 21:33:07 +0800
From:      blubee blubeeme <gurenchan@gmail.com>
To:        "Onno K." <onno.k@gmx.com>
Cc:        Freebsd-multimedia@freebsd.org, FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: How to capture audio with FreeBSD?
Message-ID:  <CALM2mE=1AYS%2BwNaO3a42VxQwGHzFBrQNskpaJSVaQFguXeVEHg@mail.gmail.com>
In-Reply-To: <trinity-b639b15a-c1a2-426d-b47a-69ab299dbcc3-1513171390323@3c-app-mailcom-bs16>
References:  <trinity-b639b15a-c1a2-426d-b47a-69ab299dbcc3-1513171390323@3c-app-mailcom-bs16>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 13, 2017 at 9:23 PM, Onno K. <onno.k@gmx.com> wrote:

> Dear list,
>
> I have got my Raspberry Pi 3 (ARM64) working with FreeBSD 12-CURRENT -
> cool stuff!
>
> Though I believe this to be unrelated to the RPi, I cannot figure out how
> to capture audio with it. The RPi only has audio output and no input, so I
> am using a simple USB-dongle audio device that has both input and output.
> It is recognised as following by FreeBSD 12-CURRENT Nov 30 2017 snapshot:
>
>
> ..
> uaudio0 on uhub1
> uaudio0: <vendor 0x0d8c C-Media USB Audio Device, class 0/0, rev
> 1.10/1.00, addr 4> on usbus0
> uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Play: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Record: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Record: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: No MIDI sequencer.
> pcm0: <USB audio> on uaudio0
> uaudio0: HID volume keys found.
> ..
>
>
> Looks good to me! Additionally, /dev/sndstat reveals:
>
>
> Installed devices:
> pcm0: <USB audio> (play/rec) default
> No devices installed from userspace.
>
>
> A more verbose /dev/sndstat reads:
>
>
> # sysctl hw.snd.verbose=2
> hw.snd.verbose: 0 -> 2
> # cat /dev/sndstat
> FreeBSD Audio Driver (64bit 2009061500/aarch64)
> Installed devices:
> pcm0: <USB audio> at ? kld snd_uaudio (1p:1v/1r:1v) default
>         snddev flags=0x2e6<AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,
> REGISTERED,VPC>
>         [pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100,
> 0x00000004
>         interrupts 0, underruns 0, feed 0, ready 0
> [b:3072/1536/2|bs:4096/2048/2]
>         channel flags=0x2100<BUSY,HAS_VCHAN>
>         {userland} -> feeder_mixer(0x00200010) -> {hardware}
>         pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 8000, fmt
> 0x00100008, flags 0x10000000, 0x00000000
>         interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:0/0/0]
>         channel flags=0x10000000<VIRTUAL>
>         {userland} -> feeder_root(0x00000000) -> {hardware}
>         [pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010/0x00100010, flags
> 0x00002100, 0x00000045
>         interrupts 0, overruns 0, feed 0, hfree 1536, sfree 4096
> [b:1536/768/2|bs:4096/2048/2]
>         channel flags=0x2100<BUSY,HAS_VCHAN>
>         {hardware} -> feeder_root(0x00100010) -> feeder_matrix(1.0 -> 2.0)
> -> feeder_mixer(0x00200010) -> {userland}
>         pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt
> 0x00100008, flags 0x10000000, 0x00000000
>         interrupts 0, overruns 0, feed 0, hfree 0, sfree 0
> [b:0/0/0|bs:0/0/0]
>         channel flags=0x10000000<VIRTUAL>
>         {hardware} -> feeder_root(0x00000000) -> {userland}
> No devices installed from userspace.
>
>
> On Linux platform, I had success with capturing audio using the same
> hardware using the 'aplay' and 'arecord' tools from the ALSA library. So
> the hardware works, on Linux, but not on FreeBSD. It appears not to detect
> the sound card:
>
>
> # aplay -l
> aplay: device_list:273: no soundcards found...
> # arecord -l
> arecord: device_list:273: no soundcards found...
>
>
> So at first glance, ALSA does not work (out of the box, after installing
> pkg) with FreeBSD. But 'alsamixer' does appear to work, since the volume
> buttons on the USB dongle would affect the sound level in alsamixer.
>
> Now my questions:
> -> Does ALSA even work in FreeBSD or is any configuration required to get
> it to work?
> -> How can one capture audio on FreeBSD?
> -> Any hints in general on how to proceed?
>
> Addendum:
> -> The handbook was not very useful to me. Nothing about capturing audio
> mentioned: https://www.freebsd.org/doc/handbook/sound-setup.html.
> -> I did read something about being able to use 'dd' to directly capture
> audio to a file. Any examples on such a command would be appreciated, as my
> simple 'dd if=/dev/dsp of=test.wav' did not work properly for me.
>
> Thanks for any help!
> _______________________________________________
> freebsd-multimedia@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-multimedia
> To unsubscribe, send any mail to "freebsd-multimedia-
> unsubscribe@freebsd.org"
>

Try this, install audio/oss from ports
then use ossrecord app to record from the detected audio recording device.

on my device running ossinfo returns this:
ossinfo
Version info: FreeBSD native OSS ABI 1200054 (0x00040000) BSD
Platform: FreeBSD/amd64 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r326056: Tue
Nov 21 14:54:55 UTC 2017
root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
(blubee)

Number of audio devices: 10
Number of audio engines: 10
Number of MIDI devices: 0
Number of mixer devices: 3


Device objects
 0: pcm0 Realtek ALC899 (Analog)
    on hdaa0
 1: pcm1 Realtek ALC899 (Rear Analog Line-out)
    on hdaa0
 2: pcm2 Realtek ALC899 (Rear Digital)
    on hdaa0

MIDI devices (/dev/midi*)

Mixer devices
 0: pcm0:mixer (Mixer 0 of device object 0)
 1: pcm1:mixer (Mixer 0 of device object 1)
 2: pcm2:mixer (Mixer 0 of device object 2)

Audio devices
pcm0:play:dsp0.p0                 /dev/dsp0.p0  (device index 0)
pcm0:virtual:dsp0.vp0             /dev/dsp0.vp0  (device index 1)
pcm0:virtual:dsp0.vp1             /dev/dsp0.vp1  (device index 2)
pcm0:virtual:dsp0.vp2             /dev/dsp0.vp2  (device index 3)
pcm0:record:dsp0.r0               /dev/dsp0.r0  (device index 4)
pcm0:virtual:dsp0.vr0             /dev/dsp0.vr0  (device index 5)
pcm1:play:dsp1.p0                 /dev/dsp1.p0  (device index 6)
pcm1:virtual:dsp1.vp0             /dev/dsp1.vp0  (device index 7)
pcm2:play:dsp2.p0                 /dev/dsp2.p0  (device index 8)
pcm2:virtual:dsp2.vp0             /dev/dsp2.vp0  (device index 9)

give that a shot and report back.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALM2mE=1AYS%2BwNaO3a42VxQwGHzFBrQNskpaJSVaQFguXeVEHg>