DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD General

NetBSD General Other questions regarding NetBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
Old 4th October 2018
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Fdisk Soldier
 
Join Date: Oct 2017
Location: Rome
Posts: 82
Default

Quote:
Originally Posted by Simurghiyan View Post
A truly fascinating thread with some real surprises --thank you.
But it's nearly 2019, three years after the OP; NetBSD exists still and I'm quite happy with it as a workaday OS. AFAIK, no Code of Conduct dramas, no 'init dramas' ... just a very nice solid system (and to my mind the only probable heir to BSD-lite's 4.4's crown and sceptre). Can easily use it on the pi bramble too.
I completely agree with you; NetBSD is terribly alluring, just so fun, just so: think out of the box, and to my mind the most true to the 386BSD/4.4BSD-lite inheritance.
To add something to this thread, as of 8.0, NetBSD OSS sound subsystem has been heavily reshaped. we now happily have in-kernel mixing, audio(4). It would be one day good on the other hand, to see it completely replaced with a modern OSSv4 implementation like Illumos Boomer

Quote:
Apologies for the necro, if people here object to such things.
I don't think necro is a mustn't here but purposely going off-topic withing the same thread and diverting focus on a different subject surely is (which is not what I think you did here).


EDIT: by the way, welcome
__________________
Be the change you want to see in the World
Reply With Quote
Old 5 Days Ago
bashrules bashrules is offline
Fdisk Soldier
 
Join Date: Mar 2010
Location: Here
Posts: 56
Default

We have now an in-kernel mixer in NetBSD 9, don't we?

One user can nicely mix various audio streams. That does not work over several users. One user's audio stream blocks other users' audio streams.

Is there a way to mix every user's audio stream?
Reply With Quote
Old 5 Days Ago
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Fdisk Soldier
 
Join Date: Oct 2017
Location: Rome
Posts: 82
Default

Quote:
Originally Posted by bashrules View Post
We have now an in-kernel mixer in NetBSD 9, don't we?
Yes, as I stated above NetBSD's audio(4) sound subsystem is based on Solaris SunAudio API, which differs from traditional OSSv3 implementations, in the way it just passes one struct to the kernel (see AUDIO_SETINFO ioctl), and provides a simple and well-documented backend (everything on the software side is done the traditional way, which implies opening a pseudodevice /dev/audio – a hardware abstraction layer – for r/w operations), characterized by low-latency, low-cpu-usage and possibly cross-platform (Illumos?). It's been reworked for 8.0 and further improved across the transition towards 9.x to provide kernel built-in hardware-level mixing functionalities, thus substantially differing from other Unices where this task is typically left to userspace-level sound servers (well, you can do mixing on Linux with ALSA plugins like dmix, but it's just 'meh' – complex to set up and adapt to various scenarios, quite resource intensive, poor results, and, as if this wasn't already enough, applications are deprecating it –).

The rework also introduced a nice set of tunable sysctl values (e.g. hw.audioX.blk_ms for latency).
Quote:
One user can nicely mix various audio streams.
Yes! and it works really well. One can easily switch from let's say a MPD client or cmus to a YouTube video on a browser during playback without either of the two taking full control of /dev/audio (which would prevent other applications from using it) or even mix multiple sound sources without the need of a software-level sound server. Patches for Firefox and Seamonkey enabling them to use audio(4) as backend for cubeb have been upstreamed by nia@ last year, and now this is default on pkgsrc. I use Seamonkey with the native API as backend and I must say I'm really satisfied with the results.
Naturally this doesn't prevent anybody from using JACK2, Pulseaudio or Nas in more complex scenarios.
Quote:
That does not work over several users. One user's audio stream blocks other users' audio streams.
Where did you read this? AFAICT multiuser stream was part of the new audio mixer specification; in fact..
Quote:
Is there a way to mix every user's audio stream?
should be as easy as:

Code:
$ sysctl -w hw.audio0.multiuser=1 # (default is '0') 
 
$ echo 'hw.audio0.multiuser=1' >> /etc/sysctl.conf
__________________
Be the change you want to see in the World

Last edited by Sensucht94; 5 Days Ago at 07:40 AM. Reason: fix formatting
Reply With Quote
Old 3 Days Ago
bashrules bashrules is offline
Fdisk Soldier
 
Join Date: Mar 2010
Location: Here
Posts: 56
Default

Hello Sensucht,

Quote:
Originally Posted by Sensucht94 View Post
Yes, as I stated above NetBSD's audio(4) sound subsystem is based on Solaris SunAudio API, which differs from traditional OSSv3 implementations, in the way it just passes one struct to the kernel (see AUDIO_SETINFO ioctl), and provides a simple and well-documented backend (everything on the software side is done the traditional way, which implies opening a pseudodevice /dev/audio – a hardware abstraction layer – for r/w operations), characterized by low-latency, low-cpu-usage and possibly cross-platform (Illumos?).
Not necessarily an important question, but why don't I see /dev/audio opened?

Code:
# lsof -p `pgrep mpg123`
COMMAND  PID     USER   FD   TYPE DEVICE   SIZE/OFF     NODE NAME
mpg123  3882 bashrules cwd   VDIR   20,0       4096 41027584 /home/bashrules
mpg123  3882 bashrules txt   VREG    0,0     113920  1369211 /usr/local/bin/mpg123
mpg123  3882 bashrules txt   VREG    0,0       8160  1588547 /usr/local/lib/mpg123/output_sun.so
mpg123  3882 bashrules txt   VREG    0,0    2079944  6587525 /lib/libc.so.12.213
mpg123  3882 bashrules txt   VREG    0,0     208424  6587561 /lib/libm.so.0.12
mpg123  3882 bashrules txt   VREG    0,0      56408  1369224 /usr/local/lib/libout123.so.0.2.2
mpg123  3882 bashrules txt   VREG    0,0     206608  1369219 /usr/local/lib/libmpg123.so.0.44.10
mpg123  3882 bashrules txt   VREG    0,0     164176 10465283 /libexec/ld.elf_so
mpg123  3882 bashrules   0u  VCHR    5,5 0t51287932       13 /dev/pts/5
mpg123  3882 bashrules   1u  VCHR    5,5 0t51287932       13 /dev/pts/5
mpg123  3882 bashrules   2u  VCHR    5,5 0t51287932       13 /dev/pts/5
mpg123  3882 bashrules   3r  VREG   11,3   29374214 10469628 beethoven-symphony01.mp3
mpg123  3882 bashrules   4w                                  0xffffe866a7a3bcc0 file struct, ty=5, op=0xffffffff8102b9e0
Quote:
Originally Posted by Sensucht94 View Post
It's been reworked for 8.0 and further improved across the transition towards 9.x to provide kernel built-in hardware-level mixing functionalities, thus substantially differing from other Unices where this task is typically left to userspace-level sound servers (well, you can do mixing on Linux with ALSA plugins like dmix, but it's just 'meh' – complex to set up and adapt to various scenarios, quite resource intensive, poor results, and, as if this wasn't already enough, applications are deprecating it –).
I like the idea of an in-kernel mixer.


Quote:
Originally Posted by Sensucht94 View Post
The rework also introduced a nice set of tunable sysctl values (e.g. hw.audioX.blk_ms for latency). Yes! and it works really well. One can easily switch from let's say a MPD client or cmus to a YouTube video on a browser during playback without either of the two taking full control of /dev/audio (which would prevent other applications from using it) or even mix multiple sound sources without the need of a software-level sound server.
I should have looked for sysctl tunables by myself :-/ Now, multiple users can stream audio at the same time!


Quote:
Originally Posted by Sensucht94 View Post
Patches for Firefox and Seamonkey enabling them to use audio(4) as backend for cubeb have been upstreamed by nia@ last year, and now this is default on pkgsrc. I use Seamonkey with the native API as backend and I must say I'm really satisfied with the results.
I have 3 major sources of audio: mpg123, xmms (ouch) and firefox68. mpg123 and xmms use the sunaudio plugin.

I don't understand the situation in firefox. It's built with --disable-pulseaudio --disable-alsa --with-oss. So it uses oss? It compiles in cubeb_sun.c. So it uses sunaudio?
Reply With Quote
Old 2 Days Ago
bashrules bashrules is offline
Fdisk Soldier
 
Join Date: Mar 2010
Location: Here
Posts: 56
Default

One problem at a time. Now that mixing over all users work, I will attack my next problem. Every 10 to 100 min, the sound distorts (hard to describe). I can only recover audio by restarting all audio streams. Is anyone else running into this problem or am I alone?


My hardware:

From dmesg
Code:
hdaudio0 at pci0 dev 27 function 0: HD Audio Controller
hdaudio0: interrupting at msi0 vec 0
hdafg0 at hdaudio0: vendor 14f1 product 50a1
hdafg0: DAC00 2ch: Speaker [Jack]
hdafg0: ADC01 2ch: Mic In [Jack]
hdafg0: ADC02 2ch: Line In [Jack], Mic In [Jack]
hdafg0: DAC03 2ch: HP Out [Jack]
hdafg0: 2ch/2ch 44100Hz 48000Hz 96000Hz PCM16 PCM20 PCM24 AC3
audio0 at hdafg0: playback, capture, full duplex, independent
audio0: slinear_le:16 2ch 48000Hz, blk 4ms for playback
audio0: slinear_le:16 2ch 48000Hz, blk 4ms for recording
spkr1 at audio0: PC Speaker (synthesized)
wsbell at spkr1 not configured
hdafg1 at hdaudio0: vendor 8086 product 2805
hdafg1: DP00 8ch: Digital Out [Jack]
hdafg1: 8ch/0ch 48000Hz PCM16*
From lspci (27=0x1b)

Code:
$ lspci -vvs 0:1b.0
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
	Subsystem: Dell Device 04ed
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 5
	Region 0: Memory at fe400000 (64-bit, non-prefetchable)
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee00000  Data: 0070
	Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag- RBE-
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
	Capabilities: [100 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=01
			Status:	NegoPending- InProgress-
		VC1:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=1 ArbSelect=Fixed TC/VC=22
			Status:	NegoPending- InProgress-
	Capabilities: [130 v1] Root Complex Link
		Desc:	PortNumber=0f ComponentID=00 EltType=Config
		Link0:	Desc:	TargetPort=00 TargetComponent=00 AssocRCRB- LinkType=MemMapped LinkValid+
			Addr:	00000000fed1c000

A starting point is enabling debugging output by recompling the audio driver with these options

Code:
options 	HDAUDIOVERBOSE	# verbose HDAUDIO driver messages
options HDAUDIO_DEBUG
options HDAFG_DEBUG
That would be so simple if the default kernel was built modular and not as a giant blob. Grrrr.

Is there a debugging infra for the netbsd kernel? If not, I'll probably go for the follow-up step with some sort of printk equivalent.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Underlegend Networks - NetBSD free shell server muflon Off-Topic 1 8th September 2015 01:53 PM
[Link][HowTo] Setting up an 8TB NetBSD file server s0xxx Guides 0 20th August 2011 10:42 AM
Recording sound with external sound card backrow OpenBSD General 5 21st August 2009 08:17 PM
Convertin A Ubuntu ssh/ Samba server to NetBSd FloridaBSD FreeBSD General 6 24th May 2008 09:35 AM


All times are GMT. The time now is 03:37 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick