From owner-freebsd-questions@freebsd.org Wed Dec 13 13:23:17 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609A5E9DDA8; Wed, 13 Dec 2017 13:23:17 +0000 (UTC) (envelope-from onno.k@gmx.com) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE14D705AA; Wed, 13 Dec 2017 13:23:13 +0000 (UTC) (envelope-from onno.k@gmx.com) Received: from [37.48.82.100] ([37.48.82.100]) by 3c-app-mailcom-bs16.server.lan (via HTTP); Wed, 13 Dec 2017 14:23:10 +0100 MIME-Version: 1.0 Message-ID: From: "Onno K." To: Freebsd-multimedia@freebsd.org, freebsd-questions@freebsd.org Subject: How to capture audio with FreeBSD? Content-Type: text/plain; charset=UTF-8 Date: Wed, 13 Dec 2017 14:23:10 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:3xQRxyJRVP8GKUOQeIV/w7Fw9wgVQCrLQMQRdzvfl7l oaLs/VeL0L6aa+cQXhMWO0YTJeQljIIPIpp4j1Urqy/jyAGVoJ v9qHy0p8QCHMz5qpQ4Vqlv5t8KYKWeK0v/NQ5aW+lo/UKs3xNV zUwFRyUqoWOsApoYEGpuHZfwoCcey8Oxi+JsWRpPOPeDRGgZsy M0d2ccFX/EpLMgN6UWiTS/KMvuU1W83W/w0dRspjLdV43i8ZUU XcQelx4tIigQ10DH3RqP2eTByW55X/0bv2iVugjfblvroLPR6G rWPcYo= X-UI-Out-Filterresults: notjunk:1;V01:K0:mE6ibS4/hRU=:VkPG683zPVP6sEDxTPARRr 1G2aMVqoMlw8W4c+lItqiE7yhRXTUWtIo5KqaCNhbdxU+EHMQXR3xR1uJV7Y4hYh9rrTZ1Vsf VRATQfxXrAAPtXagdHeCCqyzoIMVelLeMyoTI1nWFz+Hh9iqfHDLVS9fJz9SPIqoJzHT+YgNQ WIowbYKHkW1wPcSlFY/BzcLMplzOWFUhQZXbXv0w2zrISj4kjGhrWGEXqtl2uj7Ok26vmxNE3 R7/dLoAMmJo4Gww/8AcrSnT72X4Bq8GGyS+ZtYeDx2Vcx9YMtgmRpjey8gGGk+9i7UCJfg6g7 P+SLaXkwMgNYuLpzhSoIKsQWSxssEhq5ROY5ivY5KY9mTLLHsDjq6BFbKnPAxY0I0ZDH35nbF aGIwBe9pplObo5BxGupQgRLXpBg16ZlDBd02UTj2daIHFW/UqtYhXuev1gWUZo6OzL5bHYZzZ Xzl/ApIf9ppmxjIDvmxncNyZ65txMwxfn0IdOsv5LwzFYEQNiDZc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Dec 2017 13:23:17 -0000 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: 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: on uaudio0 uaudio0: HID volume keys found. .. Looks good to me! Additionally, /dev/sndstat reveals: Installed devices: pcm0: (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: at ? kld snd_uaudio (1p:1v/1r:1v) default snddev flags=0x2e6 [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 {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 {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 {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 {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!