Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration README #14

Open
jmanera opened this issue Feb 7, 2023 · 14 comments
Open

Configuration README #14

jmanera opened this issue Feb 7, 2023 · 14 comments

Comments

@jmanera
Copy link
Owner

jmanera commented Feb 7, 2023

I create this issue to talk about the configuration with Mixxx. Maybe in the future, we make a place on a playbook or similar. Now, we will discuss it here, and we decide later.

I added in the last commit the files needed on Mixxx to work. These files are based on the files attached on the Mixxx forum.

I do some explanations in order to work on Mixxx.

System / Driver Configuration

  • First of all, you need to clone this repo and build the driver (Based on @blaxpot readme in the PR).
  • Configure soundcards via ALSA adding to ~/.asoundrc at the begin of the file:
    pcm.TraktorS4InputCOutputMain { type plug; slave.pcm "hw:TraktorKontrolS,0,0"; }
    pcm.TraktorS4InputDOutputHeadphones { type plug; slave.pcm "hw:TraktorKontrolS,0,1"; }
  • Start traktor-kontrol-s4-mk1-driver-linux on a new terminal (or add & at the end to execute in background)
  • The log mode by default is on file. it will be stored on /tmp/traktor_s4/traktor_kontrol_s4_logger.log. Must be we need to debug. You can specify --logMode console to view on the console where you launch the driver.
  • You can get more information on logs if you use --logLevel debug (console or file independently)

