Skip to content

Herc dj control inpulse 500#14722

Merged
ronso0 merged 1 commit intomixxxdj:2.5from
Poyeyo:Herc-DJControl-Inpulse-500
May 1, 2025
Merged

Herc dj control inpulse 500#14722
ronso0 merged 1 commit intomixxxdj:2.5from
Poyeyo:Herc-DJControl-Inpulse-500

Conversation

@Poyeyo
Copy link
Copy Markdown
Contributor

@Poyeyo Poyeyo commented May 1, 2025

The previous formula assumes a range of 0–128 for the values provided by the controller.

The actual range is 0–127. As a result, the crossfader did not reach 100% when moved all the way to the right, only reaching 98%. This made it impossible to switch to the next track in Auto DJ mode using the crossfader when the left deck was playing.

This fix also changes the method from engine.setValue to engine.setParameter, as suggested by Eve.

@JoergAtGithub
Copy link
Copy Markdown
Member

Welcome at Mixxx!
As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

@JoergAtGithub
Copy link
Copy Markdown
Member

Please explain in the PR description, what the problem is, that you try to fix with this PR!

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented May 1, 2025

Mapping fixes/updates always go to the stable branch (2.5 in this case) (unless they require features only available in newer versions), so please rebase onto mixxx/2.5, force-push and change the target branch here accordingly.
Thank you!

@Poyeyo Poyeyo changed the base branch from main to 2.5 May 1, 2025 14:42
@Poyeyo Poyeyo force-pushed the Herc-DJControl-Inpulse-500 branch 2 times, most recently from 1bd91e9 to 8ba4c1d Compare May 1, 2025 14:52
@Poyeyo
Copy link
Copy Markdown
Contributor Author

Poyeyo commented May 1, 2025

Welcome at Mixxx! As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

Signed and sent

Comment on lines +1151 to +1156
// The parameter k determines how sharp is the curve shape
// lower values will give gentler curves
let k = 0.975;
let scaled = k * Math.PI / 2 * script.absoluteLin(value, -1, 1, 0, 127);
result = Math.tan(scaled) / Math.tan(k * Math.PI /2);
result = (result + 1) / 2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not do this in the mapping, this is clearly a personal preference.
The crossfader curve can be set in Preferences -> Mixer.

Btw DJCi500.crossfaderSetCurve could simply set the crossfader curve via
[Mixer Profile],xFaderMode
[Mixer Profile],xFaderCurve
(for "Additive" mode it's not necessary to set [Mixer Profile],xFaderCalibration)

Unfortunately these controls are not yet documented in the manual, but you can take a look how they are used in other mappings, eg. Traktor Kontrol S4 mk3.

Btw, since #14124 (Mixxx 2.6-alpha) you'll also see the real current values in the Crossfader preferences when you move the xfader switch on the controller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crossfader curve in Preferences -> Mixer is the standard curve, and this code snippet doesn't have any effect on the normal crossfader use. The normal crossfader value is set in line 1160, outside of this snippet, and it is 100% linear.

This snippet is used only for the scratch mode, and in 2.5 I can't see anything in the UI to edit the curve of the scratch mode, it only edits the normal mode.

I can remove these lines and leave the previous code for the scratch mode, if that allows this PR to be merged.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't try to understand what that snippet does. (I'm bad with math..)
Can you please explain what "Eventine's crossfader scratch mode" is supposed to do?
And how you changed that?

Unfortunately the documentation (preview, pending PR) doesn't explain that.
For my understanding, "sharp" scratching can be achieved by setting the curve as desired (that's done in Preferences -> Mixer, and the desired scratch curve can be customized in the mapping js file).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can be achieved by setting a new curve. This requires going to Preferences -> Mixer.

Unfortunately the documentation (preview, pending PR) doesn't explain that.

I see. You are right. The documentation doesn't show the actual switch that enables the scratch mode.

In the Hercules Inpuse 500 the scratch mode can be enabled with a selector switch in the controller itself:

Inpulse 500 crossfader

This is similar to the TRAKTOR KONTROL S4 MK3 when the selector goes fully to the right. I'm reading the manual of the MK3, and it is described as a "sharp curve".

When the switch is at the left, the reported position of the crossfader is linear, and then it corresponds to the curve set in Preferences.

This snippet is used when the Inpulse 500 selector switch is in the middle, and it also activates what can be described as a sharp curve.

What both this new code and the current code are doing is: they achieve this scratch result by modifying the reported position of the crossfader in Mixxx, instead of the crossfader curve itself.

The difference in the PR is that my code doesn't produce values that are outside of the range [-1, 1], the curve is otherwise almost the same as before.

If I understand correctly, what you propose is to actually change the curve of the crossfader when changing the selector switch to scratch, instead of the reported position. It is surely a more elegant solution, but I need to learn how it all works, and test the changes, etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I knew it was about that switch, I just didn't understand why the 'scratch' mode is handled so special compared to other mappings.
So IIUC the current mapping uses two curves for the xfader?

  • the one set with the switch (engine curve)
  • one for the input values, which is then interpreted by the engine curve

The goal (applies to any mapping) is to make the xfader switch adjust the curve as labeled, without any magic (ie. having to read the manual to understand it).
Btw to get the 'real' scratch experience, the xfader mode should be 'Additive' (not 'Constant Power'), right?
So this also needs to be set in crossfaderSetCurve.

I think some confusion was caused by the fact that the Mixer preferences don't necessarily reflect the real crossfader curve. Therefore, for testing the curve functions during development, I suggest to build main (includes #14124), then switch back to your Inpulse500 branch and test the mapping.

I don't want to hold up this (initially) small fix, so if you like to get this merged quickly, I suggest to reduce this PR to the 127/128 fix and work on the curve in another PR.

Otoh, Mixxx 2.5.1 has just been released so there's probably more than enough time to make sure this mapping is in the next release. (unless of course we introduced a horrible regression in 2.5.1, then we'd have to release 2.5.2 with a fix asap)

Copy link
Copy Markdown
Contributor Author

@Poyeyo Poyeyo May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now it is a small fix.

I am reading about #14124 and it seems it is totally related to this snippet, good moment to learn how this works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I have also created #14361 which might be helpful in this case (and in general).

@Poyeyo Poyeyo force-pushed the Herc-DJControl-Inpulse-500 branch from 8ba4c1d to 2b503b5 Compare May 1, 2025 17:46
@Poyeyo Poyeyo requested a review from ronso0 May 1, 2025 18:00
Copy link
Copy Markdown
Member

@ronso0 ronso0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@ronso0 ronso0 enabled auto-merge May 1, 2025 18:23
@ronso0 ronso0 merged commit dc51fc0 into mixxxdj:2.5 May 1, 2025
1 check passed
@Poyeyo Poyeyo deleted the Herc-DJControl-Inpulse-500 branch May 1, 2025 18:29
@daschuer
Copy link
Copy Markdown
Member

daschuer commented May 6, 2025

Thanks @Poyeyo. I like to add your name to the contributor list in the Mixxx about box.
Shall I use your real name or your GitHub name?

@Poyeyo
Copy link
Copy Markdown
Contributor Author

Poyeyo commented May 9, 2025

Thanks @Poyeyo. I like to add your name to the contributor list in the Mixxx about box. Shall I use your real name or your GitHub name?

Please add my name as Nicolay Leiva.

@daschuer
Copy link
Copy Markdown
Member

Done, sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants