Yamaha DM3 mixer is a beast audio io, 18x18 96khz 32bit device, almost solved

Yamaha DM3 is an acessable pro digital mixer that has optional dante transport and does 18x18 at 96khz by 32bit on USB. It sounds amazing, it's a beast and works driver free on 14.2.
It might be worth the cost just to get a 16x16 usb/dante bridge without paying the yearly driver ransom to audiante.

I got it to record and play back in multichannel with jack and virtual_oss, but I still need a bit of help getting system audio to route to it.
Here's the process:

Code:
#get debuggy
sysctl hw.usb.uaudio.debug=1
sysctl hw.snd.verbose: 4

boot takes a minute then:
Code:
    May  6 19:41:46 inara kernel: ugen0.7: <Yamaha Corporation Yamaha DM3> at usbus0
    May  6 19:41:46 inara kernel: uaudio0 on uhub0
    May  6 19:41:46 inara kernel: uaudio0: <Yamaha Corporation Yamaha DM3, class 239/2, rev 2.10/0.00, addr 10> on usbus0
    May  6 19:41:46 inara kernel: uaudio0: Play[0]: 96000 Hz, 18 ch, 32-bit S-LE PCM format, 2x4ms buffer. (selected)
    May  6 19:41:46 inara kernel: uaudio0: Play[0]: 48000 Hz, 18 ch, 32-bit S-LE PCM format, 2x4ms buffer.
    May  6 19:41:46 inara kernel: uaudio0: Record[0]: 96000 Hz, 18 ch, 32-bit S-LE PCM format, 2x4ms buffer. (selected)
    May  6 19:41:46 inara kernel: uaudio0: Record[0]: 48000 Hz, 18 ch, 32-bit S-LE PCM format, 2x4ms buffer.
    May  6 19:41:46 inara kernel: uaudio0: MIDI sequencer.
    May  6 19:41:46 inara kernel: pcm3 on uaudio0
    May  6 19:41:46 inara kernel: sndbuf_resize(): b=0xfffff802275ee000 0 -> 0xfffffe01134a0000 [0 -> 110592 : 110592]
    May  6 19:41:46 inara kernel: sndbuf_resize(): b=0xfffff80363af7000 0 -> 0xfffffe01169f9000 [0 -> 110592 : 110592]
    May  6 19:41:46 inara kernel: sndbuf_resize(): b=0xfffff802275ee000 110592 [27648] NOCHANGE
    May  6 19:41:46 inara kernel: sndbuf_remalloc(): b=0xfffff8035c5e5900 0 -> 32768 [32688]
    May  6 19:41:46 inara kernel: pcm3: chn_resizebuf(): PCMDIR_PLAY (hardware) timeout=9 b[27648/13824/2] bs[32688/16344/2] limit=0
    May  6 19:41:46 inara syslogd: last message repeated 1 times
    May  6 19:41:46 inara kernel: sndbuf_resize(): b=0xfffff80363af7000 110592 [27648] NOCHANGE
    May  6 19:41:46 inara kernel: sndbuf_remalloc(): b=0xfffff802e7098480 0 -> 32768 [32688]
    May  6 19:41:46 inara kernel: pcm3: chn_resizebuf(): PCMDIR_REC (hardware) timeout=9 b[27648/13824/2] bs[32688/16344/2] limit=0
    May  6 19:41:46 inara syslogd: last message repeated 1 times
    May  6 19:41:46 inara kernel: uaudio0: No HID volume keys found.

& sysctl dev.pcm.3
dev.pcm.3.feedback_rate: 0
dev.pcm.3.mode: 7
dev.pcm.3.bitperfect: 1
dev.pcm.3.buffersize: 0
dev.pcm.3.rec.vchanformat: s32le:18.0
dev.pcm.3.rec.vchanrate: 96000
dev.pcm.3.rec.vchanmode: fixed 
dev.pcm.3.rec.vchans: 2 <----------------------dunno if this needs poked
dev.pcm.3.play.vchanformat: s32le:18.0
dev.pcm.3.play.vchanrate: 96000
dev.pcm.3.play.vchanmode: fixed
dev.pcm.3.play.vchans: 2
dev.pcm.3.hwvol_mixer: vol
dev.pcm.3.hwvol_step: 5  
dev.pcm.3.%iommu:
dev.pcm.3.%parent: uaudio0
dev.pcm.3.%pnpinfo:
dev.pcm.3.%location:
dev.pcm.3.%driver: pcm
dev.pcm.3.%desc: Yamaha Corporation Yamaha DM3
 
