Bug 87656

Summary: native-instruments-traktor-audio10.conf is not correct
Product: PulseAudio Reporter: Owen Williams <owen-freedesktop>
Component: alsaAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: My attempt at fixing the configuration file
This configuration works better -- the 10 channel device works, but the stereo ones don't
Log of attaching the Traktor A10 to current git head PA
conf file with exact-channels this time
Working config for A10

Description Owen Williams 2014-12-23 23:48:47 UTC
Created attachment 111247 [details]
My attempt at fixing the configuration file

Previous Native Instruments sound cards, like the Audio4DJ, used separate stereo subdevices, and a .conf file was created to merge these devices together in pulseaudio.  However the new Audio 10 card has one device with 10 channels, and the existing configuration file doesn't work because it references nonexistent subdevices.

I tried to create my own corrected configuration file, but I am having trouble getting pulseaudio to work with my Audio 10 (I keep getting "invalid argument errors").  With a little guidance I think this can be easily fixed.

The only major limitation of this sound card that I'm aware of is all samples must be S32_LE. 

Some information:

aplay -l
card 1: T10 [Traktor Audio 10], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

aplay -L
sysdefault:CARD=T10
    Traktor Audio 10, USB Audio
    Default Audio Device
front:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    Front speakers
surround40:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    Direct sample mixing device
dsnoop:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    Direct sample snooping device
hw:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    Direct hardware device without any conversions
plughw:CARD=T10,DEV=0
    Traktor Audio 10, USB Audio
    Hardware device with all software conversions


aplay -v
Hardware PCM card 1 'Traktor Audio 10' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 10
  rate         : 44100
  exact rate   : 44100 (44100/1)
  msbits       : 32
  buffer_size  : 22050
  period_size  : 5513
  period_time  : 125011
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 5513
  period_event : 0
  start_threshold  : 22050
  stop_threshold   : 22050
  silence_threshold: 0
  silence_size : 0
  boundary     : 6206523236469964800
  appl_ptr     : 0
  hw_ptr       : 0


