Re: aucat -c playback channels confusion

2021-05-25 Thread Alexandre Ratchov
On Tue, May 25, 2021 at 03:45:17PM +0200, Jan Stary wrote:
> This is current/amd64. I am trying to use the -c option of aucat,
> specifying the channels to be played from a multichannel file.
> 
> As an example, here is a quad audio file produced by sox:
> 
> $ sox -n -b 16 quad.wav synth 10 sin 200 sin 300 sin 400 sin 600 gain -6
> $ soxi quad.wav
> 
> Input File : 'quad.wav'
> Channels   : 4
> Sample Rate: 48000
> Precision  : 16-bit
> Duration   : 00:00:10.00 = 48 samples ~ 750 CDDA sectors
> File Size  : 3.84M
> Bit Rate   : 3.07M
> Sample Encoding: 16-bit Signed Integer PCM
> 
> 
> Now trying to use aucat -c to play the individual channels
> doesn't seem to do what it says:
> 
> $ aucat -dd -c 0:0 -i quad.wav
> quad.wav: skipped unknown chunk
> quad.wav,pst=cfg: play, chan 0:3, 48000Hz, s16le, bytes 80..3840080, vol 32768
> default: 48000Hz, play 0:3, 36 blocks of 480 frames
> quad.wav,pst=cfg: allocated 17280 frame buffer
> cmap: nch = 4, ostart = 0, onext = 0, istart = 0, inext = 0
> quad.wav,pst=ini: chain initialized
> quad.wav,pst=run: started
> started
> ^Cquad.wav,pst=ini: stopped
> stopped
> quad.wav,pst=ini: closed
> 
> 
> Indeed quad.wav has channels 0:3, but why does auact play channels 0:3
> with -c 0:0 specified? Specifying other channels seem even more confusing:
> 
> $ aucat -dd -c 2:2 -i quad.wav
> quad.wav: skipped unknown chunk
> quad.wav,pst=cfg: play, chan 2:5, 48000Hz, s16le, bytes 80..3840080, vol 32768
> default: 48000Hz, play 0:5, 36 blocks of 480 frames
> quad.wav,pst=cfg: allocated 17280 frame buffer
> cmap: nch = 4, ostart = 2, onext = 0, istart = 0, inext = 0
> quad.wav,pst=ini: chain initialized
> quad.wav,pst=run: started
> started
> ^Cquad.wav,pst=ini: stopped
> stopped
> quad.wav,pst=ini: closed
> 
> Now it considers quad.wav to have channels 2 to 5
> and it plays channels 0:5, given -c 2:2.
> 
> Maybe I am misunderstanding the -c option
> (or what the -dd messages say):
> 
>   -c min:max The range of audio file channel numbers.
>  The default is 0:1, i.e. stereo.
> 
> When playing a file with aucat -i, does that mean
> "use these channels from the file"?
> 
> If not, how does one specify "play just channel 2, out of 0,1,2,3"?
> 
> There is a chunk that aucat skips; this is what sndfile-info says:
> 
> File : quad.wav
> Length : 384080
> RIFF : 384072
> WAVE
> fmt  : 40
>   Format: 0xFFFE => WAVE_FORMAT_EXTENSIBLE
>   Channels  : 4
>   Sample Rate   : 48000
>   Block Align   : 8
>   Bit Width : 16
>   Bytes/sec : 384000
>   Valid Bits: 16
>   Channel Mask  : 0x33 (L, R, Ls, Rs)
>   Subformat
> esf_field1 : 0x1
> esf_field2 : 0x0
> esf_field3 : 0x10
> esf_field4 : 0x80 0x0 0x0 0xAA 0x0 0x38 0x9B 0x71 
> format : pcm
> fact : 4
>   frames  : 48000
> data : 384000
> End
> 
> 
> Sample Rate : 48000
> Frames  : 48000
> Channels: 4
> Format  : 0x00130002
> Sections: 1
> Seekable: TRUE
> Duration: 00:00:01.000
> Signal Max  : 16424 (-6.00 dB)
> 
> 
> With 1 second instead of 10 seconds of audio (synth 1) the file
> is small enough, I am attaching it.
> 
> Thanks for any clue.
> 

Hi,

The -c, -e, and -r options are used to specify file's channels,
encoding and rate in case they are undefined, typically for raw data
files. The .wav file header of quad.wav contains the number of
channels (but not the initial channel). So, in your example, the
number of channel is taken from the .wav header, that's why you hear
all channels. The -c option is used only to determine the starting
channel.

For output .wav files -c make sense, though. For instance:

aucat -n -i quad.wav -c 1:1 -o quad-1.wav

extracts channel 1 into a mono file. Here -c 1:1 specifies channels
selection of the output file. Then, playing quad-1.wav will, in turn,
play channel 1 of the quad.wav file.



Re: Bidirectional audio between OpenBSD sndiod <-> Debian pulseaudio

2021-05-10 Thread Alexandre Ratchov
On Mon, May 10, 2021 at 07:05:49PM +, Martin wrote:
> Hi,
> 
> Great experience! But I have no possibility to recompile each sound producer 
> software to have sndio support.
> 
> So my way is to use additional layer of well implemented sound architecture 
> and it add additional layer to sound system for sure.
> 
> I've tried to use alsa-sndio module from https://github.com/Duncaen/alsa-sndio
> 
> Module builds successfully, but
> 
> $ sudo alsactl init
> returns it can't find any audio hardware (Debian system is headless and run 
> on VM).
> 
> Tried to add snd-dummy module from 
> https://www.alsa-project.org/main/index.php/Matrix:Module-dummy
> $ sudo modprobe snd-dummy
> 
> $ sudo alsactl init
> Found hardware: "Dummy" "Dummy Mixer" "" "" ""
> 
> But how to output from alsa-sndio module using alsa is not clear for me.
> 
> I've created /etc/asound.conf as required by developers of alsa-sndio module.
> 
> $ cat /etc/asound.conf
> pcm.!default (
>  type sndio
>  device "snd@192.168.33.1/0"
> 
> alsa don't use this config.
> 
> Do you have some experience how to use alsa modules to iteract with OpenBSD 
> sndiod server?
> 

Not much, sorry.

Did you check that the VM can talk to the host? You could do so by
installing the sndio library and utils on the VM and test with aucat
that everything works.



Re: Bidirectional audio between OpenBSD sndiod <-> Debian pulseaudio

2021-05-09 Thread Alexandre Ratchov
On Sat, May 08, 2021 at 10:29:35AM +, Martin wrote:
> Hi list,
> 
> It is great to have bidirectional audio between OpenBSD host and Debian guest 
> (headless). I hope I move in a right way to make this thing working.
> 
> Required configuration:
> mic-in on OpenBSD host >> Debian VMM guest
> audio-out from Debian VMM guest >> OpenBSD host
> 
> Does anybody using pulseaudio or any other driver to have
> bidirectional network audio stream between VMM guest and OpenBSD
> host system?

Hi,

These days I use a simiar setup with Alpine running in a
OpenBSD-hosted VM. The main purpose of sndiod -L option is to handle
such setups (don't forget to copy your ~/.sndio/cookie on the VM). In
the past, I used a lot Debian, but on a real machine.

I didn't try to involve pulseaudio or any alsa tweakery, to limit the
number of audio software layers and in turn get the maximum audio
stability.  So I just rebuild the software I needed with sndio support
enabled (that was mostly firefox and few audio players).



Re: .profile not being loaded (ksh) when opening shell in X

2021-04-27 Thread Alexandre Ratchov
On Mon, Apr 26, 2021 at 09:26:19PM +, tetrahe...@danwin1210.me wrote:
> I have some custom additions to my $PATH. They're defined in ~/.profile and
> they are correctly loaded when I log in from a text console.
> 
> When I log in to X (cwm) and open a terminal window, $PATH does not contain
> the entries.
> 
> I tried `chmod +x` on my .profile but that didn't help.
> 
> Both the text console and the X terminal window are using ksh.
> 
> When I call `/bin/ksh -l` then the resulting shell contains the correct
> additions to $PATH.
> 
> It looks like the custom $PATH is not being passed from the login shell on
> downwards, since ~/.profile is only read by a login shell.
> 
> ~/.kshrc is (according to ksh(1)) read by every spawning shell, but I don't
> see any documentation or examples on the Internet where someone defined
> their $PATH in ~/.kshrc ...
> 
> What's the correct way to set $PATH and have it stick no matter where and
> when the shell is spawned?

If you're using a display manager (xenodm or whatever), you've to
include your .profile in your session login script (X equivalent of
shell's ~/.profile concept), so the envoronment (and other global
login settings) from your .profile become visible to all X programs,
not only xterm. For instance put:

. ~/.profile

at the beginning of our ~/.xsession

If you're using xinit(1), your ~/.profile is already loaded by
the login shell.



Re: How do I change the default per-application sound volume in sndiod?

2021-04-26 Thread Alexandre Ratchov
On Sun, Apr 25, 2021 at 11:57:42PM -0500, John Batteen wrote:
> Greetings misc,
> 
> I am running 6.9 and am having some difficulty.  I have
> outputs.master=255,255 set in mixerctl.conf (it is the only line in
> the file), but every time I open an application its individual
> volume is set to 0.496.  For example, sndioctl reveals:

> input.level=0.490
> input.mute=0
> output.level=1.000
> output.mute=0
> app/mplayer0.level=0.496
> 
> 
> This is very quiet on my setup and I have to manually adjust the
> volume every time.  I have read the entirety of the sndiod,
> sndioctl, mixerctl, and mixerctl.conf man pages, and I can't find
> anything that tells me how to change that default 0.496 value.  I'd
> rather have it stay at 1.  I've tried modifying every value that was
> set to 126 (0.496 * 255) or anywhere close to it in the default
> mixerctl to 255,255 with mixerctl.conf but it still happens.  Is
> this intended behavior?

When a program exits, its level setting is kept in memory by sndiod;
when the program is started again, it continues with its saved
level. The initial level is 1.

So when the system starts, app/mplayer0.level is supposed to be 1.

Is the problem with mplayer only or with all programs? If it's mplayer
only, is there something in ~/.mplayer/config that could cause this?



Re: sndio: way to play and record from different devices?

2021-04-19 Thread Alexandre Ratchov
On Mon, Apr 19, 2021 at 09:40:37AM -0500, Ax0n wrote:
> I have a nice microphone attached to a USB sound device, but I'd like to
> rely on my computer's built-in line out for speakers from the same program
> (e.g. Audacity, Firefox). It feels like sndio might have some way to let
> programs use snd/0.play and snd/1.rec, or a way to make snd/1 the default
> device for record and snd/0 the default for play, or maybe even a virtual
> sound device, but I haven't been able to sort out how to make it work.
> 

There's no way (yet) to combine a play-only and a rec-only device into
a single full-duplex one.

Certain programs don't need full-duplex capability and can use two
independent devices; firefox and audacity are not part of them
unfortunately. Sorry.



Re: Microphone not working on Gen8 ThinkPad X1 Carbon

2021-03-29 Thread Alexandre Ratchov
On Sun, Mar 28, 2021 at 11:58:15AM -0500, Ax0n wrote:
> I initially noticed it when I hopped in a video room on Discord in Firefox
> and folks could see me and I could hear them, but Discord got no audio. It
> turns out, nothing gets any audio. sysctl has audio and video recording
> enabled, and pledge/unveil has been tweaked just a little for firefox to
> pick up the webcam.
> 
> aucat isn't picking up any audio. playing back the WAV I recorded with
> aucat or audacity is just silence. Audacity visibly shows very very low
> audio levels in the "monitor" VU meter when recording, but no amount of
> tinkering with mixerctl, audioctl, or sndioctl seems to make a difference
> in the recorded audio -- it's just silent. Audio output is good (videos on
> youtube for example) and aucat can play other WAV files just fine. I use
> the pianobar package daily to stream Pandora while I work.
> 
> I switched over to the latest snapshot and upgraded packages last night,
> and there's no change.
> 

Hi,

There's a thread about gen7 X1's, here:

https://marc.info/?t=16070737021=1=2

in short, on these machines, the microphone is not connected to the HD
audio codec (exposed by the azalia driver), but to another "intel
smart sound technology" chip for which OpenBSD has no driver.

If gen8 are the same, until this get fixed, I'd suggest using a
*full-duplex* USB audio headset for audio-conferencing.

There are also cheap -- but good quality, imho -- USB dongles with a
tiny sound card with a TRRS jack that allow most phone headsets to be
used on OpenBSD.

HTH,

-- Alexandre



Re: sound question

2021-01-18 Thread Alexandre Ratchov
On Mon, Jan 18, 2021 at 12:00:40PM +0100, Peter J. Philipp wrote:
> On Mon, Jan 18, 2021 at 11:29:54AM +0100, Alexandre Ratchov wrote:
> > On Mon, Jan 18, 2021 at 10:16:53AM +0100, Peter J. Philipp wrote:
> > > Hi,
> > > 
> > > I recently switched my desktop workstation to a raspberry pi 4B with 8 GB 
> > > RAM.
> > > Since the sound there doesn't work yet, I got a USB sound card, the make 
> > > of
> > > the sound card is best read from usbdevs -v:
> > > 
> > > addr 08: 0ccd:00b1 TerraTec Electronic GmbH, Aureon 7.1 USB
> > >  full speed, power 500 mA, config 1, rev 0.10
> > >  driver: uaudio0
> > >  driver: ugen0
> > > 
> > > Like the other AUREON card in the usb drivers I put this in usb quirks to 
> > > not
> > > attach as a uhiddev (not sure if that was the right thing to do?).
> > > 
> > > Now to my real question:  mplayer sounds horrible, but iridium sound from 
> > > youtube sounds OK.  There is a lot of static interference when I play with
> > > mplayer.  So what is it doing different than iridium?  I tried messing 
> > > with
> > > audioctl buffer sizes and nblocks but I don't really know what I'm doing 
> > > here,
> > > so I'm writing to the list.  The sound did not improve when I messed with 
> > > the
> > > buffers.
> > > 
> > 
> > Everything looks OK in dmesg. Try to run sndiod in the foreground, ex:
> > 
> > doas sndiod -ddd -a on
> > 
> > and see what happens while mplayer sounds bad. Without stopping
> > mplayer, run audioctl multiple times and see if play.errors or
> > record.errors counters increase continuously.
> > 
> 
> Hmmm this is elusive.  My -current is from December 26th.  When I put the
> sndiod in -ddd -a on mode everything started working well.  Could it be that
> all it needs is a restart after a reboot?  I can crontab that to be 5 minutes 
> after reboot...

The next time it fails, try to stop and start playback to see if this
helps. My bet is that an usb transfer fails (heavy load may cause
this) and the device doesn't recover properly.

> Other than that my sndiod config looks like this in /etc/rc.conf.local:
> 
> sndiod_flags="-f rsnd/0 -f rsnd/1"
> 
> Odd stuff, is the -a on important?  

No, "-a on" is only to force sndiod to keep the device open (or exit
if it can't), it's useful for testing to be sure another process
doesn't grab the device.



Re: sound question

2021-01-18 Thread Alexandre Ratchov
On Mon, Jan 18, 2021 at 10:16:53AM +0100, Peter J. Philipp wrote:
> Hi,
> 
> I recently switched my desktop workstation to a raspberry pi 4B with 8 GB RAM.
> Since the sound there doesn't work yet, I got a USB sound card, the make of
> the sound card is best read from usbdevs -v:
> 
> addr 08: 0ccd:00b1 TerraTec Electronic GmbH, Aureon 7.1 USB
>  full speed, power 500 mA, config 1, rev 0.10
>  driver: uaudio0
>  driver: ugen0
> 
> Like the other AUREON card in the usb drivers I put this in usb quirks to not
> attach as a uhiddev (not sure if that was the right thing to do?).
> 
> Now to my real question:  mplayer sounds horrible, but iridium sound from 
> youtube sounds OK.  There is a lot of static interference when I play with
> mplayer.  So what is it doing different than iridium?  I tried messing with
> audioctl buffer sizes and nblocks but I don't really know what I'm doing here,
> so I'm writing to the list.  The sound did not improve when I messed with the
> buffers.
> 

Everything looks OK in dmesg. Try to run sndiod in the foreground, ex:

doas sndiod -ddd -a on

and see what happens while mplayer sounds bad. Without stopping
mplayer, run audioctl multiple times and see if play.errors or
record.errors counters increase continuously.



Re: Internal Microphone on Thinkpad X1 Carbon 7th gen not working

2020-12-10 Thread Alexandre Ratchov
On Thu, Dec 10, 2020 at 10:30:56AM +0100, Anders Damsgaard wrote:
> * Stefan Hagen  [2020-12-10 10:14:35 +0100]:
> 
> > Bodie wrote:
> > > 
> > > 
> > > On 9.12.2020 20:43, Stefan Hagen wrote:
> > > > Hello Zachary,
> > > > 
> > > > Zachary Campbell wrote:
> > > > > Any luck with this? I am also struggling to get the internal
> > > > > mic to work on the X1 Carbon 7th Gen. Have gone through
> > > > > everything discussed here, but still no luck.
> > > > > 
> > > > > My dmesg and mixerctl match those already shared in thread.
> > > > > Happy to share anything else that might be helpful, but after
> > > > > reading through the multimedia FAQ and this thread I am
> > > > > not quite sure where to go next.
> > > > 
> > > > No progress here.
> > > > 
> > > > I think all needed information is in here.
> > > > https://bbs.archlinux.org/viewtopic.php?id=249900
> > > > 
> > > 
> > > That part on SST remind me my problem with audio on T590 under Windows.
> > > For at least two patch builds Windows had issue to picking up wrong
> > > driver for audio. Instead of regular HD Audio they were setting
> > > up SST HD Audio and then output/input were not working.
> > > 
> > > So maybe it is something wrong inside that HW like reporting wrong
> > > capabilities?
> > 
> > Not unlikely as "microphone not working on x1 carbon gen 7" complaints
> > are all over the place. The solution for ms windows is upgrade + use
> > newest drivers. So yes, I assume there's something off that has been
> > fixed in software.
> > 
> > I've seen similar complaints about Dell Laptops that are also using
> > the Realtek ALC285 chip.
> > 
> > If it's just this one chip, then fine, let's ignore it.
> > 
> > Can someone with a X1 Carbon Gen 8 report it working?
> > 
> > Best Regards,
> > Stefan
> > 
> 
> The same issue persists on 8th generation, also reported to dmesg@.
> 
> azalia0 at pci0 dev 31 function 3 "Intel 400 Series HD Audio" rev 0x00: msi
> azalia0: codecs: Realtek ALC285, Intel/0x280b, using Realtek ALC285
> audio0 at azalia0
> 
> Also, the mic is enabled in BIOS and kern.audio.record=1.
> 

AFAIU, all audio components but the internal microphone are connected
to the "Realtek ALC285" codec which is handled by azalia(4). The
internal microphone uses the Intel Smart Sound Technology, which needs
a dedicated driver.

Linux has a driver written by Intel employees, which is around twice
as big as azalia. It's unclear how difficult it would be to write a
openbsd-ish driver that simply makes the hardware work. Sorry.

Meanwhile, if this is for voice calls, I'd suggest either using a
phone headset (the x1 probably has a trrs jack) or a comfortable
full-duplex usb headset; most work way better than the internal
mics/speakers.



Re: sndiod -F does not switch to device

2020-11-23 Thread Alexandre Ratchov
On Sun, Nov 22, 2020 at 07:48:14PM +0100, Jan Stary wrote:
> This is current/amd64 (dmesg below),
> running /usr/bin/sndiod -f rsnd/0 -F rsnd/1
> 
> While the -F feature works with most USB audio devices I have tried,
> it does not make the switch to use the -F device
> with this USB camera with a builtin microphone.
> It's an Audom AF640 and it attaches as follows:
> 
> uvideo0 at uhub0 port 1 configuration 1 interface 0 "Sunplus IT Co Full HD 
> webcam" rev 2.00/0.05 addr 2
> video0 at uvideo0
> uaudio0 at uhub0 port 1 configuration 1 interface 3 "Sunplus IT Co Full HD 
> webcam" rev 2.00/0.05 addr 2
> uaudio0: class v1, high-speed, sync, channels: 0 play, 1 rec, 2 ctls
> audio1 at uaudio0
> 
> I can confirm that both the camera and the mike themselves work.
> After plugging it in, sndioctl says
> 
> input.level=0.000
> input.mute=1
> output.level=0.980
> output.mute=0
> server.device=0
> app/rec0.level=1.000
> 
> Notice the server.device=0, meaning it is still using snd/0.
> Notice the zero input level and the muted input.
> Is this intended?
> 
> If I plug a Sennheiser haedset instead, sndioctl says
> 
> input.level=0.800
> input.mute=0
> output.level=0.800
> output.mute=0
> server.device=1
> app/rec0.level=1.000
> 
> switching to the USB device plugged in.
> 
> Is it because the camera's mike has no output channels?
> "channels: 0 play, 1 rec, 2 ctls" - indeed, it only
> records mono and has no playback capabilities.
> 
> According to the manpage
> 
> -F device
> Specify an alternate device to use.  If it doesn't work,
> the one given with the last -f or -F options will be used.
> For instance, specifying a USB device following a PCI device
> allows sndiod to use the USB one preferably when it's
> connected and to fall back to the PCI one when it's
> disconnected. Alternate devices may be switched with the
> server.device control of the sndioctl(1) utility.
> 
> Is the -F device required to have at least one playback
> and pne record channel to "work"?
> 
> Switching with a manual "sndioctl server.device=1"
> doesn't work either: sndioctl still shows server.device=0
> 
> Is this intended?
> How can I further debug this?
> 

Hi,

The -F option works only if two devices have the same capabilities,
this allows to pull the USB cable and continue using the internal
device.

In your case the webcam can't play but sndiod is configured to use
full-duplex mode. From this stand-point, the webcam is not usable and
sndiod tries the next device.

sndiod could/should be changed to simply discard samples to play and
always present the webcam as a full-duplex device (similarly, produce
silence for play-only devices). The code to do so is not there yet,
unfortunately.



Re: Sound/audio onFirefox on 6.8

2020-10-26 Thread Alexandre Ratchov
On Fri, Oct 23, 2020 at 03:58:55PM -0600, Duncan Patton a Campbell wrote:
> 
> Hey Maurice.  The audio works elsewhere and this looks to be 
> a Zombie Bugzilla bug come back from the dead.  Something
> about needing to directly link to sndio and skip the "cubeb" something...
> 
> Dhu
> 
> This is what shows up on the command line:
> 
> dhu@gate:BSD $ firefox   
> 

Hi,

Could you check /dev permissions? they need to be as follows:

$ ls -al /dev/{audio,audioctl,rmidi}0   
crw-rw  1 root  _sndiop   42,   0 Oct 26 07:23 /dev/audio0
crw-rw  1 root  _sndiop   42, 192 Oct 19 12:20 /dev/audioctl0
crw-rw  1 root  _sndiop   52,   0 Oct 19 12:20 /dev/rmidi0

The /etc/firefox/unveil.* settings need to contain permission
to access ~/.sndio contents:

$ grep sndio /etc/firefox/*   
/etc/firefox/unveil.content:~/.sndio rwc
/etc/firefox/unveil.main:~/.sndio rwc

If above are OK, then run firefox with SNDIO_DEBUG=1 environment
variable exported and show the resulting output, it will reveal why
firefox still can't use the device.



Re: Thinkpad T400 only records from the external mic

2020-10-19 Thread Alexandre Ratchov
On Sat, Oct 17, 2020 at 07:05:53PM +0200, Jan Stary wrote:
> 
> Strangely, with each of
> 
>$ aucat -i /tmp/file.wav
>$ aucat -o /tmp/file.wav
> 
> it is both
> 
>   play.bytes=562560
>   record.bytes=562560
> 
> that keep growing in audioctl. Is that intended?

Yes. We always play and record at the same time. We do it this way
because this costs virtually nothing and because once playback is
started, we can't start recording properly synchronized to playback.



Re: USB to 3.5mm jack audio adapter

2020-09-09 Thread Alexandre Ratchov
On Wed, Sep 09, 2020 at 03:49:21PM +0200, Paul de Weerd wrote:
> Hi all,
> 
> As I don't have a microphone to use with my azalia(4) sound card, and
> my webcam only has audio input (no output), I can't use my current
> hardware in firefox to do videoconferencing.  So I purchased (what I
> thought was) a USB to audio adapter[1].  This one simply offers a
> 3.5mm jack connector that I would then plug my existing headphones
> into for full duplex audio.
> 
> Unfortunately, it doesn't seem to be an actual uaudio(4) device:
> 
> uhidev0 at uhub0 port 1 configuration 1 interface 0 "Samsung Electronics 
> Samsung Type-C to 3.5pi gender adapter" rev 2.01/1.33 addr 2
> uhidev0: iclass 3/0, 2 report ids
> uhid0 at uhidev0 reportid 1: input=0, output=63, feature=0
> uhid1 at uhidev0 reportid 2: input=63, output=0, feature=0
> 
> Are there uaudio(4) devices that do provide full duplex (TRRS i.e. mic
> plus speakers) behind a 3.5mm jack?  Anyone have experience with one
> of these they can recommend?  I mean, I have a USB audio device that
> has a 3.5mm jack, but that's output only (TRS, so no microphone).
> 

Hi,

Try searching for "TRRS to USB adapter" then check in the detailed
description that:
  - it's an "external sound card" for computers (Windows/macOS supported)
  - it requires no device driver (means it's USB class-compliant)
  - supports 3.5mm "TRRS" headset jacks (what most phones use)



Re: 6.7 and sound

2020-09-03 Thread Alexandre Ratchov
On Thu, Sep 03, 2020 at 08:39:45PM -0600, Austin Hook wrote:
> 
> Can't seem to parse the instructions in 
> http://www.openbsd.org/faq/upgrade67.html
> 
> for how to re-enable an ordinary non root user of Firefox or mplayer to 
> output audio.
> 
> mplayer works fine as root, but what command lines are necessary to allow 
> a non root user get sound output?
> 
> let's username is: joeuser
> 

Hi,

Sound is supposed to work by default for regular users. Check if
sndiod(8) is still running and if /dev/audio* have the correct
permissions (normally MAKEDEV, part of the upgrade is supposed to fix
update the permissions).

FWIW, starting 6.7, for improved security, regular users have no
direct access to /dev/audioX anymore. Sound must go through sndiod(8),
which is running by default. For sndiod(8) to access the hardware, the
below device nodes ownership and permissions are needed:

$ ls -al /dev/audio* /dev/rmidi*  
crw-rw  1 root  _sndiop   42,   0 Aug 29 08:00 /dev/audio0
crw-rw  1 root  _sndiop   42,   1 Jul 27 10:16 /dev/audio1
crw-rw  1 root  _sndiop   42,   2 Jul 27 10:16 /dev/audio2
crw-rw  1 root  _sndiop   42,   3 Jul 27 10:16 /dev/audio3
crw-rw  1 root  _sndiop   42, 192 Jul 27 10:16 /dev/audioctl0
crw-rw  1 root  _sndiop   42, 193 Jul 27 10:16 /dev/audioctl1
crw-rw  1 root  _sndiop   42, 194 Jul 27 10:16 /dev/audioctl2
crw-rw  1 root  _sndiop   42, 195 Jul 27 10:16 /dev/audioctl3
crw-rw  1 root  _sndiop   52,   0 Jul 27 10:16 /dev/rmidi0
crw-rw  1 root  _sndiop   52,   1 Jul 27 10:16 /dev/rmidi1
crw-rw  1 root  _sndiop   52,   2 Jul 27 10:16 /dev/rmidi2
crw-rw  1 root  _sndiop   52,   3 Jul 27 10:16 /dev/rmidi3
crw-rw  1 root  _sndiop   52,   4 Jul 27 10:16 /dev/rmidi4
crw-rw  1 root  _sndiop   52,   5 Jul 27 10:16 /dev/rmidi5
crw-rw  1 root  _sndiop   52,   6 Jul 27 10:16 /dev/rmidi6
crw-rw  1 root  _sndiop   52,   7 Jul 27 10:16 /dev/rmidi7



Re: writing aucat output

2020-06-05 Thread Alexandre Ratchov
On Fri, Jun 05, 2020 at 12:06:54PM +0200, Peter J. Philipp wrote:
> Hi,
> 
> I'm wondering how I can write to stdout on aucat?  Here is what I have:
> 
> beta$ /usr/bin/aucat -r 44100 -h wav -i ewhist2.wav -o - | hexdump -C
> stdout: failed to seek back to header
> beta$ /usr/bin/aucat -r 44100 -h wav -i ewhist2.wav -o /dev/stdout | hexdump -
> /dev/stdout: failed to seek back to header
> 
> It doesn't seem to work for me.  I'm a little distracted too.  Anyone want
> to lift me on their shoulders?
> 
> My intention is to resample input audio to 44100 and output it to a wav.

Hi,

I think you need:

aucat -n -i ewhist2.wav -r 44100 -o ewhist2_44100.wav

If you need to pipe the result to another program, use the raw format, example:

aucat -n -i fanza_mix_ter.wav -r 44100 -o - | lame -r -s 44.1 - ewhist2.mp3

Last point, I'd suggest using audio/sox port to resample files, you'll
get much better quality, example:

sox ewhist2.wav -r 44100 ewhist2_44100.wav



Re: Distorted sound in 6.7

2020-05-24 Thread Alexandre Ratchov
On Fri, May 22, 2020 at 12:35:06PM +0100, Maurice McCarthy wrote:
> Hi,
> 
> Since installing 6.7 I've found that human voices in mpv or youtube
> sound either very quiet or  as-if  "under water" or bubbly. I was
> unable to cure this with sndioctl but succeeded with the old mixerctl
> 
> doas outputs.master=200,150
> 

Most probably the speaker(s) are not properly wired and left and right
channels cancel each other. You could check this as follows: play a
mono file and meanwhile try the following:

doas outputs.master=200,0
doas outputs.master=0,200
doas outputs.master=200,200

first two should play but the last one should produce (almost)
silence.

> If I understand sndioctl well enough this kind of left and right
> speaker adjustment is not possible under sndioctl. dmesg attached.
> 

fwiw, to control individual channels (if hardware allows it), put the
channel number between squire brackets:

sndioctl output[1].level=0

> Thanks again for all the magnificent effort. I've made a donation
> within my means.
> 

thank you



Re: Multimedia FAQ

2020-05-07 Thread Alexandre Ratchov
On Thu, May 07, 2020 at 06:12:21PM -0300, Oficial wrote:
> Hi,
> 
> The multimedia FAQ (https://www.openbsd.org/faq/faq13.html), list some
> mixerctl outputs like:
> 
>  outputs.headphones=160,160
>  outputs.headphones.mute=off
> 
> In my system (current i386) there is no "outputs.headphones.mute" for
> example, but there is a "outputs.hp_mute".

Hi,

Each sound-card model has its own specific set of controls, yours is
different from the one of the example.

> The documentation is outdated ?
> 

The audio parts needs *many* updates after the recent audio changes,
we're working on it.



Re: Sound is good on OpenBSD

2020-04-29 Thread Alexandre Ratchov
On Wed, Apr 29, 2020 at 11:46:06AM +0200, Moises Simon wrote:
> On Tue, Apr 28, 2020 at 03:38:58PM -0500, Abel Abraham Camarillo Ojeda wrote:
> > I think increasing -b option in sndiod helps to prevent audio jumping, I
> > hear music with a local mpd with music directory over nfs, plus a lot of
> > firefox and chrome and hear no jumps , etc
> > 
> > regards
> 
> I can confirm. For me setting -b 8640 stops the audio jumping.
> 
> Thanks Abel.
> 

what devices are you using? azalia? usb?



Re: couldn't find audio device

2020-04-24 Thread Alexandre Ratchov
On Fri, Apr 24, 2020 at 09:43:12AM +0200, Damien Thiriet wrote:
> Hi misc@,
> 
> 
> I am trying to make audio records from my web cam but
> cannot succeed in doing it.
> I read the FAQ, aucat(1), audioctl(1) and sndiod(8) man pages (but I 
> certainly misunderstood them) and searched the mailing list. 
> I think they are obvious things I simply don't understand, any help 
> welcome.
> 
> Looks like my webcam is recognized by the system
> 
> $ dmesg|grep audio
> audio0 at azalia1
> uaudio0 at uhub0 port 3 configuration 1 interface 3 "Logitech product 0x0808" 
> rev 2.00/0.09 addr 2
> uaudio0: class v1, high-speed, sync, channels: 0 play, 1 rec, 2 ctls
> audio1 at uaudio0
> 
> I switched recording on, as advised in the FAQ
> $ /usr/bin/doas /usr/sbin/sysctl kern.audio.record=1
> kern.audio.record: 1 -> 1
> 
> $ aucat -f /dev/audio1 -o test.wav
> /dev/audio1: couldn't open audio device
> 
> $ audioctl -f /dev/audio1
> audioctl: /dev/audio1: Device not configured
> 
> I understand I should use sndiod, but doing
> # sndiod -f /dev/audio1
> did not help, even after
> # rcctl restart sndiod
> 
> What did I miss? My user is member of wheel, I understand he should have
> access to /dev/audio1
> 

You don't need special privileges to use audio, you only need to
enable the device in sndiod. To use both of your devices (internal and
USB), you could run:

rcctl set sndiod flags -f rsnd/0 -f rsnd/1
rcctl restart sndiod

At this point you could run:

aucat -f snd/1 -o test.wav

and /tmp/foo.wav

Note that this device is not full-duplex, it is suitable for recording
but not for telephony in web browsers.

-- Alexandre



Re: Using a C310 Logitech webcam mic with internal speakers

2020-04-23 Thread Alexandre Ratchov
On Thu, Apr 23, 2020 at 10:01:52AM -0400, Jon Fineman wrote:
> On 2020-04-23 08:40, Alexandre Ratchov wrote:
> > On Wed, Apr 22, 2020 at 02:17:35PM +, Jon Fineman wrote:
> > > 
> > > Is there a way to set the mic to one channel and the speakers to
> > > another? Or merge the speakers from channel rsnd/0 and rsnd/1
> > > together and have them output on rsnd/0?
> > 
> > Sorry, two devices can't be combined into a single one on OpenBSD.
> > 
> 
> What started me down this path was that I can't get chromium or firefox to
> recognize the webcam if it is using rsnd/1. Changing it to rsnd/0 allowed
> the browsers to see it.
> 
> Am I doing something wrong with configuring things? I am on 6.7
> GENERIC.MP#128 amd64.
> 
> If the browser recognizes the webcam on rsnd/1 I could then get a combo
> headphone and mic and plug that into rsnd/0, assuming the browser will
> recognize the audio on rsnd/0.
> 

The c310 has two devices inside a webcam and a usb microphone.

The webcam is a video(4) device and can be used for video capture no
matter if the microphone is used or not. For video(4) devices to work,
/dev/video0 permissions need to be adjusted.

Currently browsers need a full-duplex audio device for telephony
web-sites, so the webcam microphone won't work for them, sorry.

Note that the "rsnd/N" you're refering to were disabled to regular
users recently, but that's not related your problem.



Re: Using a C310 Logitech webcam mic with internal speakers

2020-04-23 Thread Alexandre Ratchov
On Wed, Apr 22, 2020 at 02:17:35PM +, Jon Fineman wrote:
>
> Is there a way to set the mic to one channel and the speakers to
> another? Or merge the speakers from channel rsnd/0 and rsnd/1
> together and have them output on rsnd/0?

Sorry, two devices can't be combined into a single one on OpenBSD.



Re: sndioctl double behaviour

2020-04-22 Thread Alexandre Ratchov
On Tue, Apr 21, 2020 at 09:38:04AM -0600, Theo de Raadt wrote:
> Looks broken.
> 
> Mihai Popescu  wrote:
> 
> > Hi,
> > 
> > It's clear OpenBSD is moving to sndioctl. I used it, but I got some
> > "strange" behaviour.
> > Watching youtube in chromium, tried this:
> > 
> > $ sndioctl output.level=1
> > default: can't open control device
> > 
> > After closing / restarting chromium, and starting youtube I can run same
> > command many times:
> > 
> > $ sndioctl output.level=1
> > output.level=1
> > $ sndioctl output.level=0
> > output.level=0
> > $ sndioctl output.level=1
> > output.level=1
> > 
> > Expected?
> 

It looks like caused by unveil(2) usage in chrome. According to
unveil(2):

 Directories are remembered at the time of a call to unveil().
 This means that a directory that is removed and recreated after a
 call to unveil() will appear to not exist.

so, unveil("~/.sndio") is called, if chrome is the first program to
use audio, the directory doesn't exist so it's not unveiled. Then,
chrome connects to sndiod, creates "~/.sndio" directory and tries to
save the cookie, which fails. Then, other programs (like sndioctl)
will be rejected by sndiod until chrome disconnects.

Adding the full cookie path wouldn't help as the directory doesn't
exist yet.

Hmm.



Re: sndioctl double behaviour

2020-04-21 Thread Alexandre Ratchov
On Tue, Apr 21, 2020 at 06:13:42PM +0300, Mihai Popescu wrote:
> Hi,
> 
> It's clear OpenBSD is moving to sndioctl. I used it, but I got some
> "strange" behaviour.
> Watching youtube in chromium, tried this:
> 
> $ sndioctl output.level=1
> default: can't open control device
> 
> After closing / restarting chromium, and starting youtube I can run same
> command many times:
> 
> $ sndioctl output.level=1
> output.level=1
> $ sndioctl output.level=0
> output.level=0
> $ sndioctl output.level=1
> output.level=1
> 
> Expected?

No, thanks for reporting this. Any hints how to easily reproduce?



Re: sndioctl and USB HID keyboard

2020-04-21 Thread Alexandre Ratchov
On Tue, Apr 21, 2020 at 03:15:58AM +0200, Erling Westenvik wrote:
> > > 
> > > I'm a bit confused now... so why the previous usbhidaction configuration
> > > (which was aligned to the manpage suggestions and worked flawlessly for
> > > years) doesn't work anymore?
> > 
> > Sorry, few weeks ago mixerctl was changed to use /dev/audioctlN
> > instead of /dev/mixerN (which was just removed), but the
> > usbhidaction(1) man page was not updated. Now it's fixed.
> > 
> > The sample invocation line should read:
> > 
> > usbhidaction -f /dev/uhid1 -c conf /dev/audioctl0
> > 
> > Tested on my setup, let me know if it works for you.
> 
> I'm puzzled. This is -current as of yesterday (April 20th).
> 
> From /etc/rc.conf.local:
>   usbhidaction_flags=-f /dev/uhid0 -c /etc/usbhidaction.conf 
> /dev/audioctl0
> 
> My /etc/usbhidaction.conf:
>   Consumer:Play/Pause 1
>   echo 'cycle pause' | socat - /tmp/mpvsocket
>   Consumer:Volume_Decrement 1
>   sndioctl output.level=-0.1
>   #mixerctl outputs.master=-8
>   Consumer:Volume_Increment 1
>   sndioctl output.level=+0.1
>   #mixerctl outputs.master=+8
>   Consumer:Mute 1
>   sndioctl output.mute=!
>   #mixerctl outputs.master.mute=toggle
> 
> But alas, nothing happens when I press the respective buttons on my
> keyboard. 
> Running from command line works, but not as root/doas..
> 
> Running with doas: $ doas sndioctl output.level=+0.1
>   default: can't open control device
> 
> Running as myself: $ sndioctl output.level=+0.1
>   output.level=0.6
> 

Hi,

mixerctl is still the appropriate tool here, sndioctl is not inteded
to be run as root.

usbhidaction runs as root, given /dev/uhidN permissions, it's clearly
not intended to run "high level" user commands.  For instance it makes
no sense to run "audiocious -u" when Pause/Play key is hit, it's the
similar for sndioctl. The mixerctl utility remains for such "low
level" use cases.

Any program using sndiod is intended to be used one user at a time for
obvious privacy reasons, this is quickly explained in the last
section of sndio(7).



Re: sndioctl and USB HID keyboard

2020-04-20 Thread Alexandre Ratchov
On Mon, Apr 20, 2020 at 08:00:05PM +0200, Alessandro De Laurenzis wrote:
> Hello Alexandre,
> 
> On 20/04/2020 - 19:50, Alexandre Ratchov wrote:
> > On Mon, Apr 20, 2020 at 07:35:03PM +0200, Alessandro De Laurenzis wrote:
> > > Hello Alexandre,
> > > 
> > > Thanks for your prompt feedback.
> > > 
> > > On 20/04/2020 - 18:00, Alexandre Ratchov wrote:
> > > [...]
> > > >
> > > > This is the right way of doing it except that the user-id running
> > > > sndioctl is probably not authorized to use the server while you're
> > > > using.
> > > >
> > > > You could try to prefix the command with "doas -u "
> > > >
> > > > -- Alexandre
> > > >
> > > 
> > > Yes, that's the root cause and prefixing the sndioctl command with doas
> > > makes the trick. Unfortunately, this solution isn't applicable to my
> > > use-case, since there are several users that can log in this machine...
> > > 
> > > Are there any alternatives?
> > 
> > mixerctl still works for root.
> > 
> 
> I'm a bit confused now... so why the previous usbhidaction configuration
> (which was aligned to the manpage suggestions and worked flawlessly for
> years) doesn't work anymore?

Sorry, few weeks ago mixerctl was changed to use /dev/audioctlN
instead of /dev/mixerN (which was just removed), but the
usbhidaction(1) man page was not updated. Now it's fixed.

The sample invocation line should read:

usbhidaction -f /dev/uhid1 -c conf /dev/audioctl0

Tested on my setup, let me know if it works for you.



Re: sndioctl and USB HID keyboard

2020-04-20 Thread Alexandre Ratchov
On Mon, Apr 20, 2020 at 07:35:03PM +0200, Alessandro De Laurenzis wrote:
> Hello Alexandre,
> 
> Thanks for your prompt feedback.
> 
> On 20/04/2020 - 18:00, Alexandre Ratchov wrote:
> [...]
> > 
> > This is the right way of doing it except that the user-id running
> > sndioctl is probably not authorized to use the server while you're
> > using.
> > 
> > You could try to prefix the command with "doas -u "
> > 
> > -- Alexandre
> > 
> 
> Yes, that's the root cause and prefixing the sndioctl command with doas
> makes the trick. Unfortunately, this solution isn't applicable to my
> use-case, since there are several users that can log in this machine...
> 
> Are there any alternatives?

mixerctl still works for root.



Re: sndioctl and USB HID keyboard

2020-04-20 Thread Alexandre Ratchov
On Mon, Apr 20, 2020 at 05:07:26PM +0200, Alessandro De Laurenzis wrote:
> Greetings,
> 
> Latest -current here:
> 
> OpenBSD theseus.atlantide.priv 6.7 GENERIC.MP#140 amd64
> 
> Of course, mixerctl doesn't work anymore for volume control.
> 
> I have a Logitech wireless keyboard whose multimedia keys were pretty
> functional in OpenBSD through usbhidaction(1):
> 
> [...]
> Apr 20 16:54:48 theseus /bsd: uhidev0 at uhub0 port 2 configuration 1 
> interface 0 "Logitech USB Receiver" rev 2.00/12.01 addr 2
> Apr 20 16:54:48 theseus /bsd: uhidev0: iclass 3/1
> Apr 20 16:54:48 theseus /bsd: ukbd0 at uhidev0: 8 variable keys, 6 key codes
> Apr 20 16:54:48 theseus /bsd: wskbd1 at ukbd0 mux 1
> Apr 20 16:54:48 theseus /bsd: wskbd1: connecting to wsdisplay0
> Apr 20 16:54:48 theseus /bsd: uhidev1 at uhub0 port 2 configuration 1 
> interface 1 "Logitech USB Receiver" rev 2.00/12.01 addr 2
> Apr 20 16:54:48 theseus /bsd: uhidev1: iclass 3/1, 8 report ids
> Apr 20 16:54:48 theseus /bsd: ums0 at uhidev1 reportid 2: 16 buttons, Z and W 
> dir
> Apr 20 16:54:48 theseus /bsd: wsmouse2 at ums0 mux 0
> Apr 20 16:54:48 theseus /bsd: uhid0 at uhidev1 reportid 3: input=4, output=0, 
> feature=0
> Apr 20 16:54:48 theseus /bsd: uhid1 at uhidev1 reportid 4: input=1, output=0, 
> feature=0
> Apr 20 16:54:48 theseus /bsd: uhid2 at uhidev1 reportid 8: input=1, output=0, 
> feature=0
> Apr 20 16:54:48 theseus /bsd: uhidev2 at uhub0 port 2 configuration 1 
> interface 2 "Logitech USB Receiver" rev 2.00/12.01 addr 2
> Apr 20 16:54:48 theseus /bsd: uhidev2: iclass 3/0, 33 report ids
> Apr 20 16:54:48 theseus /bsd: uhid3 at uhidev2 reportid 16: input=6, 
> output=6, feature=0
> Apr 20 16:54:48 theseus /bsd: uhid4 at uhidev2 reportid 17: input=19, 
> output=19, feature=0
> Apr 20 16:54:48 theseus /bsd: uhid5 at uhidev2 reportid 32: input=14, 
> output=14, feature=0
> Apr 20 16:54:48 theseus /bsd: uhid6 at uhidev2 reportid 33: input=31, 
> output=31, feature=0
> [...]
> 
> This is the command that I use through hotplugd (adapted from the manpage,
> which is BTW now outdated, and modified to cope with sndioctl):
> 
> [...]
> usbhidaction -f /dev/uhid0 -c /etc/usbhidaction/vol-ctrl
> [...]
> 
> and this is the content of /etc/usbhidaction/vol-ctrl
> 
> [...]
> # The volume range is 0..1. Moving 0.1 volume steps each keypress
> # moves quickly through the volume range but still has decent
> # granularity.
> Consumer:Bass 1
> sndioctl output.mute=!
> Consumer:0x00eb 1
> sndioctl output.level=-0.1
> Consumer:Volume_Decrement 1
> sndioctl output.level=+0.1
> [...]
> 
> but when I use the multimedia keys... nothing happens. I really don't know
> how to debug this; is it related to the interaction with sndio?
> 
> Any hints?
> 

This is the right way of doing it except that the user-id running
sndioctl is probably not authorized to use the server while you're
using.

You could try to prefix the command with "doas -u "

-- Alexandre



Re: Problem with mixerctl on latest snapshot

2020-04-19 Thread Alexandre Ratchov
On Sun, Apr 19, 2020 at 09:11:16AM +0200, zeurk...@volny.cz wrote:
> 
> > Now programs connect to sndiod which does the hardware access for
> > them, this has other advantages as well:
> > - programs control the volume of the right device on systems with
> >  multiple audio devices (ex. usb head sets)
> > - there's always a volume control, even if the hardware lacks one, as
> >  may usb devices.
> > - unified view of hardware and software controls, network
> >  transparency, etc
> 
> That may all be, but like xenodm(1), memight find (future tense, as me's
> not running -current or snapshots) the above proposed solution
> inadequate for me needs.

Hi,

I'm curious, what use-case is not handled and still requires access to
the device nodes?



Re: Problem with mixerctl on latest snapshot

2020-04-19 Thread Alexandre Ratchov
On Sat, Apr 18, 2020 at 03:53:19PM -0700, Renato Aguiar wrote:
> Hi,
> 
> After updating to latest snapshot, mixerctl stopped working with non-root
> user:
> 
>$ mixerctl
>mixerctl: /dev/audioctl0: Permission denied
>$ ls -l /dev/audioctl0
>crw-rw  1 root  _sndiop   42, 192 Apr 18 14:29/dev/audioctl0
>$
> 

Hi,

You could use the sndioctl utility to adjust the volume, it's similar
to mixerctl.

Access to audio and MIDI related device nodes is now disabled for
security reasons. We don't want programs we run, possibly processing
untrusted input, to be allowed to directly access low level drivers
and attempt to exploit kernel bugs.

Now programs connect to sndiod which does the hardware access for
them, this has other advantages as well:
- programs control the volume of the right device on systems with
  multiple audio devices (ex. usb head sets)
- there's always a volume control, even if the hardware lacks one, as
  may usb devices.
- unified view of hardware and software controls, network
  transparency, etc

mixerctl remains as a configuration tool, /etc/mixerctl.conf is still
processed on system startup.



Re: Record with a device, playback with another with sndiod

2020-03-16 Thread Alexandre Ratchov
On Sat, Mar 14, 2020 at 09:10:19AM +0100, David Demelier wrote:
> Hello,
> 
> I'm trying to setup sndiod to record input using my laptop's builtin
> microphone but using an USB sound card for output.
> 
> The microphone does work correctly because I was able to record some
> test using aucat
> 
> $ aucat -o test.wav
> $ aucat -i test.wav (worked)
> 
> To my understanding the option -m can be used to control either both
> playback and recording so I've tried to setup my rsnd/0 (laptop) to only
> use recording and my external dock rsnd/1 to only use playback.
> 
> $ sndiod -f rsnd/1 -s default -m play -F rsnd/1 -f rsnd/0 -m rec
> 
> The playback works correctly on the USB dock but plain `aucat -o` won't
> record from the laptop's microphone. However, `aucat -f rsnd/0 -o
> test.wav` works but since Firefox won't let me choose a specific input
> device I'm stuck...
> 
> Do I miss something or it's simply not possible to create this "virtual"
> unique device that consist of input from a card and output to another
> one?

Hi,

Sorry, it's not possible to combine two devices into a single one with
sndiod.

FWIW, this is because both devices don't use the same clock source, if
there were combined, audio could be unstable. Properly synchronizing
them is difficult and given the price and availability of full-duplex
hardware it is not worth the risk of making audio unreliable.

I guess you're asking because the USB dock has no microphone, right?



Re: Jitsi on OpenBSD

2020-03-16 Thread Alexandre Ratchov
On Mon, Mar 16, 2020 at 10:59:08AM +, Edd Barrett wrote:
> Hi,
> 
> (CC people who may be knowledgable in this area)
> 
> I was wondering if anyone has got the Jitsi (https://jitsi.org/)
> web-client working on OpenBSD?
> 
> It's open-source (and self-hostable) video conferencing.
> 
> No prizes for guessing why I'm investigating this :P
> 
> I've just (quickly) tried the browser client in firefox:
> 
>  - It recognises my microphone and my camera.
>  - Thumbnail shows local video feed OK.
>  - I can hear audio from an android participant.
>  - The android participant cannot hear the audio from the OpenBSD machine.
>  - The video is super-flaky on both ends.
> 
> Did this, as per firefox README:
> 
>  - I have sysctl kern.audio.record=1.
>  - I chowned /dev/video0 to me.
> 
> This evening I'm going to have a deeper play around (e.g. verify if mic
> works in aucat), but if anyone has got this working before, I'd love to
> hear what tweaks they had to do.
> 
> Could be that the jitsi server is overloaded.

Hi,

I haven't used jitsi yet, but other video-converencing web sites
properly work in firefox. Jitsi claim they support chrome only, but
according to the settings window's microphone level meter, it's
properly recording.

There was a recent regression in firefox 73., so check that you're
using version 74 before testing.

HTH,

-- Alexandre



Re: aucat - join two mono files into stereo

2020-02-10 Thread Alexandre Ratchov
On Mon, Feb 10, 2020 at 10:45:02PM +0100, Jan Stary wrote:
> I must be missing something obvious.
> How does aucat mix two mono files into one stereo file
> as the left and right channel, respectively?
> 

You have to specify which file goes to which channel,
for instance:

aucat -n -c 0:0 -i 1.wav -c 1:1 -i 2.wav -c 0:1 -o mix.wav


There is a multi-channel bus. Inputs files (-i) are written to the bus
and output files (-o) are read from the bus. Bus channels are numbered
from 0 to the greatest channel of all files. The per-file -c option
specifies which channels of the bus the file will provide or consume.

> This mixes the two mono files into the left channel,
> leaving the right channel empty:
> 
> $ aucat -n -i 1.wav -i 2.wav -o mix.wav  
> 

Yes, by default '-c 0:0' is assumed for mono files,
so both go to the left one.

> That surprises me; the -j option says:
>   
>   If the flag is off, then each source channel is routed
>   to a single destination channel, possibly discarding channels. 
> 
> Here the -j is off (by default), so 1.wav is routed
> into a single destination channel, namely the left;
> 2.wav is also routed into a single channel: the left.
> Is that intended?
> 

Yes. We want two files specified the same way to be routed to the same
destination (ie file position on the command line shouldn't matter).

> Turning -j on, this mixes each of the two mono files
> into both the left and the right channel of the stereo output:
> 
> $ aucat -j on -n -i 1.wav -i 2.wav -o mix.wav  
> 
> Having -j on,
> 
>   a single source may be sent to multiple destinations
>   and multiple sources may be mixed into a single destination.
> 
> Here, each of 1.wav and 2.wav is indeed sent to multiple destinations,
> namely both the left and right channel of the stereo output. However,
> "multiple sources are mixed into a single destination" even with -j off:
> above, both 1.wav and 2.wav end up in the left channel.
> 



Re: USB M-Audio as default audio output

2020-01-24 Thread Alexandre Ratchov
On Fri, Jan 24, 2020 at 04:04:40PM +0100, Thomas de Grivel wrote:
> Hello misc,
> 
> I have a USB M-Audio card which is very well supported by OpenBSD 6.6 amd64
> 
> My question is : how do I setup an USB audio card as the default audio
> device whenever it is plugged in ?
> 
> Also I did not manage to get audio output with environment variables
> only, I had to swap /dev/audio0 and /dev/audio1 and then it worked.
> Could it have something to do with sndiod not running for /dev/audio1
> ?
> 
> In all cases I really like sndio, it is really easy to work with.

Hi,

You could define the internal device the main one (-f option) and add
the usb device as alternate device (-F option). In this case sndiod
will use the usb one perferably and switch to the internal one when
the usb one is disconnected.

For instance set:

sndiod_flags=-f rsnd/0 -F rsnd/1

in /etc/rc.conf.local and restart sndiod.

There's no way to detect when the usb device is connected
again. sndiod will start using it the next time it needs to open a
device. As programs tend to keep the device open, you could force
sndiod to reopen the devices (and thus switch to the usb one) by
sending it a HUP signal.

On 6.6 you have to "pkill -1 -x sndiod", on -current the rcctl script
does it for you:

rcctl reload sndiod

HTH,

-- Alexandre



Re: Userland PCI drivers possible in OpenBSD?

2020-01-11 Thread Alexandre Ratchov
On Fri, Jan 10, 2020 at 03:58:16AM +, Joseph Mayer wrote:
> Maybe this topic is better suited for tech@, you tell:
> 
> Is there some way I can implement PCI drivers in userland in OpenBSD?
> 
> On a quick Internet search, see some discussion for Linux and NetBSD
> e.g. [1] however nothing in OpenBSD.
> 
> I may be interested in operating some PCI device manually from my own
> program (run as root or user) in OpenBSD, and I can see this being of
> interest to others also, asking therefore.
> 

If you're developing a new driver and you want to do quick
edit->build->test cycles, you could expose in user-space the proper
minimal interface and develop parts (all?) of your driver in
user-space. This is useful especially if the device is poorly
documented or complex and requires many prototyping. Once you
understand the hardware and you're satisified with your design, you
could turn it into a kernel driver.

If you're talking about giving user programs direct access to the PCI
bus, the necessary isolation mechanisms are missing. Furthermore, no
matter if it's running in user-mode or in kernel-mode, the driver code
will do the same thing, so in most cases there's no benefit of running
it in user-space.

my 2 cents



Re: midiplay and FAQ ?

2019-12-28 Thread Alexandre Ratchov
On Sat, Dec 28, 2019 at 02:25:22PM -0500, Paul Wisehart wrote:
> I'm on a recently upgraded OpenBSD 6.6 machine.
> 
> I'm reading about midiplay here:
> https://www.openbsd.org/faq/faq13.html#midi
> 
> There is no midiplay command on the machine, but there is on a 6.5
> machine.  In the man view for midiplay the last entry is at 6.4r:
> https://man.openbsd.org/OpenBSD-6.4/midiplay.1
> 
> Was midiplay removed, and midicat is the goto tool to play midi
> files?

To play midi files, a synthesizer is needed, like the audio/fluidsynth
or audio/timidity ports; both can play midi files out of the box.

I forgot to update the FAQ, I'll fix it next week unless someone beats
me at this.



Re: mpd: failed to open default sndio device

2019-10-18 Thread Alexandre Ratchov
On Fri, Oct 18, 2019 at 02:34:48PM +0300, Кирилл wrote:
> Hello.
> After install mpd:
> $ mpc play
> Antimatter - Over Your Shoulder
> [paused]  #1/7   0:00/4:41 (0%)
> volume:100%   repeat: off   random: off   single: off   consume: off
> ERROR: Failed to open "sndio output" (sndio); Failed to open default sndio
> device
> 

This is most probably caused by mpd running as a different user as
you, in turn not having access to your ~/.sndio/cookie, needed to
connect to sndiod while you're using it.

You could either run mpd as your user-id or give the _mpd user access
to your audio session by copying your ~/.sndio/cookie into _mpd's home
directory.



Re: USB speakers, no sound

2019-08-10 Thread Alexandre Ratchov
On Sat, Aug 10, 2019 at 07:58:14PM +, Doug Moss wrote:
> no sound from USB speakers
> 
> dmesg:
> azalia0 at pci0 dev 27 function 0 "Intel 6 Series HD Audio" rev 0x05: msi
> azalia0: codecs: Realtek ALC888, Intel/0x2805, using Realtek ALC888
> audio0 at azalia0
> ...
> uhub5 at uhub3 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" 
> rev 2.00/0.00 addr 2
> uaudio0 at uhub5 port 7 configuration 1 interface 1 "Ten X Technology, Inc. 
> USB AUDIO" rev 1.10/1.87 addr 3
> uaudio0: class v1, full-speed, sync, channels: 2 play, 0 rec, 3 ctls
> audio1 at uaudio0
> uhidev1 at uhub5 port 7 configuration 1 interface 2 "Ten X Technology, Inc. 
> USB AUDIO" rev 1.10/1.87 addr 3
> uhidev1: iclass 3/0
> uhid0 at uhidev1: input=1, output=0, feature=0
> 
> 
> configuration:
> /etc/rc.conf.local:
> sndiod_flags="-m play -f rsnd/1 -f rsnd/0"
> 
> 
> audioctl -f /dev/audioctl0:
> name=azalia0
> mode=play,record
> pause=0
> active=0
> nblks=2
> blksz=4416
> rate=44100
> encoding=s16le
> play.channels=2
> play.bytes=0
> play.errors=0
> record.channels=2
> record.bytes=0
> record.errors=0
> 
> 
> audioctl -f /dev/audioctl1:
> name=uaudio0
> mode=
> pause=0
> active=0
> nblks=2
> blksz=960
> rate=48000
> encoding=s16le
> play.channels=2
> play.bytes=0
> play.errors=0
> record.channels=2
> record.bytes=0
> record.errors=0
> 
> aucat -f rsnd/0 -i song.wav
>   plays fine
> 
> aucat -f rsnd/1 -i song.wav
>   generates nothing
> 

Hi,

Does it exit or it just plays silence? If it plays silence, while it's
playing could you do:

audioctl -f /dev/audioctl1; sleep 1; audioctl -f /dev/audioctl1

and send me the output. Then could you send me the output of:

mixerctl -f /dev/mixer1



Re: firefox, sndiod and pledge

2019-06-02 Thread Alexandre Ratchov
On Thu, May 30, 2019 at 09:07:45PM -, Stuart Henderson wrote:
> On 2019-05-30, Hrvoje Popovski  wrote:
> > Hi all,
> >
> > i'm not sure is this intended or not, but if sndiod isn't running and if
> > i want to open youtube video with firefox i got this log
> > firefox[54192]: pledge "tty", syscall 54 and firefox crashes 
> > when sndiod is running everything seems fine ..
> 
> Similar with chromium's main process and audio.
> 
> Maybe it would be nice if libsndio had an option to say "I'm a pledged
> program, error out instead of trying to talk to the device direct
> and killing the process" ...

I see no reason to not add the "audio" promise to programs using
audio. There are few situations where using the device directly makes
perfectly sense.



Re: sndio? aucat -i s.wav: "default: couldn't open audio device"

2019-05-15 Thread Alexandre Ratchov
On Tue, May 14, 2019 at 06:57:48PM -0500, Juan Zuluaga wrote:
> Thank you Alexandre!
> 
> I did
> # sndiod -ddd -r 44100 -f rsnd/1 -m play

sorry, there's a typo in the command I sent you, the correct device
number is "0", as the device appears as "audio0" in dmesg. The correct
command is:

sndiod -ddd -r 44100 -f rsnd/0 -m play



Re: USB sound card not playing

2019-05-14 Thread Alexandre Ratchov
On Wed, May 09, 2018 at 04:06:41PM +0200, John Wilkes wrote:
>
> OpenBSD 6.3 (GENERIC.MP) #107: Sat Mar 24 14:21:59 MDT 2018
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

There were a lot of changes in usb audio support, please try -current
or at least OpenBSD 6.5



Re: USB sound card not playing

2019-05-14 Thread Alexandre Ratchov
On Tue, May 14, 2019 at 11:29:45AM +0900, Tuyosi T wrote:
> i use 6.6 snapshots and USB sound card .
> the card play youtube well including sound .
> 
> --
> $ dmesg | grep audio
> uaudio0 at uhub2 port 4 configuration 1 interface 1 "C-Media
> Electronics Inc. USB Audio Device" rev 1.10/1.00 addr 5
> uaudio0: class v1, full-speed, sync, channels: 2 play, 1 rec, 8 ctls
> audio0 at uaudio0
> uaudio0: can't reset interface
> uaudio0: can't reset interface
> audio0 detached
> uaudio0 detached
> uaudio0 at uhub3 port 6 configuration 1 interface 1 "C-Media
> Electronics Inc. USB Audio Device" rev 1.10/1.00 addr 4
> uaudio0: class v1, full-speed, sync, channels: 2 play, 1 rec, 8 ctls
> audio0 at uaudio0

could send the full dmesg, please



Re: sndio? aucat -i s.wav: "default: couldn't open audio device"

2019-05-14 Thread Alexandre Ratchov
On Mon, May 13, 2019 at 03:53:51PM -0500, Juan Zuluaga wrote:
> Hello all,
> 
> I have audio trouble: no sound whatsoever, and error messages.
> 
> In a first terminal window, as root, I typed
> # sndiod -ddd
> 

The ISA bus (actually the PC-XT DMA controller which didn't evolve
since 1980) is not fast enough for full-duplex. If you don't plan to
record, could you try:

sndiod -dd -r 44100 -f rsnd/1 -m play

and see if you manage to play something?



Re: headphone volume levels cannot be manipulated by mixerctl

2019-04-28 Thread Alexandre Ratchov
On Sat, Apr 27, 2019 at 10:10:07AM -0500, joshua stein wrote:
> On Sat, 27 Apr 2019 at 14:20:32 -, Christian Weisgerber wrote:
> > However, as in this example, I think you will only get a few generic
> > controls.
> > 
> > It is my theoretical understanding that USB audio gadgets typically
> > come with a uhid(4) device, as does yours above, and you would use
> > usbhidctl(1) to list and manipulate the available controls.
> > 
> > In practice, I only get some variant of
> > 
> > usbhidctl: USB_GET_REPORT (probably not supported by device): Input/output 
> > error
> > 
> > when I try this.  So either I'm mistaken or there is a problem
> > somewhere.
> 
> Some devices just don't supply hardware volume controls, so it must 
> be done in software on the sending device.
> 
> With sndiod, you can use aucatctl to change the software volume 
> per-application (or the master volume).
> 
> It's all kind of complicated though.  If you plug in a new USB audio 
> device like this, you have to restart sndiod and pass in a new 
> device name, then use aucatctl to adjust the volume.  But if you 
> unplug the USB device, you have to restart sndiod again to use the 
> default audio device and use mixerctl instead.

Here's a small aucatctl-like program to control sndiod volume in X:

http://caoua.org/alex/obsd/xvolkeys-1.0.tar.gz

In the .xinitrc or .xsession add:

xvolkeys -D

Then, use Ctrl-Alt-Plus and Ctrl-Alt-Minus to increment and decrement
sndiod master volume.



Re: A question about umidi(4) Roland UM-1 support

2019-04-15 Thread Alexandre Ratchov
On Sun, Apr 14, 2019 at 07:15:33PM +0200, Alejandro G. Peregrina wrote:
> Hello misc,
> 
> I'm going to purchase Roland UM-ONE MK2 midi-to-usb converter to play
> synthesizers from OpenBSD.
> 
> umidi(4) manual stays that Roland UM-1 is supported along other specific
> vendor models. Also, I've found out that support for Roland UM-ONE is
> listed in 5.2 changelog.
> I need to know in advance if the new Roland UM-ONE MK2 is supported as
> the manual stays Roland UM-1.
> 

Hi,

Any class-compliant device (aka "driverless") is supported. Most
(all?)  recent MIDI interfaces are class-compliant and should work.

According to the manual, the Roland UM-ONE mk2 has a switch to make it
compatible with iPad and for when the Roland driver can't be used;
basically this means that it has a class-compliant mode, and should
work on OpenBSD as long as the switch to the "TAB" position.

HTH

-- Alexandre



Re: video decoding and playback in OpenBSD

2019-03-25 Thread Alexandre Ratchov
On Mon, Mar 25, 2019 at 06:05:58PM +0200, Mihai Popescu wrote:
> Hello,
> 
> I am trying to find some hardware for an OpenBSD multimedia computer.
> I plan to attach it on a HDMI TV and play youtube on it, 1080p@30fps
> or more. No 4K involved.
> 
> My thinking is to go for an AMD A8-6500 processor, but I am not sure
> if this is enough.Right now I am using and AMD Athlon II X2 B26 which
> drops some frames on youtube 1080p. I've read that ffmpeg, mpv and
> chromium do not use GPU in any way for decoding in OpenBSD.

This surprises me, your CPU doesn't seem that slow.

> I could not afford to go for performance hardware like Intel Core
> I7-4770, so if you please could you make some suggestion about what
> you run as a minimum requirements? Am I on the right track thinking
> that more powerful CPUs will speed up decoding?

I'd suggest to check where is spent most of the CPU time, in mpv or in
Xorg? You could try different mpv "-vo" options, there are machines
where "-vo x11" is faster than the default one.

HTH



Re: xhci isochronous transfers

2019-03-17 Thread Alexandre Ratchov
On Sat, Mar 16, 2019 at 06:58:55PM -0700, Nam Nguyen wrote:
> 
> > This procedure is sufficient when I use a USB 2 port.
> 
> I forgot to test USB 2 at the time of my original e-mail. There is
> actually a regression and both USB 2 and USB 3 ports throw the same
> error.
> 
> --8<---cut here---start->8---
> uaudio0: can't get iface handle
> uaudio0: can't get iface handle
> audio1: failed to start playback
> uaudio0: can't get iface handle
> --8<---cut here---end--->8---

This this caused by the uaudio driver itself. Could you send me the
dmesg output of a kernel with UAUDIO_DEBUG defined?

Thanks in advance.



Re: video(1) Unable to use webcam

2019-02-19 Thread Alexandre Ratchov
On Tue, Feb 19, 2019 at 06:16:42PM +0200, Vitaly Kovalyshyn wrote:
> I have disabled USB3.0 in the BIOS and my camera now works.
> Thank you.
> 
> Is it posible to use USB3.0 and webcam at the same time in OpenBSD?

Not yet on all machines and webcam combinations.



Re: Setitimer() resolution?

2018-12-14 Thread Alexandre Ratchov
On Thu, Dec 13, 2018 at 09:27:12PM +, Paul Swanson wrote:
> Hi,
> 
> I'm trying to understand how interval timers work in OpenBSD,
> but I'm a little stuck on this line from the getitimer / setitimer man page:
> 
> "Time values smaller than the resolution of the system clock
> are rounded up to this resolution (typically 10 milliseconds)."
> 
> Does this mean that 10 milliseconds is the shortest interval possible
> with a system interval timer?
> 
> If so, are there other userland options for more precise timers?
> 

What would need a more precise timer? with what resolution?

On amd64, you could build a kernel with HZ=1024, which gives a timer
that ticks every 1ms. I use this since ~2005 for MIDI programs.

If the program that needs a precise timer involves audio, you could
also use the sound card clock instead. For instance by running sndiod
with "-z 120" option then call your code in the sio_onmove(3)
call-back. The advantage of this approach is that you get a unique
clock source, which avoids may problems.



Re: Qsynth midi latency not low enough... what to do?

2018-12-02 Thread Alexandre Ratchov
On Sat, Dec 01, 2018 at 01:19:00PM -0600, Adam Thompson wrote:
> PROBLEM STATEMENT: driving FluidSynth from a MIDI controller produces ~1/4sec 
> delay between keypress and sound.
> 
[...]

> Is sndio(4) suitable for real-time(-ish) performance?  Or do I need
> a (OS) platform that does ASIO or JACK?  (I mostly play by ear so
> I'm targeting <<0.1sec latency.)

Yes, sndiod is usable (actually designed for) low-latency usage. You
need to change the sndiod buffer size to whatever your system can
handle (depends on CPU, audio interface). I'd recommend to set in
/etc/rc.conf.local

sndiod_flags=-z240

Let us know how it works. If it works, you could try -z120, that's
what I use on my machines.

-z240 sets the block size to 240 samples, at 48000Hz sample frequency,
this corresponds to 48000Hz / 240 = 5ms block. The total end-to-end
latency is typically 3 blocks, so I'd get 5ms * 3 = 15ms.

FWIW, for music, you shouldn't exceed few tenths of ms of latency.

> 
> Dmesg follows, just in case anyone spots anything useful in there…
> 
> Hardware setup, broadly:
> * Dell Latitude E6430 laptop
>   - booting in EFI mode to work around a weird bootloader bug
> * onboard azalia(4) audio (for now) using onboard speakers (for now)
> * Roland A500PRO MIDI controller, connected via USB
> * M-audio Uno USB-MIDI, nothing connected to it yet
> * No-name USB 5.1ch Audio DAC from Amazon, nothing connected to it yet
>   - (leaving the M-audio umidi and the "ABC" uaudio devices disconnected 
> makes no difference)
> 

The "ABC" USB devices are unlikely to work with small blocks, but
there are fixes comming soon (hopefully).



Re: XORG Doesnt start after syspatch

2018-11-22 Thread Alexandre Ratchov
On Wed, Nov 21, 2018 at 06:12:55PM -0600, Manuel Solis wrote:
> Hello Misc.
> 
> I have installed 64 in a macbook and it works great and out of the box,
> however i notice that after i run syspatch and reboot, xorg doesn´t start
> at all.
> 

Until this problem is fixed, Xorg must be started by root, for
instance with xenodm.



Re: recommended h/w for fanless audio-out?

2018-11-12 Thread Alexandre Ratchov
On Mon, Nov 12, 2018 at 12:30:30PM +, Colin Bortner wrote:
> 
> For the NUC, USB 3.0 can be disabled in the bios, forcing the ehci driver, 
> and allowing me to use the USB DAC without issues. From dmesg:
> 
> [...]
> ehci0 at pci0 dev 29 function 0 "Intel 9 Series USB" rev 0x03: apic 2 int 23
> usb0 at ehci0: USB revision 2.0
> [...]
> uhidev0 at uhub1 port 3 configuration 1 interface 0 "Yoyodyne Consulting 
> ODAC-revB" rev 1.10/0.01 addr 3
> uhidev0: iclass 3/0
> uhid0 at uhidev0: input=19, output=28, feature=0
> uaudio0 at uhub1 port 3 configuration 1 interface 1 "Yoyodyne Consulting 
> ODAC-revB" rev 1.10/0.01 addr 3
> uaudio0: audio rev 1.00, 2 mixer controls
> audio1 at uaudio0
> [...]
> 

out of curiosity, could you post the "uhub" lines as well, to show how
the "uaudio0" device is connected to the "usb0" device?

Thanks.



Re: recommended h/w for fanless audio-out?

2018-11-12 Thread Alexandre Ratchov
On Sun, Nov 11, 2018 at 12:24:05PM -0600, Adam Thompson wrote:
> Hello,
> 
> I’d like to use OpenBSD to build a MIDI synthesizer using
> SoundFonts, as the OpenBSD MIDI and audio subsystems are remarkably
> understandable and sane, compared to everything else out there
> today.
>  �
> 
> However, I’m having difficulty finding a combination of hardware
> that is known to be supported.  (I tried this a few years ago, but
> was unhappy with the results due to the quality of the audio-out
> ports on the laptop I used.)
>  �
> 
> I’ve heard a fair bit here about USB audio not working very well, or
> at all, in -stable right now.  I’m unsure if this only applies to
> XHCI ports or not?

usb audio over xhci doesn't work yet.

> Therefore, ideally, I’d like a fanless amd64 architecture system,
> that boots from SATA (not eMMC) with either onboard stereo++ audio
> (up to and including 7.1ch) *or* a PCI slot for a sound card.
> A laptop with really good audio-out would work, too, but I don’t
> know of any.
> If connecting USB audio to a RPi or BeagleBone Black works well,
> then I could try that, too.
>  �
> I intend to use USB MIDI interfaces, as they appear to be supported
> and working fine (IIRC).

Yes, usb class-compliant MIDI interfaces are expected to work.

>
> The problem is that, as I browse the list of embedded, fanless
> systems I can get from DigiKey, Mouser, et al., all the boards with
> audio have HD Audio Codecs that I cannot confirm work with OpenBSD,
> and I don’t know enough about how azalia(4) [et a.] works with
> random unsupported DACs to drop $250-$500 on something that may or
> may not work (i.e. the codec isn’t explicitly supported).
> 

Most (all?) hd-audio codecs should work. The azalia(4) driver handles
the hd-audio chipset which interacts with the codec in a standardized
way. So the driver doesn't need to care about how codecs work.

This is not 100% true as certain vendor (ex Apple) add non-standard
features on top of this which break things and require quirks.

>
> Can anyone make any recommendations for specific hardware that’s
> fanless and has working audio-out ports?

I've exacly the same project. If you want to build a synth for
real-time performance (ie low-latency), I'd suggest using a PCI audio
interface. Currently I'm using a M-Audio Audiophile 192k and/or a ESI
Julia. I don't have a fanless amd64 board yet, mostly by lazyness and
lack of space on my desk.

For the MIDI the inputs, I'm using USB MIDI interfaces, but the ones
on the above audio interfaces work as well.



Re: Send midi to software

2018-11-04 Thread Alexandre Ratchov
On Sun, Nov 04, 2018 at 10:28:04AM -0500, Ken M wrote:
> As an alternative could I cat rmidi0 to midithru0?
> 

Yes. But we've no utility to do so in base, you could try to install
this one:

http://caoua.org/alex/obsd/midicat.tar.gz

Then do:

midicat -q rmidi/0 -q midithru/0

You could do that with the audio/midish port, but it's too
sophisticated to just move data from one port to another.



Re: Send midi to software

2018-11-04 Thread Alexandre Ratchov
On Sat, Nov 03, 2018 at 02:26:59PM -0400, Ken M wrote:
> So I am sure I am missing something stupid. Just the first time I have tried a
> midi controller with openbsd.
> 
> So the device shows in the dmesg
> a hexdump shows I am receiving sounds
> but in lmms even with a device set to receive midi, nothing happens.
> 
> And yes sound is coming from lmms.
> 
> I am guessing there is something obvious I am missing. lmms is set to 
> sndio-midi
> in the preferences.
> 

IIRC, the lmms sndio-midi backend lacks the "device chooser dialog",
so it uses "default" as midi device, which translates
"midithru/0". Your controller is probably "rmidi/0", so lmms doesn't
use it.

You could workaround this by redefining the "default" midi port,
starting lmms as follows:

MIDIDEVICE=rmidi/0 lmms

assuming "rmidi/0" is your midi controller. Patching the sndio-midi
code to implement the "device chooser" seems to be the nicer option.



Re: Sound from vmm guest

2018-10-27 Thread Alexandre Ratchov
On Fri, Oct 26, 2018 at 07:49:16PM -0400, Ken M wrote:
> 
> xfreerdp /sound:sys:sndio,dev:/dev/audio /v:host
^^

If this is the sndio device name, it should be "default", not "/dev/audio".
You could do "man sndio" to see sndio device names syntax.



Re: Sound from vmm guest

2018-10-27 Thread Alexandre Ratchov
On Fri, Oct 26, 2018 at 07:49:16PM -0400, Ken M wrote:
> So I am working on a bit of an experiment. I have a debian sid guest in vmm.
> xrdp is installed as is the pulse audio module for xrdp so that it can see the
> xrdp output in the mixer. I can connect just fine till I try to get sound out.
> Remmina wouldn't work with sound so to have more control I tried xfreerdp. An
> example of the options I tried.
> 
> xfreerdp /sound:sys:sndio,dev:/dev/audio /v:host
> 
> Basically I can't get it to connect with sound. I can put together a whole log
> and all, but I was wondering if anyone can suggest how the /sound flag should 
> be
> under openbsd, or perhaps an alternate method to get sound out of a vmm guest
> via gui. Or perhaps it is just not possible as of today.
> 
> To mention I did double check I could cat a wav file to /dev/audio and that
> worked just fine.
> 

I don't know how xrdp works.

Usually I use "ssh -X" to connect to the VM, so that programs on the
vm diplay on the host's X server. The same approach works for sound:
on the host run sndiod with the "-L -" option and on the guest:

export AUDIODEVICE=snd@/0

For OpenBSD VMs, it works out-of-the box. On Debian, most programs
must be rebuild with sndio support for this to work. This approach
minimizes the number of software layers for audio, which maximizes
sound stability.

HTH

-- Alexandre



Re: Sndiod restart fixes Chrome sndio_output.cc failed to open device

2018-10-25 Thread Alexandre Ratchov
On Wed, Oct 24, 2018 at 10:23:27PM +0100, Kevin Chadwick wrote:
> I've made the pledge and entered the veil with Chrome.
> 
> Sound works without restarting sndiod in other applications like aucat and
> mozilla apps.
> 
> For some reason the sound does not work in chrome even without enabling the
> veil but restarting sndiod makes it work.

i did a quick test, playback works in chrome; any hints on how to
reproduce the sound problem?



Re: USB Audio, Serial Terminal

2018-10-08 Thread Alexandre Ratchov
On Mon, Oct 08, 2018 at 03:10:58AM -0400, Katherine Rohl wrote:
>
>  The first is using my USB headphones. I’ve tried following the
> instructions in the FAQ (making sure that the audio device is set to
> the correct uaudio) but to no avail. I’ve disabled my system’s
> onboard AC’97 audio to make sure that there is only one audio device
> (confirmed with dmesg, my headphones show up as uaudio0). Which
> configuration stuff do I need to post for y’all to help me? :(

What's the symptom? no sound at all? distorted sound?

You don't need to disable the onboard device; if the usb devices
shows as audio1 in dmesg, just add:

sndiod_flags='-f rsnd/1'

to /etc/rc.conf.local and restard sndiod as:

doas rcctl restart sndiod

Then play any file, ex. "aucat -i /foo/bar.wav" to see it it works. If
it doesn't, first send dmesg (after the test).



Re: opening fifo locks process in D state

2018-09-20 Thread Alexandre Ratchov
On Wed, Sep 19, 2018 at 11:32:40PM +0200, michal.lyszc...@bofc.pl wrote:
> Hello,
> 
> I've stumbled upon a weird problem. Long story short, I try to open
> fifo two times, once O_WRONLY and once O_RDONLY, both in separate
> threads - but on process. Unfortunately both threads are locked in
> open() functions.
> 
> I prepared very small program that reproduces this problem for me,
> please see attached file and note that there is no error handling
> for readability.
> 
> !!! Also note, this program may get stuck in D state,
> and you won't be able to SIGKILL it.
> 
> Anyone got any idea why is this happening? Is something wrong with
> my code?

This is a kernel bug, no program may behave like this.

> It works properly on netbsd, freebsd, aix, hpux and linux.
> 
> I don't know what info exactly you might need, but here is uname,
> it's almost clean system, I didn't make much changes, and
> especially not in the core.
> 
> # uname -a
> OpenBSD bbs-i686-builder-openbsd.kurwinet.pl 6.2 GENERIC#163 i386

This is a old OpenBSD version; I reproduced it on 6.3 but not
on -current (this doesn't mean the bug was fixed).



Re: location of ~/.aucat_cookie

2018-09-14 Thread Alexandre Ratchov
On Fri, Sep 14, 2018 at 09:22:59PM +0200, Olivier Regnier wrote:
> Hi,
> 
> Is it possible to disable the '.aucat_cookie' file or change his location?
> 

This file was renamed to ~/.sndio/cookie in -current. It's necessary
to programs connecting to sndiod, so it can't be deleted unless sndiod
is stopped or no audio programs are used at all.

Out of curiosity, what's the problem with its old location?



Re: autri(4) disabled by default

2018-07-31 Thread Alexandre Ratchov
On Tue, Jul 31, 2018 at 05:51:06PM +0100, Peter Kay wrote:
> On 31 July 2018 at 14:22, Christian Weisgerber  wrote:
> > On 2018-07-31, Janne Johansson  wrote:
> >
> >>> I see autri(4) is disabled by default in an amd64 kernel, probably
> >>> others too, and has been for a very long time.
> >>
> >> Seems like it came over with the initial amd64 port from i386, and noone
> >> tested it on amd64, so it never got enabled but remained commented out.
> >
> > It worked on sparc64, where it is enabled by default, back when I
> > still had a Blade 100.
> 
> I can confirm it does work fine! Checked some Chrome and mplayer, no
> worries with audio. Not sure about MIDI, nothing comes out of the
> sound card but not too fussed about that.
> 

thanks for the confirmation.

the midi(4) device is a simple serial port on the card used to connect
midi gears (synthesizers, keyboards alike). So no sound is expected to
come from the sound card when midi is used.



Re: autri(4) disabled by default

2018-07-31 Thread Alexandre Ratchov
On Tue, Jul 31, 2018 at 11:43:37AM +0100, Peter Kay wrote:
> I see autri(4) is disabled by default in an amd64 kernel, probably
> others too, and has been for a very long time.
> 
> I can't see any notice of why this is so, anyone know?
> 
> My secondary system has a Trident 4DWave in it (yes, it's an old
> soundcard. I grabbed it off ebay to work with Arca Noae, as it's not
> so keen on a Soundblaster Live, and the motherboard is a server one
> without any audio built in)
> 

It could probably be enabled by default (like most of the pci audio
interfaces). When you enable it, does it work?



Re: sndiod internals

2018-06-22 Thread Alexandre Ratchov
On Wed, Jun 20, 2018 at 11:31:37PM +0200, Denis Buga wrote:
> sorry for bad english

no problem

> if simplify, seems like we have three pairs of concepts, while in audio path 
> from file to card
> file (Hz/bit), sndiod (Hz/bit), card (Hz/bit)
> first and third is more or less i understand
> by second i mean sndiod's "dsp" 
> i understand, that, when i set up "sndiod_flags" with frequency "N" and 
> "aucat" file with same "N"
> - i can think about it as, simplifying, "passthrough by frequency"

yes, true

> seems like, the same thing i can think about "bits" in "sndiod_flags"
> my question is about "ADATA_BITS" in "dsp.h":

sndiod always uses ADATA_BITS internally, no matter the file format,
the sound-card format or the sndiod_flags. By default, ADATA_BITS=16,
so it uses 16-bit, signed, native byte order (aka "s16").

> to get "bit-perfect" audio, do i need to set this value in all the way with
> file, sndiod_flags
> if we say that we need "perfect line", is it nessesary to have
> ADATA_BITS same as "-e ...N... " in sndiod_flags
> ?

With ADATA_BITS=16, the only way to get bit-perfect data is to use
files with the "s16" format on a sound-card supporting "s16". The
volume must be set to the maximum (-v 127 -w off), so that sndiod wont
modify the samples, and only one program must be playing.

Note that if the file is 8-bit or 16-bit non-native byte order, the
resulting data won't have the same binary representation, but I'd
qualify the resulting sound as bit-perfect. This is because the
original bits representation can be recovered back from the sndiod
output.

As long as sndiod and the sound-card have better precision than the
file, the sound restitution will be perfect (assuming there's no
sample frequency conversion, volume changes, etc).



Re: Reading files faster than raw disk?

2018-06-15 Thread Alexandre Ratchov
On Fri, Jun 15, 2018 at 09:10:44AM +0200, Maximilian Pichler wrote:
> 
> For the raw device (rsd1c):
> $ doas cat /dev/rsd1c | pv -bra -Ss500m | sha1
>  500MiB [25.5MiB/s] [25.5MiB/s]
> ca17bdb9a657bbcf654a60057861be8fe02df0b1
> 

I don't understand above commads. If you do:

$ dd if=/dev/rsd1c of=/dev/null bs=1m

then hit ^C, the command will display the throughput with 1MB
reads. They should be faster than file reads, as you expect.



Re: Different sound sources interfere with each other

2018-06-14 Thread Alexandre Ratchov
On Thu, Jun 14, 2018 at 08:40:56AM +0300, Максим wrote:
> Hello,
> I use USB headphones on OpenBSD amd64 6.3
> So they are detected on the system:
> uaudio0 at uhub3 port 2 configuration 1 interface 0 "Sennheiser 
> Communications Sennheiser USB headset" rev 1.10/1.00 addr 3
> uaudio0: audio rev 1.00, 8 mixer controls
> audio1 at uaudio0
> 
> I've set up  this audio device in accordance with official FAQ 
> (https://www.openbsd.org/faq/faq13.html#confaudio)
> cat /etc/rc.conf.local
> "sndiod_flags=-f rsnd/1"
> 
> The first problem is: when I listen to music (cmus) and browse in the 
> internet (Firefox) cmus sometimes stops playing for a second.
> This happens when I click a link on a page or receive some notification from 
> the web page (which may play some short sound)
> 
> The second problem is: when some audio source is played (online video or some 
> music file) the sound is sometimes distorted or it bursts.
> To fix this I have to pause and unpause the sound source several times.
> 
> What can be a problem? Do I need any additional setup for my audio device?

Sounds like a driver bug. Your setup is correct.

The interaction between programs is probably coincidence, I guess
another program would hurt audio as well. To confirm this is not
caused by sndiod, you could try the same setup on a PCI device and
check that the problem is disappears.



Re: connect two midi devices

2018-05-26 Thread Alexandre Ratchov
On Sat, May 26, 2018 at 12:10:03AM +0200, Sebastian Reitenbach wrote:
> Am Freitag, Mai 25, 2018 22:22 CEST, Alexandre Ratchov <a...@caoua.org> 
> schrieb:
> 
> > On Fri, May 25, 2018 at 10:22:26AM +0200, Sebastian Reitenbach wrote:
> > > Hi Alexandre,
> > >
> > > Am Freitag, Mai 25, 2018 08:41 CEST, Alexandre Ratchov <a...@caoua.org> 
> > > schrieb:
> > >
> > > > On Fri, May 25, 2018 at 12:21:18AM +0200, Alexandre Ratchov wrote:
> > > > >
> > > > > Maybe, but unlikely. If the device attaches, generally it works. Show
> > > > > what's received on midi2 when you type on the keyboard or do any other
> > > > > simple actions.
> > > > >
> > > >
> > > > fwiw, here's a small utility that I use very often to debug & connect
> > > > MIDI ports.
> > > >
> > > > http://caoua.org/alex/obsd/midicat.tar.gz
> > > >
> > > > To connect two rmidi/2 -> rmidi/1 and dump the data on stderr, run:
> > > >
> > > > midicat -d -q rmidi/2 -q rmidi/1
> > >
> > >  Actually, that midicat seems to do the trick. When I run it in debug, 
> > > and press some keys on the
> > > system-1, output looks like:
> > >
> > > f8
> > > f8
> > > fe
> > > f8
> > > f8
> > > f8
> > > 90 80 9b
> >
> > ^^^
> >
> > these 3 bytes make no sense. The status byte 0x90 is correct but the
> > two args are wrong. This is when you pressed the key, right?
> >
> > > ...
> > > 90 9b b2
> >
> > These are also wrong, and this is when you released the key, right?
> > Interestingly the 0x9b is repeated.
> >
> 
> f8
> f8
> f8
> 90 80 34
> 90 40 f8
>  released key

This one is cleary wrong. 0x90 must be followed by two numbers in the
0..0x7f range.

> >
> > Clearly, the midi events are corrupted by the usb interface. Does the
> > midi interface claim to be "class compliant"? does it come with
> > drivers for MacOS or Windows?
> 
> It was advertized as class compliant, and it just came the cable, no drivers.
> But as I said, it was el-chepo from ebay not even 3 EUR incl. shipping from 
> China.
> 

do you know if it works on other operating systems?



Re: connect two midi devices

2018-05-25 Thread Alexandre Ratchov
On Fri, May 25, 2018 at 10:22:26AM +0200, Sebastian Reitenbach wrote:
> Hi Alexandre,
> 
> Am Freitag, Mai 25, 2018 08:41 CEST, Alexandre Ratchov <a...@caoua.org> 
> schrieb:
> 
> > On Fri, May 25, 2018 at 12:21:18AM +0200, Alexandre Ratchov wrote:
> > >
> > > Maybe, but unlikely. If the device attaches, generally it works. Show
> > > what's received on midi2 when you type on the keyboard or do any other
> > > simple actions.
> > >
> >
> > fwiw, here's a small utility that I use very often to debug & connect
> > MIDI ports.
> >
> > http://caoua.org/alex/obsd/midicat.tar.gz
> >
> > To connect two rmidi/2 -> rmidi/1 and dump the data on stderr, run:
> >
> > midicat -d -q rmidi/2 -q rmidi/1
> 
>  Actually, that midicat seems to do the trick. When I run it in debug, and 
> press some keys on the
> system-1, output looks like:
> 
> f8
> f8
> fe
> f8
> f8
> f8
> 90 80 9b

^^^

these 3 bytes make no sense. The status byte 0x90 is correct but the
two args are wrong. This is when you pressed the key, right?

> ...
> 90 9b b2

These are also wrong, and this is when you released the key, right?
Interestingly the 0x9b is repeated.

> f8
> f8
> f8
> f8
> 
>  However, some keys I have to press multiple times until the Rocket Synth 
> recognizes it, and
> some other note from the synth, doesn't produce any sound on the Rocket.
> However, when I connect the System 1 MIDI out, with a straight MIDI cable to 
> MIDI in
> on the Rocket, I can play these notes, and it produces sound, on each key 
> press.
> 

Clearly, the midi events are corrupted by the usb interface. Does the
midi interface claim to be "class compliant"? does it come with
drivers for MacOS or Windows?

> The System-1, as well as the TB-3 are connected to my MX-1 via USB.
> I noticed I have to disconnect the USB from the system-1. Only then it seems 
> to
> send out MIDI data on the MIDI port.
> Maybe that was my main problem yesterday.
> Since I use the USB connection to the MX-1 for MIDI and SOUND, disconnecting
> the USB cable from the system-1 or tb-3 would spoil my setup.
> The Roland Aira gear doesn't seem to have a mode to support class compatible
> MIDI via USB. It only provides some USB Disk modes for backup/restore and
> firmware updates.
> 
> 
> I wonder how I could tell midicat which midi channel to use. I.e. I cound 
> connect
> the USB-to-MIDI converter to the Roland MX-1, and since all the other gear is
> connected there, it might work out, when the MX-1 is set to MIDI passthrough.
> But I might be able to tell midish to connect that same hardware midi device
> as input to output, but with different midi channels?

If you use the MIDI passthrough, events will be broadcast to both
devices, so you'll have to configure each device to ignore channels
that you want the other device to handle.

midicat just moves the data, so you it can't change the channel
numbers. To change the channel you can use the fmap rule in midish.



Re: connect two midi devices

2018-05-25 Thread Alexandre Ratchov
On Fri, May 25, 2018 at 12:21:18AM +0200, Alexandre Ratchov wrote:
> 
> Maybe, but unlikely. If the device attaches, generally it works. Show
> what's received on midi2 when you type on the keyboard or do any other
> simple actions.
> 

fwiw, here's a small utility that I use very often to debug & connect
MIDI ports.

http://caoua.org/alex/obsd/midicat.tar.gz

To connect two rmidi/2 -> rmidi/1 and dump the data on stderr, run:

midicat -d -q rmidi/2 -q rmidi/1



Re: connect two midi devices

2018-05-24 Thread Alexandre Ratchov
On Thu, May 24, 2018 at 08:31:08PM +0200, Sebastian Reitenbach wrote:
> Hi,
> 
> I've finally got an el cheapo USB to midi converter. I just wanted to test
> if I can make use of my Roland Aira gear that way, because the USB connection
> is not class compliant. 

FYI, certain Roland gears have a "generic" and "vendor" usb modes. In
the "generic" mode it's class-compliant, works on openbsd but crashes
windows. In the "vendor" mode (the default) it requires a window
driver. Anyway...

> Additionally I've two synths connected to the box:
> 
> umidi0 at uhub0 port 2 configuration 1 interface 1 "Waldorf Music GmbH 
> Rocket" rev 1.10/1.01 addr 2
> umidi0: (genuine USB-MIDI)
> umidi0: out=1, in=1
> midi0 at umidi0: 
> umidi1 at uhub0 port 3 configuration 1 interface 1 "Waldorf Music GmbH 
> Streichfett" rev 1.10/0.00 addr 3
> umidi1: (genuine USB-MIDI)
> umidi1: out=1, in=1
> midi1 at umidi1: 
> umidi2 at uhub3 port 4 configuration 1 interface 1 "vendor 0x15ca VIEWCON.." 
> rev 1.10/f1.10 addr 3
> umidi2: (genuine USB-MIDI)
> umidi2: out=1, in=1
> midi2 at umidi2: 
> 
> generally, the synths can make sounds, just tested with midish, and ran the 
> metronome.
> On the USB to MIDI converter I have a Roland Aira System-1 connected.
> 
> testing this:
> hexdump -e '1/1 "%02x\n"' < /dev/rmidi0
> 90
> 40
> f8
> *
> fe
> f8
> *
> 90
> 4a
> 64
> f8
> *
> 
> generally seems to work I'd say.

Yeah. So midi0 generates correct events. Does midi2 produce similar
events?  could you show what typing on keys produces?

> However, trying to connect the USB/MIDI converter as input to one of the 
> synths as described in midi(4):
> cat -u /dev/rmidi2 >/dev/rmidi1
> 
> doesn't produce any sound.
> 
> I tried midish to connec both as well, my .midishrc:
> dnew 0 "rmidi/1" wo
> dnew 1 "rmidi/2" ro
> 
> $ midish
> [:00]> fnew yalla
> [:00]> fmap {any 0}{any 1}

you need to map rmidi/2 -> rmidi/1, so this should be:

fmap {any 1} {any 0}

you could type 'debug mididev 1' to see what's being sent and/or
received from devices.

> [:00]> i
> 1: sensing enabled
> norm_kill: noff {1 0} 32 64: killed
> norm_kill: noff {1 0} 32 64: killed
> norm_kill: noff {1 0} 34 64: killed
> norm_kill: noff {1 0} 34 64: killed
> norm_kill: noff {1 0} 35 64: killed
> norm_kill: noff {1 0} 35 64: killed
> norm_kill: noff {1 0} 30 64: killed
> norm_kill: noff {1 0} 30 64: killed
> norm_kill: noff {1 0} 32 64: killed
> norm_kill: noff {1 0} 32 64: killed
> norm_kill: noff {1 0} 34 64: killed
> norm_kill: noff {1 0} 34 64: killed

it seems that device 1, ie midi2 sends note-on events but not the
matched note-off events.

> [:00]>
> 
> these lines come when I push some keys of the keyboard on the system-1.
> 
> When I directly connect the system-1 MIDI-OUT to the Rocket MIDI-IN
> I get nice sounds from the rocket.
> I tried both synths on the output side, and on the input side with the
> USB/MIDI converter I tried SYSTEM-1 and TB-3 but with both the same
> no sound effect.
> 
> any idea what my problem is? It's just el cheapo USB/MIDI converter?

Maybe, but unlikely. If the device attaches, generally it works. Show
what's received on midi2 when you type on the keyboard or do any other
simple actions.



Re: sndio multiple interfaces

2018-05-21 Thread Alexandre Ratchov
On Sun, May 20, 2018 at 06:49:25PM -0400, Ken M wrote:
> Been looking around and can't find the answer to this question. If I missed it
> in some obvious place please excuse me.
> 
> Anyway I am curious if sndio can support multiple simultaneous cards, either
> identical or different, particularly multiple standards compliant USB audio
> interfaces. Basically I am asking if it supports similar features to what one
> might use zita with jack on a linux system.

This doesn't work with sndio. It's difficult to make work because each
audio interface would use its own clock source, and clocks would drift
sooner or later. Drift may be corrected, but this would cost
additional latency, complexity and (probably) quality problems.

That's why certain devices have a "word clock", to allow audio devices
to by synchronized; OpenBSD doesn't support any of them, but
supporting them looks much easier than combining multiple devices.

Nowadays many-channel devices are common, so supporting multiple cards
as one isn't that important, is it?



Re: Audio stuttering on media playback with sndiod

2018-04-24 Thread Alexandre Ratchov
On Sat, Apr 14, 2018 at 11:55:23AM +0200, Alexandre Ratchov wrote:
> On Tue, Apr 10, 2018 at 03:20:33PM +0200, Robert Klein wrote:
> > Hi Daniel,
> > 
> > On Wed, 4 Apr 2018 03:22:04 -0300
> > Daniel Bolgheroni <dan...@bolgh.eng.br> wrote:
> > 
> > > Hi,
> > > 
> > > audio is stuttering on media playback when run through sndiod. It's OK
> > > without it.
> > 
> > Maybe related.  Yesterday I disabled webcam and microphone in BIOS on
> > my X250.  Then Video playback (audio and video) was stuttering. I
> > didn't investigate further, as: reverting BIOS settings made it Ok
> > again.
> 
> Thanks. Few notes for the mailing-list archives:
> 
> Certains laptops have a "disable microphone" knob in the BIOS which
> makes the device operate play-only, but it still reports full-duplex
> capability. This confuses any full-duplex program, including sndiod,
> and makes sound stutter. I've found no way to detect this situation.
> 
> Until we manage to properly detect it in the azalia driver, I'd
> suggest not using the BIOS knob (ie keep your microphone enabled). To
> disable it, run as root:
> 
>   chmod 600 /dev/audio[0-9]

As noted by florian@, the proper mode is 0622 (write-only, i.e.
play-only). thanks.



Re: Audio stuttering on media playback with sndiod

2018-04-14 Thread Alexandre Ratchov
On Tue, Apr 10, 2018 at 03:20:33PM +0200, Robert Klein wrote:
> Hi Daniel,
> 
> On Wed, 4 Apr 2018 03:22:04 -0300
> Daniel Bolgheroni  wrote:
> 
> > Hi,
> > 
> > audio is stuttering on media playback when run through sndiod. It's OK
> > without it.
> 
> Maybe related.  Yesterday I disabled webcam and microphone in BIOS on
> my X250.  Then Video playback (audio and video) was stuttering. I
> didn't investigate further, as: reverting BIOS settings made it Ok
> again.

Thanks. Few notes for the mailing-list archives:

Certains laptops have a "disable microphone" knob in the BIOS which
makes the device operate play-only, but it still reports full-duplex
capability. This confuses any full-duplex program, including sndiod,
and makes sound stutter. I've found no way to detect this situation.

Until we manage to properly detect it in the azalia driver, I'd
suggest not using the BIOS knob (ie keep your microphone enabled). To
disable it, run as root:

chmod 600 /dev/audio[0-9]

and restart audio programs (or reboot if unsure). This is reliable
because sndiod has no root privileges; even if it is compromised, the
attacker won't be able to record. And this works for everyone, even
for those without the BIOS "feature" :-)

HTH



Re: Intel C610 azalia (ALC888) not configuring at /dev/audio

2018-01-21 Thread Alexandre Ratchov
On Fri, Jan 19, 2018 at 05:23:06PM -0800, yu...@cock.li wrote:
> Hello,
> 
> I have just installed the latest snapshot and audio is not configuring,
> i.e. the output of mixerctl, audioctl, et al are "device not configured".
> My motherboard is a Supermicro X10DAL-I-O, which has the Intel C610
> chipset, and the audio codec is the Realtek ALC888, although the latter
> is not immediately relevant, as the azalia driver does not even get to
> the stage of evaluating the codec; pertinent dmesg output with GENERIC.MP
> modified with AZALIA_DEBUG enabled:

Thanks, the output of AZALIA_DEBUG is very useful. So, you confirm
that this used to work, and something broke it in last snaps.

Are there audio-related BIOS options that may have changed recently,
including because of BIOS update or whatever?

> azalia1 at pci0 dev 27 function 0 "Intel C610 HD Audio" rev 0x05: msi
> azalia_reset: resetting
> azalia_reset: reset counter = 0
> azalia1: reset failure
> azalia_pci_detach
> azalia_pci_detach: delete streams
> azalia_pci_detach: delete codecs
> azalia_pci_detach: delete CORB and RIRB
> azalia_pci_detach: disable interrupts
> azalia_pci_detach: clear interrupts
> azalia_pci_detach: delete PCI resources
> 
> For reference, azalia0 was my AMD GPU's HDMI/DisplayPort audio (I
> understand from the man page that this is unsupported; thankfully I
> have no need of it).
> 
> Grepping through the source shows that this is a supported chipset;
> what gives? Any and all help is appreciated. Might it have something
> to do with it being the second device that azalia(4) tries to set up?

There's no interaction between azalia1 and azalia0.



Re: How to share a secret between a process and its children ?

2017-11-17 Thread Alexandre Ratchov
On Thu, Nov 16, 2017 at 08:08:30PM +0100, Stephane Martin wrote:
> Hello,
> 
> I need to share a short secret (say, 32 bytes long) between a process - the 
> father - and its children.
> 
> The father process generates a random secret at launch. Then it
> launches multiple children, and children also have children. Both
> fork and execve are used. The whole tree uses the same Unix user
> (say, 'daemon')
>
> I need each child to be able to access the common secret. But other
> processes that are not descendants of the father process must not be
> able to access the secret, even if they also run under 'daemon’.

On unix, the user-id is the thing that ensures isolation. You can't
hide secrets from processes that belong to the same user-id. The
easier is to run the processes that shares the secret as a dedicated
user-id and use any suitable ipc mechanism.



Re: usb MIDI keyboard

2017-05-25 Thread Alexandre Ratchov
On Wed, May 24, 2017 at 10:33:16PM -0400, David H. Rhodes Clymer wrote:
> So, I'm attempting to set up my midi controller/keyboard. Since this
> is not itself a synthesizer, I need to hook it up to a software
> synthesizer via my computer. Thus far I've failed to get it working.
> 
> My keyboard appears to be detected by kernel:
> 
> umidi0 at uhub3 port 2 configuration 1 interface 1 "Arturia Arturia MiniLab 
> mkII" rev 2.00/1.00 addr 6
> umidi0: (genuine USB-MIDI)
> umidi0: out=1, in=1
> midi0 at umidi0: 
> ugen3 at uhub3 port 2 configuration 1 "Arturia Arturia MiniLab mkII" rev 
> 2.00/1.00 addr 6
> 
> 
> It appears that I'm recieving MIDI commands from the keyboard:
> 
> $ hexdump -e '1/1 "%02x\n"' < /dev/rmidi0
> 90
> 3c
> 40
> 80
> 3c
> 00
> 
> 

the device works as expected


> I Can play MIDI files through synthesizer:
> 
> $ fluidsynth -vs /usr/local/share/generaluser-gs/GeneralUser_GS.sf2
> 
> $ midiplay -vf midithru/0 Downloads/MIDI_sample.mid 
> Playing Downloads/MIDI_sample.mid (8444 bytes) ... 
> ^C
> 
> I don't even know if this makes sense, but attempting to "play" the
> midi device doesn't seem to do anything when I play the keyboard:
> 
> $ midiplay -vf midithru/0 /dev/rmidi0
> ^C
> 

this doesn't make sense, because midiplay expects .mid files and
will try to parse a .mid header.  The midi device reads as raw midi
data

> 
> I've installd midish, and attempted to configure it to take my keyboard
> input send it to the synthesizer.
> 
> midish config:
> 
> # Device 0: Arturia MKII
> dnew 0 "rmidi/0"ro
> 
> # Device 1: fluidsynth
> dnew 1 "midithru/0" wo
> 
> # Connect mkii to fluidsynth
> fnew fluidsynth
> fmap {any 0} {any 1}
> 

this is correct, but you need to run the "i" command to start it
processing.  Then, it's supposed to work, assuming fluidsynth is
still running.



Re: Audio playback issue on old Thinkpad

2017-05-19 Thread Alexandre Ratchov
On Wed, May 17, 2017 at 06:50:29PM +0100, multiplex'd wrote:
> On Wed, May 17, 2017 at 05:25:14PM +0200, Alexandre Ratchov wrote:
> > On Wed, May 17, 2017 at 02:27:38PM +0100, multiplex'd wrote:
> > > Hello all,
> > > 
> > > I have an IBM T22 Thinkpad running OpenBSD 6.1. Recently, I've been trying
> > > to play audio on the system but I've run into some trouble.
> > > 
> > > I'm using mplayer from packages, but when I try to play an audio file the
> > > playback is extremely slow and of very poor quality (changing the format 
> > > of 
> > > the audio file used does not change this behaviour). However, if I start
> > > disk-heavy activity at the same time, such as running 'ncdu' (from 
> > > packages)
> > > or 'find /' then suddenly playback is normal and as expected until 
> > > mplayer 
> > > spontaneously catches signal 13 (SIGPIPE according to 
> > > /usr/include/sys/signal.h).
> > 
> > could you provide the output of dmesg ?
> 
> dmesg attached below.

> cbb0 at pci0 dev 2 function 0 "TI PCI1450 CardBus" rev 0x03: irq 11
> cbb1 at pci0 dev 2 function 1 "TI PCI1450 CardBus" rev 0x03: irq 11
> fxp0 at pci0 dev 3 function 0 "Intel 8255x" rev 0x0c, i82550: irq 11, address 
> 00:03:47:b9:1f:6b
> clcs0 at pci0 dev 5 function 0 "Cirrus Logic CS4280/46xx CrystalClear" rev 
> 0x01: irq 11
> uhci0 at pci0 dev 7 function 2 "Intel 82371AB USB" rev 0x01: irq 11
> cardslot0 at cbb0 slot 0 flags 0
> cardbus0 at cardslot0: bus 2 device 0 cacheline 0x8, lattimer 0xb0
> pcmcia0 at cardslot0
> wdc2 at pcmcia0 function 0 "Kingston, ULTIMATE CF CARD, " port 0xa000/16
> wd1 at wdc2 channel 0 drive 0: 
> wd1: 1-sector PIO, LBA48, 30495MB, 62455680 sectors
> wd1(wdc2:0:0): using BIOS timings

There are 5 devices that share the same interrupt (2 cardbus, 1
nic, 1 audio, 1 usb), not optimal, but sharing interrupts is
supposed to work.

The fact that disk activity "fixes" playback suggests something is
disturbing audio interrupts.  According to your dmesg, you've a
hard-disk connected to the cardbus device.

Could you confirm that audio works if cardbus is disabled?  this
would give hints about in which driver to look for the bug.



Re: Audio playback issue on old Thinkpad

2017-05-17 Thread Alexandre Ratchov
On Wed, May 17, 2017 at 02:27:38PM +0100, multiplex'd wrote:
> Hello all,
> 
> I have an IBM T22 Thinkpad running OpenBSD 6.1. Recently, I've been trying
> to play audio on the system but I've run into some trouble.
> 
> I'm using mplayer from packages, but when I try to play an audio file the
> playback is extremely slow and of very poor quality (changing the format of 
> the audio file used does not change this behaviour). However, if I start
> disk-heavy activity at the same time, such as running 'ncdu' (from packages)
> or 'find /' then suddenly playback is normal and as expected until mplayer 
> spontaneously catches signal 13 (SIGPIPE according to 
> /usr/include/sys/signal.h).

could you provide the output of dmesg ?



Re: ThinkPad x250 with USB DAC (Audioquest DragonFly v1.2)

2017-05-09 Thread Alexandre Ratchov
On Tue, May 09, 2017 at 11:00:26AM +0100, Caolan McMahon wrote:
> 
> $ usbdevs
> addr 1: xHCI root hub, Intel
>  addr 5: AudioQuest DragonFly, AudioQuest inc.
>  addr 2: VFS5011 Fingerprint Reader, Validity Sensors
>  addr 3: Bluetooth, Intel
>  addr 4: Integrated Camera, J8AECPB08
> addr 1: EHCI root hub, Intel
>  addr 2: Rate Matching Hub, Intel
> 
> $ mplayer beep.wav
> # I hear nothing
> 
> $ dmesg
> ...
> uaudio0 at uhub0 port 1 configuration 1 interface 0 "AudioQuest inc.
> AudioQuest DragonFly" rev 1.00/1.20 addr 5
> uaudio0: audio rev 1.00, 2 mixer controls
> audio1 at uaudio0
> uaudio_chan_open: error creating pipe: err=INVAL endpt=0x01
^

Saddly, the xhci driver doesn't support isochronous transfers yet. 
You could try to disable the xhci driver and see if it works.



Re: Setting flags on /dev/audio

2016-10-07 Thread Alexandre Ratchov
On Fri, Oct 07, 2016 at 08:11:46AM +1100, Tobias Brodel wrote:
> On 10/06/16 22:44, ludovic coues wrote:
> >misc strip attachment. Please send your diff inline or start a new thread
> >on dev
> Thanks forthe pointer Ludovic,
> 

Hi,

We moved significant parts of the audio and MIDI sub-system out of
the kernel, so now programs have to use the sio_open(3) interface. 
The audio(4) interface is just a thin private layer to access the
bare hardware internally.  From this stand-point changes in
audio(4) that are not used by the library make no sense.



Re: how would you troubleshoot stuttering video? (Lenovo Thinkpad)

2016-07-18 Thread Alexandre Ratchov
On Mon, Jul 18, 2016 at 04:01:30PM +0800, Miles Keaton wrote:
> On Mon, Jul 18, 2016 at 3:09 PM, Alexandre Ratchov <a...@caoua.org> wrote:
> 
> > could you go in the bios setup and see if there are options to
> > disable audio recording?  If so, could you enable recording and see
> > what happens?
> >
> 
> That fixed it. Thank you!
> 
> So, (for the list archives), azalia audio driver :
> http://man.openbsd.org/OpenBSD-current/man4/azalia.4
> 
> dmesg cliip:
> azalia1 at pci0 dev 27 function 0 "Intel 8 Series HD Audio" rev 0x04: msi
> azalia1: codecs: Realtek ALC292
> audio0 at azalia1
> 
> When hardware microphone is disabled in BIOS, audio will stutter.  Enabling
> hardware microphone again makes audio work fine.
> 
> Very strange, but true.
> 

When the microphone is disabled, the azalia driver gets confused on
certain machines.  We need to fix it (ie make the device appear
play-only), but I don't have a machine that reproduces the problem.

If you have some time, could you build a kernel with the
AZALIA_DEBUG option, reboot using the new kernel and send me the
output of dmesg once with the mic disabled in the bios and once
with the mic enabled.  This way we could compare them and possibly
find a fix.

thanks



Re: how would you troubleshoot stuttering video? (Lenovo Thinkpad)

2016-07-18 Thread Alexandre Ratchov
On Mon, Jul 18, 2016 at 02:46:52PM +0800, Miles Keaton wrote:
> Lenovo ThinkPad T440s : just a couple years old.
> 
> Triple-booting Arch Linux and Windows too, it's plenty fast to watch even
> huge HD 1080p movies.
> 
> But on a new stock OpenBSD (dmesg below) it does that stuttering thing with
> all video, even the tiniest little YouTube or low-resolution mp4 file, even
> if only 3 seconds long:  "ev.. er...y  th... ing... stut... ters... a...
> few... times... per... sec... ond...", whether using mplayer or browser or
> any other method I've tried.
> 
> I saw http://www.openbsd.org/faq/faq13.html#audioserver and tried the
> `rcctl set sndiod flags -b2400` advice with various frames values, huge and
> small, but it had no effect.
> 
> Any pointers for what you'd look at, if it were you, to troubleshoot this?
> I'm happy to do the work, but sorry I don't know where to start.

could you confirm that audio stutters even if video is not
involved?



Re: Overide NGROUPS_MAX

2016-07-12 Thread Alexandre Ratchov
On Tue, Jul 12, 2016 at 04:11:07PM +, Sébastien Morand wrote:
> Hi everybody,
> 
> I'm implementing a samba share on OpenBSD 5.9 and I'm getting in trouble
> because of the NGROUPS_MAX limitation to 16 groups per user. Is there any
> way to increase this value?
> 
> For instance recompiling kernel with /usr/src/sys/sys/syslimits.h modified
> (NGROUPS_MAX to 32 or 64)? Using yellowpage?
> 
> The same computer is an nfs client and nfs server (looks like the
> limitation apply over there too).
> 

iirc, this a limitation of the network protocol itself



Re: pulseaudio RTP Streaming problem on X11 Desktop

2016-05-05 Thread Alexandre Ratchov
On Wed, May 04, 2016 at 06:58:01PM +0300, freeunix freeunix wrote:
> hi, I use the OpenBSD 5.9 amd64 snapshots.
> and XDM Remote Deskop using is marvelous for OpenBSD.
> 
> Now I have any problem.(I want use audio streaming for firefox.)
> I tried to use pulseaudio. but couldn't work it.
> 

Are both client and server running OpenBSD?  If so, you could use
sndiod instead of pulseaudio to forward audio.  On the system with
the sound card, setup sndiod to use the -L option, for instance
run:

rcctl set sndiod flags -L -

and on all the systems where audio programs run export
the environment variable:

AUDIODEVICE=snd@hostname/0

where hostname is the network address of the system with the sound
card.

-- Alexandre



Re: Recording computer sound.

2016-04-13 Thread Alexandre Ratchov
On Tue, Apr 12, 2016 at 08:22:40AM +0300, li...@wrant.com wrote:
> Mon, 11 Apr 2016 19:17:31 +0200 Alexandre Ratchov <a...@caoua.org>
> > On Sun, Apr 10, 2016 at 12:16:42PM +0300, li...@wrant.com wrote:
> > > 
> > > Just an idea, before providing a diff, does it look like a good
> > > candidate to go into FAQ13.4?  Thank you for your consideration.
> > 
> > Yes, this would be good candidate (for the FAQ 13.5), as this is
> > not the first time this is being discussed.
> 
> Same observation here.  I was suggesting it could be a continuation of
> the record audio sub-section 13.4, now doing it for 13.5 in accordance
> with your recommendation and renumbering below (and the index page).
> 
> Thank you for clarifying the numbering point, mailing the diff shortly.
> 
> > Basically this proves that the code is not simple enough and
> > usability needs to be improved.
> 
> And additionally shows an important feature either not directly obvious
> from the manual, or merely frequently used enough to need a FAQ mention.

I use it all the time, others seem to use it as well; we should
enable it by default



Re: Recording computer sound.

2016-04-11 Thread Alexandre Ratchov
On Sun, Apr 10, 2016 at 12:16:42PM +0300, li...@wrant.com wrote:
> 
> Just an idea, before providing a diff, does it look like a good
> candidate to go into FAQ13.4?  Thank you for your consideration.
> 

Yes, this would be good candidate (for the FAQ 13.5), as this is
not the first time this is being discussed.

Basically this proves that the code is not simple enough and
usability needs to be improved.



Re: Recording computer sound.

2016-04-09 Thread Alexandre Ratchov
On Fri, Apr 08, 2016 at 07:09:59PM -0300, Henrique N. Lengler wrote:
> Hi,
> 
> Is there a way to record the sound playing on my speakers?
> Like duplicating it and saving on my computer everything that goes out to the
> speaker.
> 
> I would like to to this to record some screencast.
> 
> Any way of doing this?
> 

First you have to create a record-whay-you-hear device (aka
monitoring), for instance add these options to /etc/rc.conf.local:

sndiod_flags=-s default -m play,mon -s mon

see -m and -s options in sndiod man page for more details.  Then,
restart sndiod with:

rcctl restart sndiod

Then, use your favourite program to record audio and configure it
to record from device "snd/0.mon".  Example:

aucat -f snd/0.mon -o file.wav

at this point whatever your system plays is recorded into file.wav.

HTH



Re: simultaneous sound as many users

2016-04-03 Thread Alexandre Ratchov
On Sat, Apr 02, 2016 at 05:50:33PM +0200, Marc Espie wrote:
> On Sat, Apr 02, 2016 at 09:26:40AM +0200, Nils Reuße wrote:
> > On 04/01/2016 08:42 PM, Roman Gorelov wrote:
> > >My sndio configuration is default, OBSD 5.9.
> > >When I run a media file in e.g. mpv, and pause it without closing, and
> > >try to listen to smth in chrome _as another user_, there is no sound:
> > >
> > 
> > Hi Roman,
> > 
> > you need to share your sndio session cookie between the two users.  I got it
> > working previously (the same problem arises with mpd, where the daemon runs
> > as a separate user).  There should be a file called `~/.aucat_cookie` in
> > your home-dir, and if i remember correctly, you just need to copy this file
> > to the second users home dir.  Will check later when i'm back at home.
> > 
> > From sndio(7):
> > 
> > AUTHENTICATION
> > 
> >   If a shared sndiod(8) server is running, for privacy reasons only one
> >   user may have connections to it at a given time (though the same user
> >   could have multiple connections to it).  Users are identified by their
> >   session cookie, which is automatically generated by audio or MIDI
> >   applications upon the first connection to the server.  The cookie is
> >   stored in $HOME/.aucat_cookie and contains 128 bits of raw random
> >   data.
> > 
> >   If a session needs to be shared between multiple users, they can
> >   connect to the server using the same cookie.
> 
> This looks slightly bogus to me.   Using sndio in record mode, I understand
> the privacy concerns. But for playing ?

For instance, we don't want other users to play sounds during VoIP
calls.



Re: No sound through headphones on laptop (HP 9480m)

2016-03-10 Thread Alexandre Ratchov
On Tue, Mar 08, 2016 at 09:44:42AM -0800, Simon McFarlane wrote:
> >
> >try to toggle outputs.hp_boost and/or outputs.hp_eapd and possibly
> >crank inputs.dac-0:1 to 255
> >
> >do you still hear nothing?
> 
> Out of those, only changing inputs.dac-0:1 to 255 had any audible effect. I
> heard a very short buzzing sound from my headphones intermittently. Nothing
> that sounded like what I was trying to play.
> 

could you try to restart sndiod with '-c 0:3' this will force the
device to use all 4-channels (2 speakers + 2 headphones).  This is
to force the headphones dac to be used.



Re: sndiod fallback trouble

2016-02-28 Thread Alexandre Ratchov
On Sat, Feb 27, 2016 at 01:41:15PM -0500, Michael Reed wrote:
> On 02/27/16 04:15, Alexandre Ratchov wrote:
> >A nicer approach would be to handle this in sndiod by allowing
> >sub-devices (aka -s options) to change their device (aka -f
> >option).  The advantage of doing it in sndiod is that later this
> >could happen dynamically (ex.  unplug usb cable and programs
> >migrate to another device).
> 
> So, if I had program A connected to snd/0 (backed by rsnd/1), and
> rsnd/1 was unplugged during playback, then snd/0's backing device
> would be changed to rsnd/0?

yes that would work.  The hardest part is how to expose it without
adding a gazillon of flags & options.



Re: sndiod fallback trouble

2016-02-28 Thread Alexandre Ratchov
On Sat, Feb 27, 2016 at 10:32:30AM +0100, Matej Nanut wrote:
> On 27 February 2016 at 10:15, Alexandre Ratchov <a...@caoua.org> wrote:
> > One option would to patch libsndio to try more devices (how many?).
> 
> I've also noticed this issue and have hacked libsndio to try snd/0 and
> snd/1 first, which is basically the same as your suggestion.
> 
> > A nicer approach would be to handle this in sndiod [...]
> 
> That would be fantastic, but seems like quite a lot of work. I don't
> know enough about the audio stack to really comment, but can't there
> be problems with a device changing for the program mid stream? Or
> would you add a special "trunk-like" pseudo device?
> 
> What do you think of adding a separator to AUDIODEVICE, to be able to
> list more than one device (like : or ;)? Then libsndio just tries them
> one after another, and you don't have to guess how many. It's a simple
> backwards-compatible fix, but it doesn't address device migration.

yeah that would work. I'd like something that could work by default
without configuration, but i see no simple & obvious solution that
doesn't break current common use-cases



Re: sndiod fallback trouble

2016-02-27 Thread Alexandre Ratchov
On Fri, Feb 26, 2016 at 07:18:06PM -0500, Michael Reed wrote:
> Hello,
> 
> I use OpenBSD on my laptop to listen to music, using an external DAC
> (USB) at home and built-in audio elsewhere.
> 
> In rc.conf.local I have
> 
>   # see http://thread.gmane.org/gmane.os.openbsd.misc/213373/focus=213377
>   sndiod_flags=-m play -f rsnd/1 -f rsnd/0
> 
> with the intention of using rsnd/1 (USB DAC) when it's available, and rsnd/0
> (built-in audio) when it's not.  However, this is what actually seems to
> happen when the USB DAC isn't plugged in (see DEFAULTS section in sndio(7)):
> 
>   - audio program tries to connect to snd/0, which fails because it doesn't
> exist (snd/0 is a sub-device of rsnd/1 (USB DAC), which isn't plugged in)
> 
>   - audio program then tries rsnd/0 (/dev/audio0), which works
> 
> The trouble is that, as shown by the second bullet, sndiod(8) is being
> completely bypassed if the USB DAC isn't plugged in:
> 
>   # fuser -u /dev/audio[0-2]# sndiod_flags=-m play -f rsnd/1 -f rsnd/0
>   /dev/audio2:
>   /dev/audio1:
>   /dev/audio0: 18636(_mpd)
> 
> If I set sndiod_flags to empty, then sndiod is no longer bypassed
> 
>   $ fuser -u /dev/audio[0-2] # sndiod_flags=
>   /dev/audio2:
>   /dev/audio1: 3291(_sndio)
>   /dev/audio0:
> 
> but, of course, the USB DAC won't be used at all.
>
> With that said, I'm wondering if it's even possible to set up sndiod so that
> (1) my USB audio device is always used when available and (2) sndiod isn't 
> bypassed
> if the DAC isn't available.
> 
> After reading various sndio/audio manual pages I'm still somewhat
> confused, so any help would be much appreciated.

Your understanding is right; this is a sndiod limitation.  We don't
have the code yet to do what you want.

One option would to patch libsndio to try more devices (how many?).

A nicer approach would be to handle this in sndiod by allowing
sub-devices (aka -s options) to change their device (aka -f
option).  The advantage of doing it in sndiod is that later this
could happen dynamically (ex.  unplug usb cable and programs
migrate to another device).



Re: can't run multiple instances of httpd, flags not visible in processes

2016-01-28 Thread Alexandre Ratchov
On Wed, Jan 27, 2016 at 10:51:50PM +0100, Reyk Floeter wrote:
> 
> Well, we "tradionally" had setproctitle("[priv]") in the parent.  I
> changed the tradition to setproctitle("parent").
> 
> I have no objections with changing this in the parent (but keeping the
> setproctitles in the children) to either the default (all command line
> flags) or to something like setproctitle("parent, %s", conffile).
> Command line flags suck and I don't think that -d or -v would be
> helpful in the output, so I prefer the latter.
> 
> All rc scripts would have to be adjusted by somebody with better rc-fu.
> 
> Opinions?
> 

another option would be to call setproctitle() only in the child
processes (or processes you're not supposed to kill), that's what
we do for sndiod to allow multiple instances to run allowing the
user to kill the right one:

$ ps ax |grep sndiod  
14501 ??  Ssp 0:00.00 sndiod: helper (sndiod)
32743 ??  S

Re: audio capturing

2015-12-29 Thread Alexandre Ratchov
On Mon, Dec 28, 2015 at 05:45:40PM +0300, Kirill wrote:
> On 12/28/15 17:21, Jan Stary wrote:
> > On Dec 28 16:46:24, nightl...@nightbbs.ru wrote:
> >> I want to capture audio from another app to file or simply stdout. How
> >> can I do this?
> > It woould be easier to help you you just said what "app" it is
> > and how it produces "audio".
> 
> i want to capture with ffmpeg from dosbox (no, internal dosbox capture
> don't need)

you could expose a device that monitors what programs play:

sndiod_flags="-s default -m play,mon -s mon"

then restart sndiod and use whatever program you prefer to record
from device "snd/0.mon". Example:

ffmpeg -f sndio -i snd/0.mon foo.wav

hth



Re: azalia(4) partially working on Intel NUC NUC5i7RYH

2015-11-29 Thread Alexandre Ratchov
On Mon, Nov 30, 2015 at 11:09:51AM +0800, Josh wrote:
> Hi,
> 
> Running amd64-current (last update at ~5pm UTC 29th Nov), azalia(4)
> works partially on that NUC NUC5i7RYH device:
> Recording through audacity for instance seems to work as I can see the
> amplitude changing when speaking through the microphone.

this indicates that data moves between the device and the host, so
problems are likely to be caused by the mixer.

> nuc$ mixerctl -av
> inputs.dac-0:1=126,126
> inputs.dac-2:3=126,126
> record.adc-0:1_mute=off  [ off on ]
> record.adc-0:1=124,124
> record.adc-2:3_mute=off  [ off on ]
> record.adc-2:3=124,124
> inputs.mix_source=mic  { mic }
> inputs.mix_mic=120,120
> inputs.mix2_source=dac-0:1,mix  { dac-0:1 mix }
> inputs.mix3_source=dac-2:3,mix  { dac-2:3 mix }
> inputs.mic=85,85
> outputs.mic_dir=input-vr80  [ none input input-vr0 input-vr50
> input-vr80 input-vr100 ]
> outputs.hp_source=mix2  [ mix2 mix3 ]
> outputs.hp_mute=off  [ off on ]
> outputs.hp_boost=off  [ off on ]

^^
does setting outputs.hp_boost=on helps ?



Re: faq13: audio bits

2015-11-25 Thread Alexandre Ratchov
On Wed, Nov 25, 2015 at 03:11:05PM +0100, Jan Stary wrote:
> Nitpicking on the audio bits of faq13:
> 
> - fix a typo
> - the "aucat sound server" is sndiod
> - let sentences be senteces; but I will gladly leave this
>   to the native speakers.

ok ratchov

> Also, should sndiod -L be mentioned now that it is disabled?
> 

Not yet, the faq is about the last release.



Re: azalia audio works, then stutters until reboot

2015-11-23 Thread Alexandre Ratchov
On Fri, Nov 20, 2015 at 10:31:34AM -0700, luke...@onemodel.org wrote:
>
> $ls -ltrd /tmp/aucat
> drwx--  2 root  wheel   512B Nov 20 09:39 /tmp/aucat/
> $ls -ltr /tmp/aucat
> ls: aucat: Permission denied
> [and timidity playing a .mid file was working]
> [then i killed sndiod with ^C.]
> 
> Could the root umask of 0077 be a problem?  my /tmp/aucat directory
> has different permissions than yours.

The problem is in sndiod; it's supposed create a world readable
directory regardless the user umask.

I just commited the fix; you could either start it with the 022
umask now or rebuild sndiod with sndiod.c rev 1.14 or newer.

Let me know if things work better.

> I set that umask for all
> users to avoid forgetfully
> bleeding information between accounts.

Another option is to create the home directories with mode 0700 and
leave the default umask.  This doesn't protect files outside their
home dir, but I'm not sure this would be a problem.



Re: azalia audio works, then stutters until reboot

2015-11-07 Thread Alexandre Ratchov
On Fri, Nov 06, 2015 at 05:00:13PM -0700, luke...@onemodel.org wrote:
> On 09/11/15 11:55, luke...@onemodel.org wrote:
> >Short version: In OpenBSD 5.7 (with all the latest security
> >patches), after some video playing, it
> >starts to stutter, and doesn't recover until I reboot. Is there
> >a way to "reset all the audio" back so it works, short of rebooting?
> >I haven't found that in anything I've read so far, including from
> >faq 13 and manpages for audioctl and mixerctl etc.
> >
> >The details:
> [...are found in original thread at:
> http://marc.info/?l=openbsd-misc=144199440202788=2
> ]
> 
> 
> I upgraded to 5.8 as advised in the earlier thread, and the
> problem is definitely much reduced, but still happens occasionally.

The 5.8 audio driver was rewritten from scratch so the behavior may
be slightly different

> It seems to be mostly after I use the xfce volume control slider
> (ie the audio mixer panel plugin).  It usually doesn't have any
> problem if I move around in the video, change the volume via the
> slider inside the video area in the browser, or if I use the computer
> for something else, but did fail just now when I tried to watch a 2nd
> video via a link.
> 
> I confirmed that, as described before IIRC, when the problem
> occurs with symptoms in chrome, and I try to use timidity to
> play a .mid file, I get this output from timidity:
> io_open() failed
> Couldn't open sndio mode (`s')
> 
> Is there other info I can provide, or something I should try?
> 

you could try to kill sndiod and run as root:

sndiod -ddd 2>/tmp/sndiod-log

Possibly use tmux to avoid closing the window by mistake.  Then, do
your usual stuff and whenever you see the failure, run:

(audioctl ; sleep 1 ; audioctl) >/tmp/audioctl-log

and send me both files.  Or at least last few megs if the file is
huge.

This may reveal what's the state of the audio subsystem during the
failure.

thanks

-- Alexandre



Re: azalia audio works, then stutters until reboot

2015-11-07 Thread Alexandre Ratchov
On Sat, Nov 07, 2015 at 06:27:17AM -0700, luke...@onemodel.org wrote:
> [sorry for the dupe; correcting the 'from' address.]
> 
> On 11/07/15 04:20, Alexandre Ratchov wrote:
> >On Fri, Nov 06, 2015 at 05:00:13PM -0700, luke...@onemodel.org wrote:
> >>On 09/11/15 11:55, luke...@onemodel.org wrote:
> >>[...details are found in original thread at:
> >> http://marc.info/?l=openbsd-misc=144199440202788=2
> >>]
> >>Is there other info I can provide, or something I should try?
> >>
> >you could try to kill sndiod and run as root:
> >
> >sndiod -ddd 2>/tmp/sndiod-log
> >...
> >(audioctl ; sleep 1 ; audioctl) >/tmp/audioctl-log
> >
> >and send me both files.  Or at least last few megs if the file is
> >huge.
> 
> Since the problem was already occurring I can provide that now. I
> killed/restareted sndiod as described, attempted to run "timidity
> *.mid", but instead of the error output I described earlier it just
> produced repeated chimes (ie, the audible symptoms of the problem).
> 
> Then doing this as  root:
>   (audioctl ; sleep 1 ; audioctl) >/tmp/audioctl-log
> ...yields the 2nd of the 2 logs pasted below.  (But I wonder
> if I did things in a way
> that makes them informative enough, or if the problem needs
> to be absent when I start the "sndiod..." command, and begin
> while that is in debug mode, or anything.)

sorry, forgot to mention it; please restart sndiod first; this way
all the operations that lead to the bug are logged.  Then, right
after the failure, run the audioctl commands.

thanks



Re: Midi keyboard with 5.7

2015-09-30 Thread Alexandre Ratchov
On Wed, Sep 30, 2015 at 04:22:10PM +, pasta wrote:
> Hello,
> I have a Launchkey MK2 25 by Novation and I am wondering if I can
> play on it using OpenBSD. As said it is a midi keyboard and it is connected
> via usb. Unfortunately it doesn't show up as midi device [1].
> I read that I could try to make it work by finding out it's endpoint and
> using hexdump [2].But it says "Device not configured" for all endpoints.
> There is an official manual [3], saying there are two modes and in one of
> them it acts as generic midi device. When plugged in it should act as normal
> device.
> Can I do something about the problem? And what?
> 
> [0]
> uname -a
> OpenBSD z77 5.7 GENERIC.MP#881 amd64
> 
> [1]
> dmesg
> ...
> umidi0 at uhub0 port 2 configuration 1 interface 1 "Focusrite A.E. Ltd
> Launchkey MK2 25" rev 1.10/0.00 addr 3
> umidi0: (genuine USB-MIDI)
> umidi0: out=0, in=0

It seems to have worked, you could install fluidsynth,
generaluser-gs-soundfont and play with the keyboard

-- Alexandre



  1   2   3   4   >