cat /dev/sndstat
pcm3: <Yamaha Corporation Yamaha DM3> on uaudio0 (1p:2v/1r:2v)
        snddev flags=0x3e6<AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,BITPERFECT,VPC>
        [dsp3.play.0]: spd 96000, fmt 0x01201000, flags 0x20002108, 0x00000004
                interrupts 834693, underruns 0, feed 834692, ready 0
                [b:55296/27648/2|bs:65520/32760/2]
                channel flags=0x20002108<TRIGGERED,BUSY,HAS_VCHAN,BITPERFECT>
                {userland} -> feeder_mixer(0x01201000) -> {hardware}
        dsp3.play.0[dsp3.virtual_play.0]: spd 96000, fmt 0x01201000, flags 0x3000112c, 0x00000001, pid 15957 (jackd)
                interrupts 0, underruns 0, feed 834692, ready 130752
                [b:0/0/0|bs:130752/16344/8]
                channel flags=0x3000112c<RUNNING,TRIGGERED,SLEEPING,BUSY,HAS_SIZE,VIRTUAL,BITPERFECT>
                {userland} -> feeder_root(0x01201000) -> {dsp3.play.0}
        dsp3.play.0[dsp3.virtual_play.1]: spd 96000, fmt 0x01201000, flags 0x30000000, 0x00000001
                interrupts 0, underruns 0, feed 0, ready 0
                [b:0/0/0|bs:130752/16344/8]
                channel flags=0x30000000<VIRTUAL,BITPERFECT>
                {userland} -> feeder_root(0x01201000) -> {dsp3.play.0}
        [dsp3.record.0]: spd 96000, fmt 0x01201000, flags 0x20002108, 0x00000005
                interrupts 834683, overruns 0, feed 1669366, hfree 55296, sfree 65519
                [b:55296/27648/2|bs:65520/32760/2]
                channel flags=0x20002108<TRIGGERED,BUSY,HAS_VCHAN,BITPERFECT>
                {hardware} -> feeder_root(0x01201000) -> feeder_mixer(0x01201000) -> {userland}
        dsp3.record.0[dsp3.virtual_record.0]: spd 96000, fmt 0x01201000, flags 0x3000110c, 0x00000001, pid 15957 (jackd)
                interrupts 0, overruns 0, feed 1669366, hfree 0, sfree 99432
                [b:0/0/0|bs:129024/1008/128]
                channel flags=0x3000110c<RUNNING,TRIGGERED,BUSY,HAS_SIZE,VIRTUAL,BITPERFECT>
                {dsp3.record.0} -> feeder_root(0x01201000) -> {userland}
        dsp3.record.0[dsp3.virtual_record.1]: spd 96000, fmt 0x01201000, flags 0x30000000, 0x00000001
                interrupts 0, overruns 0, feed 0, hfree 0, sfree 129024
                [b:0/0/0|bs:129024/1008/128]
                channel flags=0x30000000<VIRTUAL,BITPERFECT>
                {dsp3.record.0} -> feeder_root(0x01201000) -> {userland}



the midi surface transmit works when enabled from the settings-> midi -> enable control, program change then
cat /dev/umidi0.0
#then wiggle the faders because .. funny - see dirtyriggers' filter for ops
-or-
Code:
mididump -t /dev/umidi0.0
//push buttons on control surface..
Control/Mode change     channel=1, control=72 (Sound Controller 3), value=0
Control/Mode change     channel=1, control=72 (Sound Controller 3), value=127


et 96khz sample rate to match the DM's max in settings-> clockrate 96khz
# do both or jackd will error out
Code:
sysctl dev.pcm.3.rec.vchanrate=96000
sysctl dev.pcm.3.play.vchanrate=96000


#and -r for jackd
jackd -d oss -r 96000 -C /dev/dsp3 -P /dev/dsp3


Get https://github.com/jackaudio/jack-example-tools/ from pkg or whereever
Make a sad test tone, creates audio (annoying stereo tones) on the dm3
jack_simple_client

look at settings -> patch, it will show the channel lit on input:USB 1,2 when signals are hitting it, it's really handy to see the signal while learning to route the board's actual mixer inputs
Patch them to convenient channels (9-10?)

enumerate ports:
Code:
& jack_lsp
Cannot lock down 107341340 byte memory area (Cannot allocate memory) <--- no idea about this glitch
system:capture_1
system:capture_2
...
system:playback_17
system:playback_18

now some recording
Activate a test burst tone from oscillator, patch it to a mix bus and out usb1,2 . This works for multichannel!!!!!, just add all the system:capture[.] devices to jack_rec target
Code:
& jack_rec -f /tmp/burst.wav -d 4 -b 32 system:capture_1 system:capture_2
Cannot lock down 107341340 byte memory area (Cannot allocate memory)
disk thread finished

now how do I use this? mplayer refuses to open dsp3:

installing virtual_oss from pkg

Code:
#-S resample
#-Q 0 burn the cpu for resampling jqaulity
#-C 18 mix channels, 96khz, 32bit
# #  -s 4ms buffer
 44 ms is way to many
#-f my dm3's /dev/dspX entry
#realtimeprio -i 8
#downmix to -d dsp for consumption elsewhere ( /dev/dsp seems to work in audacity)
    #-a   amplitudes of not 0 can be unfortunate , the examples have crazy high gain specified
    #-b 32bit, really
    #-c 2 it's a 2 channel device for music playback
    #-m 0,0,1,1 .. rx->tx virtual channel to dsp3 physical channel,
    #-f call it /dev/dsp for ea
 
#extra downmix channel vdsp.playbk
 
#the actual command
virtual_oss \
                   -S \
                   -Q 0 \
                   -i 8 \
                   -C 18 -c 18 -r 96000 -b 32 -s 4ms -f /dev/dsp3 \
                   -a 0 -b 32 -c 2 -m 0,0,1,1 -d dsp \
                   -a 0 -b 32 -c 2 -m 0,0,1,1 -d vdsp.playbk \
 
# now I can  play  from stuff that will talk to the oss driver
mplayer -ao oss:/dev/dsp  rickrol.mp3
 
 
#seems to bypass the 0db vpc control???
#=100 was should be the default value!
hw.snd.vpc_0db: 45 -> 11  <<--------   this should be terrible, but no effect
this default is very wrong in base anyway as it clips  instantly, i think a quick hard knee compression could be an ok default
# mixer isn't playing nice eirther
mixer -d 3 pcm=0.3 <<--------- no effect

Now for the ask:
How do i get other normal system audio ( firefix/chome whatever)to see that virtual_oss port?
can set the -f /dev/dsp4 but the kernel can' set hw.snd.default_unit to 4 =(
 
-a 0 -b 32 -c 2 -m 0,0,1,1 -d dsp
This seems to overwrite /dev/dsp, which you can then use to play to using mplayer. It's better to leave /dev/dsp alone since it's the default device. Create a new device
instead, for instance like this: -a 0 -b 32 -c 2 -m 0,0,1,1 -d dsp9. You can then make it the default device with sysctl hw.snd.default_unit=dsp9.

Applications ususally have a config option that allows you to choose a /dev/dspN. Firefox sends audio to the default /dev/dsp, but seems to have an extension that allows you to choose a different one.
 
Let's try with -d dsp9:
Code:
& sysctl hw.snd.default_unit=9
hw.snd.default_unit: 0
sysctl: hw.snd.default_unit=9: Invalid argument
Exit 1
& ls -l /dev/dsp9
crw-rw-rw-  1 root wheel 0x1dc May  7 09:44 /dev/dsp9
from /dev/sndstat
Code:
Installed devices from userspace:
dsp9: <Virtual OSS> (play/rec)
vdsp.playbk: <Virtual OSS> (play/rec)

I did try that before - but the kernel hates that. I thought iI might get away with overwriting /dep/dsp ( which is not created by default on my machine, starts at dsp0) but it' doesn't interact as expected with default_unit.

I'd like to preserve the behavior where apps try to use default_unit, but alternately if there was a generic patchbay for apps that would be perfect.

I also noticed that as of current virtual_oss no longer has the -T switch for updating /dev/sndstat ( it seems to update it without the switch ), perhaps @hps could ring in
 
I thought iI might get away with overwriting /dep/dsp ( which is not created by default on my machine, starts at dsp0) but it' doesn't interact as expected with default_unit.
You're right. Only devices that were connected and available at boot can be used as default unit. Trying ln -s /dev/dsp9 /dev/dsp says 'ln: /dev/dsp: File exists' although that file doesn't show up in a file list. Probably the same problem that you got when creating it from virtual_oss.

What you can do is create dsp devices the way you want to use 'em in various applications. Then configure the applications (audacious, audacity and the likes) to use these devices. Works well for me.

hps isn't going to ring in. Unfortunately, he is nog longer with us.
 
Only devices that were connected and available at boot can be used as default unit
That can't be right - if I hot plug another uaudio device I'll get another pcmX device that the kernel will let me use as default_unit. I hope there a way to let the kernel know about a user space device as default.

audacity will happily use /dev/dsp ( shows in the audio setup panel ), and mplayer or similar will use any oss device via # mplayer -ao oss:/dev/dsp9

oh - I missed that https://forums.freebsd.org/threads/in-memoriam-hans-petter-william-sirevag-selasky.89697/
condolences.

I'll dig around in the virtual_oss code and report back.
 
Code:
    169 sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS)
    170 {
    171    struct snddev_info *d;
    172    int error, unit;
    173
    174    unit = snd_unit;
    175    error = sysctl_handle_int(oidp, &unit, 0, req);
    176    if (error == 0 && req->newptr != NULL) {
    177       d = devclass_get_softc(pcm_devclass, unit);
    178       if (!PCM_REGISTERED(d) || CHN_EMPTY(d, channels.pcm))
    179          return EINVAL;
    180       snd_unit = unit;
    181       snd_unit_auto = 0;
    182    }
    183    return (error);
    184 }
from dev/sound/pcm/sound.c:: line 186
It's this EINVAL that's returned, cause there no kernel soft context for that userland device.
 
I was overthinking it. it's enough to supply -d /dev/dsp to virtual_oss , overwriting /dev/dsp , and completely ignore hw.snd.default_unit , it's then the default for all the things.
I just needed to boot the box after fuzzing around with all the variables, probably latching up some internal state.
 
As a follow up, a jackd incantation as derived from qjackctl trial + error for minimizing stutter and dropped frames:

/usr/local/bin/jackd -doss -r96000 -p392 -n3 -w32 -C/dev/dsp3 -P/dev/dsp3 -i18 -I1
 
Back
Top