When I try to edit the .conf file (attached), pulseaudio says:
I: [pulseaudio] alsa-ucm.c: UCM not available for card Traktor Audio 10
I: [pulseaudio] module-card-restore.c: Restored profile 'output:analog-stereo-main+input:analog-stereo-main' for card alsa_card.usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10.
I: [pulseaudio] module-card-restore.c: Restoring port latency offsets for card alsa_card.usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10.
I: [pulseaudio] card.c: Created 21 "alsa_card.usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10"
I: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups
I: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups
I: [pulseaudio] alsa-util.c: Failed to set hardware parameters on plughw:CARD=T10,DEV=0: Invalid argument
I: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups
I: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups
I: [pulseaudio] alsa-util.c: Failed to set hardware parameters on plughw:CARD=T10,DEV=0: Invalid argument
I: [pulseaudio] module.c: Loaded "module-alsa-card" (index: #43; argument: "device_id="1" name="usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10" card_name="alsa_card.usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"").
I: [pulseaudio] module-udev-detect.c: Card /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.1/3-2.1:1.0/sound/card1 (alsa_card.usb-Native_Instruments_Traktor_Audio_10_71C5613E-00-T10) module loaded.
Comment 2 Owen Williams 2014-12-24 03:14:22 UTC
How do I use udev?  I didn't know I had it off.  I just took the existing conf file and edited it to try to make the sound devices correct.

None of the profiles show up in pulseaudio.  I also tried to create a 10-channel profile using a mapping like left,right,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9,aux10 but that didn't work.

I am on Ubuntu 14.04 so I don't have the exact-channels option.
Comment 3 Owen Williams 2014-12-24 03:47:47 UTC
Created attachment 111256 [details]
This configuration works better -- the 10 channel device works, but the stereo ones don't
Comment 4 Raymond 2014-12-24 09:27:51 UTC
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/PulseAudioFromGit/


Method 3: Running From the Build Tree Without Installing

http://colin.guthr.ie/2010/09/compiling-and-running-pulseaudio-from-git/. It would be good to copy that here.)
Comment 5 Owen Williams 2014-12-24 15:34:37 UTC
heh, that website is out of date, the repo url is now git://anongit.freedesktop.org/pulseaudio/pulseaudio
Comment 6 Owen Williams 2014-12-24 16:12:53 UTC
Once I get the trunk version of PA working, how do I create a profile that says "make a stereo device from these two specific channels from this 10 channel sound device"?
Comment 8 Owen Williams 2014-12-25 16:00:21 UTC
Created attachment 111329 [details]
Log of attaching the Traktor A10 to current git head PA
Comment 9 Owen Williams 2014-12-25 16:01:26 UTC
So I tried this config file with the git version and got this log -- The 10 channel device still works fine, but my attempts to make smaller stereo devices fails.

Also I notice that if I use a basic music player with the 10 channel device, it plays stereo out of all the 5 sets of outputs.
Comment 10 Owen Williams 2014-12-25 16:02:26 UTC
Created attachment 111330 [details]
conf file with  exact-channels this time
Comment 11 Raymond 2014-12-26 11:30:03 UTC
you have to discuss your expectation in pulseaudio discuss mailing list 


it is unlikely for pulseaudio  to support multiple stereo streams



jackd seem to be more suitable than pulseaudio
Comment 12 Owen Williams 2014-12-26 14:47:36 UTC
Created attachment 111374 [details]
Working config for A10

I would have thought there's be a way to have stereo, 4.0, 4.1, 5.0, 5.1, etc mappings like my regular intel sound card, but maybe that's an issue with the alsa driver itself?

Anyway, here is a version of the config file that works for pulseaudio -- it just creates a 10 channel device in and/or out.

Although I don't own an Audio6, that device came out at the same time as my A10 and I would strongly suspect that it works in a similar way.  Therefore I would suggest that its config file be changed too.
Comment 13 Raymond 2014-12-26 16:09:41 UTC
but playing mono  output to left channel only

Native_Instruments_Traktor_Audio_10_71C5613E-00-T10.analog-out-all becomes busy, resuming.
D: [lt-pulseaudio] resampler.c: Resampler:
D: [lt-pulseaudio] resampler.c:   rate 48000 -> 44100 (method speex-float-1)
D: [lt-pulseaudio] resampler.c:   format s16le -> s32le (intermediate float32le)
D: [lt-pulseaudio] resampler.c:   channels 1 -> 10 (resampling 1)
D: [lt-pulseaudio] resampler.c: Channel matrix:
D: [lt-pulseaudio] resampler.c:        I00 
D: [lt-pulseaudio] resampler.c:     +------
D: [lt-pulseaudio] resampler.c: O00 | 1.000
D: [lt-pulseaudio] resampler.c: O01 | 0.000
D: [lt-pulseaudio] resampler.c: O02 | 0.000
D: [lt-pulseaudio] resampler.c: O03 | 0.000
D: [lt-pulseaudio] resampler.c: O04 | 0.000
D: [lt-pulseaudio] resampler.c: O05 | 0.000
D: [lt-pulseaudio] resampler.c: O06 | 0.000
D: [lt-pulseaudio] resampler.c: O07 | 0.000
D: [lt-pulseaudio] resampler.c: O08 | 0.000
D: [lt-pulseaudio] resampler.c: O09 | 0.000
Comment 14 Raymond 2014-12-26 16:23:18 UTC
these kind of peak detect is also useless

lt-pulseaudio] resampler.c: Resampler:
D: [lt-pulseaudio] resampler.c:   rate 44100 -> 25 (method peaks)
D: [lt-pulseaudio] resampler.c:   format s32le -> float32le (intermediate float32le)
D: [lt-pulseaudio] resampler.c:   channels 10 -> 1 (resampling 1)
D: [lt-pulseaudio] resampler.c: Channel matrix:
D: [lt-pulseaudio] resampler.c:        I00   I01   I02   I03   I04   I05   I06   I07   I08   I09 
D: [lt-pulseaudio] resampler.c:     +------------------------------------------------------------
D: [lt-pulseaudio] resampler.c: O00 | 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100
Comment 15 Tanu Kaskinen 2014-12-30 21:19:45 UTC
Owen, in the first message you say that previous NI cards used separate stereo subdevices, but the new Audio 10 card uses a single 10-channel device. To me it sounds unlikely that PulseAudio would have a configuration file for Audio 10 that wouldn't have worked when the file was initially written, so probably something changed at some point. Perhaps just the kernel driver changed, or perhaps a new revision of the hardware works differently. In either case, it's problematic if PulseAudio can't distinguish between two different kernel driver versions or between two different hardware revisions, because there will always be some combination that will not work. If it's just a kernel driver change, though, then it's better to support the new version rather than the old one.

According to the "aplay -L" output there are the normal alsa devices like "front" and "surround40" available. Do those work? If you don't know, here's how to test them:

    pasuspender -- speaker-test -Dfront:T10 -c2 -FS32_LE
    pasuspender -- speaker-test -Dsurround40:T10 -c4 -FS32_LE

If those work, then the special profile set file for Audio 10 is not needed at all anymore, unless we really want things like multiple stereo sinks.

You asked how the card can be split to multiple stereo sinks. The answer is that the profile set configuration doesn't support that. It is possible to use module-remap-sink, but that's cumbersome with hotpluggable cards.
Comment 16 Raymond 2015-01-01 06:28:22 UTC
(In reply to Owen Williams from comment #0)
> Created attachment 111247 [details]
> My attempt at fixing the configuration file
> 
> Previous Native Instruments sound cards, like the Audio4DJ, used separate
> stereo subdevices, and a .conf file was created to merge these devices
> together in pulseaudio.  However the new Audio 10 card has one device with
> 10 channels, and the existing configuration file doesn't work because it
> references nonexistent subdevices.


http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf

do you want to remove these conf ?

are there any difference between your propose conf and multi channel profile ?
Comment 17 Raymond 2015-01-01 06:33:09 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf?id=5a4176409cbb38cc5910630f77a3701a030361d7

you have to notify the author of this patch if you want to remove/replace  native-instruments-traktor-audio10.conf
Comment 18 Owen Williams 2015-01-03 17:40:19 UTC
I am having trouble testing the front and surround devices with aplay because I always get the error: aplay: set_params:1233: Sample format non available
Available formats:
- S32_LE


And none of those devices show up in pavucontrol, either.
Comment 19 Raymond 2015-01-07 15:47:51 UTC
(In reply to Owen Williams from comment #18)
> I am having trouble testing the front and surround devices with aplay
> because I always get the error: aplay: set_params:1233: Sample format non
> available
> Available formats:
> - S32_LE
> 
> 
> And none of those devices show up in pavucontrol, either.

this look like alsa bug/limitation 

you have to define customised front, suuround40, .. for your traktor audio10

need plug:front if your card does not support s16_le


USB-Audio.pcm.front.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	
		type route
		ttable.0.0 1
		ttable.1.1 1
		slave.pcm {
			type hw
			card $CARD
		}
		slave.channels 10
Comment 20 Tanu Kaskinen 2015-01-14 20:47:41 UTC
Did you try speaker-test as I suggested? You can give the correct sample format to speaker-test, but aplay has the problem that I don't think it can convert between sample formats, so if you must use aplay, you need to find a file that contains audio in the S32_LE format.
Comment 21 Tanu Kaskinen 2015-01-14 20:49:48 UTC
(In reply to Owen Williams from comment #18)
> And none of those devices show up in pavucontrol, either.

Forgot to reply to this part... It's expected that the "front" and "surroundX" devices don't show up in pavucontrol. Those devices refer to the same sound card, the channel configuration is just different. In pavucontrol you will have just one sink, and you can switch between the channel configurations in the "Configuration" tab.
Comment 22 GitLab Migration User 2018-07-30 09:39:14 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/76.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.