Mix Configuration

  • Copy the XML and JS files included in this repo (mappings/mixxx) on ~/.mixxx/controllers
  • In the preferences, you need to go to Sound Hardware section on left-side
  • In the tab Exit you need to specify Main output: TraktorS4InputCOutputMain
  • In Headphones: `TraktorS4InputDOutputHeadphones``
  • Then, you go to the Controllers and select and activate Traktor Kontrol S4 MK1
  • On the dropdown, you need to select TraktorKontrol_S4_MK1_JFM
  • Exit from Mixxx and run again.
@jmanera jmanera changed the title Configure on RPi 4 Configuration README Feb 7, 2023
@jmanera
Copy link
Owner Author

jmanera commented Feb 7, 2023

@blaxpot @j4ckp0t85 Here I would like to centralize all the information related to the configuration. I added a text to have a start.

Please, keep free to add your ideas and suggestions.

Sorry for my English, I'm a Spanish developer and I need to improve my skills...

Some help with this is welcome!

@j4ckp0t85
Copy link

j4ckp0t85 commented Feb 7, 2023

As i previously wrote i am testing the driver on a raspbian-based ready to use image with mixxx bundled and i3 Window (raspberry 4) made by fayaaz

Just a reminder if anyone else will read this post:once built the driver i have included the execution in the i3config file (/home/pi/.config)

The hardware is recognized by mixxx and the mapping file provided at time of writing on this repo is working.
I have not spent too much time on testing, but i notice a strange behavior: rotating the jog + SHIFT wheel should skip the track cursor instead i see it's changing the pitch.

Great job anyway @jmanera @blaxpot

Ps sorry my English is not the best too, I'm Italian

@blaxpot
Copy link
Contributor

blaxpot commented Feb 7, 2023

It might also be worth mentioning something about checking that the snd-usb-caiaq kernel module is loaded in the README, since someone on the Mixxx forum thread was having trouble with that.

The ALSA stuff is optional, I guess. You could potentially use Pulseaudio/JACK/Pipewire instead, but I've had the best results with ALSA so far.

@blaxpot
Copy link
Contributor

blaxpot commented Feb 7, 2023

i notice a strange behavior: rotating the jog + SHIFT wheel should skip the track cursor instead i see it's changing the pitch.

This is something that's mainly handled by the mapping files. IIRC the driver just sends different MIDI CCs when you turn the jog wheels depending on whether you're pressing the plate on top of them down or not.

The mapping is what tells Mixxx how to handle those messages, and if you're using the mapping from the Mixxx forum thread you'll get a pitch bend if you touch the jog wheel on the outside and a scratch/skip if you touch the top. There's more info about this on the Mixxx forum thread and in the Mixxx wiki.

@j4ckp0t85
Copy link

M

i notice a strange behavior: rotating the jog + SHIFT wheel should skip the track cursor instead i see it's changing the pitch.

This is something that's mainly handled by the mapping files. IIRC the driver just sends different MIDI CCs when you turn the jog wheels depending on whether you're pressing the plate on top of them down or not.

The mapping is what tells Mixxx how to handle those messages, and if you're using the mapping from the Mixxx forum thread you'll get a pitch bend if you touch the jog wheel on the outside and a scratch/skip if you touch the top. There's more info about this on the Mixxx forum thread and in the Mixxx wiki.

Maybe there's some strange side effect in the alpha build of mixxx 2.4 I'm running.

Anyway going back in topic, i can confirm this configuration can be run also on raspberry (raspbian)

@j4ckp0t85
Copy link

j4ckp0t85 commented Feb 11, 2023

Just a statement regarding the enabling scratch (for fast track seeking): the blinding combination is hold CUE button and jog wheel rotation, instead of expected SHIFT key.

Maybe this if condition?

// The button that enables/disables scratching

TraktorKontrolS4mk1.wheelTouch = function(channel, control, value, status, group) {
var deckNumber = script.deckFromGroup(group);
if ((status & 0xF0) === 0x90) { // If button down
//if (value === 0x7F) { // Some wheels send 0x90 on press and release, so you need to check the value
var alpha = 1.0 / 8;
var beta = alpha / 32;
engine.scratchEnable(deckNumber, 128, 8, alpha, beta);
} else { // If button up
engine.scratchDisable(deckNumber);
}
}

@j4ckp0t85
Copy link

j4ckp0t85 commented Mar 5, 2023

Maybe worth a mention also the wheelTurn function on mapping file.

The behavior depends on personal needs of course, i find the actual one too much sensible.

I have personally added a fraction multiplier on newValue applied.

if (engine.isScratching(deckNumber)) { engine.scratchTick(deckNumber, newValue * 0.7); // Scratch! } else { engine.setValue(group, 'jog', newValue * 0.7); // Pitch bend }

@j4ckp0t85
Copy link

@jmanera @blaxpot btw i notice a slight latency between main output (i use a monitor with xlr cable connection) and headphones (the latter is delayed). No changes if i try to set manual delays on mix settings.
Do you have the same behavior on pc?
Any hint?
I'm using the alsa sound api, i don't expect any improvement with other solutions

@blaxpot
Copy link
Contributor

blaxpot commented Mar 6, 2023

@jmanera @blaxpot btw i notice a slight latency between main output (i use a monitor with xlr cable connection) and headphones (the latter is delayed). No changes if i try to set manual delays on mix settings. Do you have the same behavior on pc? Any hint? I'm using the alsa sound api, i don't expect any improvement with other solutions

I don't notice any delay between the main output and headphone jack on my S4.

Here are the relevant parts of my config., FWIW:
~/.asoundrc:

pcm.TraktorS4InputCOutputMain { type plug; slave.pcm "hw:TraktorKontrolS,0,0"; }
pcm.TraktorS4InputDOutputHeadphones { type plug; slave.pcm "hw:TraktorKontrolS,0,1"; }

image

Assuming you're using the RCA outputs on your Traktor S4 for your speakers and the headphone jack on your Traktor S4 for your headphones, I'm not sure why you'd have a delay, since everything should be handled by the same sound card in this case. If this is what you're doing maybe you could try tweaking the Master Delay setting in your Mixxx preferences until you get your outputs in sync?

However, if you're using more than one sound card (e.g. an audio interface for XLR to your speakers or a headphone amp/DAC), then you're probably having issues with synchronization. You could look into Mixxx's Multi-Soundcard Synchronization setting (in the screenshot above) if that's what you're trying to do.

@j4ckp0t85
Copy link

@jmanera @blaxpot btw i notice a slight latency between main output (i use a monitor with xlr cable connection) and headphones (the latter is delayed). No changes if i try to set manual delays on mix settings. Do you have the same behavior on pc? Any hint? I'm using the alsa sound api, i don't expect any improvement with other solutions

I don't notice any delay between the main output and headphone jack on my S4.

Here are the relevant parts of my config., FWIW: ~/.asoundrc:

pcm.TraktorS4InputCOutputMain { type plug; slave.pcm "hw:TraktorKontrolS,0,0"; }
pcm.TraktorS4InputDOutputHeadphones { type plug; slave.pcm "hw:TraktorKontrolS,0,1"; }

image

Assuming you're using the RCA outputs on your Traktor S4 for your speakers and the headphone jack on your Traktor S4 for your headphones, I'm not sure why you'd have a delay, since everything should be handled by the same sound card in this case. If this is what you're doing maybe you could try tweaking the Master Delay setting in your Mixxx preferences until you get your outputs in sync?

Yup, that's my setup and the sound settings is the same. I can't touch any of the parameters on top side (eg buffer size) since it will give an error from traktor sound devices.
If i try to modify the delay nothing seems to be affected.
So the issue is generally not linked to the driver i guess

@blaxpot
Copy link
Contributor

blaxpot commented Mar 6, 2023

So the issue is generally not linked to the driver i guess

If by "driver" you mean this project, I'd agree. All this software does is take events sent from the snd-usb-caiaq kernel module and translate them into MIDI messages that can be used to control Mixxx. It doesn't handle audio at all.

It sounds like your issue is related to Mixxx/the snd-usb-caiaq kernel module/ALSA.

Sorry I can't be of more help. Maybe you could try using a different sound API? I'd be interested to hear how that goes, I haven't tried other options for this myself since ALSA worked well enough.

@blaxpot
Copy link
Contributor

blaxpot commented Mar 6, 2023

I can't touch any of the parameters on top side (eg buffer size) since it will give an error from traktor sound devices.

I've had similar issues playing with these parameters. Apparently signal degradation on the USB cable can be a problem:
https://github.com/mixxxdj/mixxx/wiki/troubleshooting#my-sound-card-randomly-stops-working

using higher sample rates / smaller audio buffers seems to make this more of a problem.

If you haven't already seen this section of the Mixxx wiki, it might also be worth a look:
https://github.com/mixxxdj/mixxx/wiki/Adjusting%20Audio%20Latency

@j4ckp0t85
Copy link

I will do some tests on spare time and keep you updated.
Alsa should generally be the best (or one of) option.
Just to state: i have used the same "hardware" on a Windows laptop using traktor pro and all goes well.
On raspberry things are a bit different, kernel stuffs could be a candidate too.

Thanks for the responses

@j4ckp0t85
Copy link

j4ckp0t85 commented Mar 7, 2023

Ok, i've achieved a pretty good result.

I did a full upgrade cycle (apt upgrade and rpi-update to bump firmware and kernel to v6.1)

I have also installed the latest 2.4 alpha build available at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants