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

Denon Prime 4 - MIDI Mapping #4027

Draft
wants to merge 134 commits into
base: main
Choose a base branch
from

Conversation

whanake-music
Copy link

This PR intends to allow the usage of the Denon Prime 4 to control Mixxx while in computer mode. The end goal of this PR is for the Prime 4 unit to have as much functionality with Mixxx as it would standalone, except for the screens as these require more than just MIDI scripting.

NOTE: I created a PR for this mapping a few days ago, but I based it off the wrong branch, and rebasing was giving me a lot of errors that I didn't know how to fix. So I closed that PR and re-opened this one on the right branch from the get-go. Apologies for the clutter and mess. I'm still quite new to this process but would like to help wherever I can.

@Holzhaus
Copy link
Member

Holzhaus commented Jul 8, 2021

Hi, thanks for contributing.

Unfortunately, there are a bunch of pre-commit issues. Please have a look at the pre-commit CI build. There's a patch file you could download to fix some of the problems automatically.

As an alternative, i strongly recommend to set up pre-commit locally: https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checking

After you did that, you can run it on your existing comments using:

$ pre-commit run --from-ref upstream/2.3 --to-ref HEAD

NOTE: I created a PR for this mapping a few days ago, but I based it off the wrong branch, and rebasing was giving me a lot of errors that I didn't know how to fix. So I closed that PR and re-opened this one on the right branch from the get-go. Apologies for the clutter and mess. I'm still quite new to this process but would like to help wherever I can.

Don't worry, but for next time you need to rebase, I'd like to point out that we have documented the process of rebasing on our wiki: https://github.com/mixxxdj/mixxx/wiki/Using-Git#targeting-another-base-branch
If there is only a single commit, you could also just copy the git commit id, then run:

$ git reset --hard upstream/2.3
$ git cherry-pick <commit-id>

(This is just for your information, don't run the two git commands on your branch, it is already rebased).

If you encounter problems, don't hesitate to ask here or on zulip.

@whanake-music whanake-music changed the title Denon Prime 4 - Mixxx Mapping Denon Prime 4 - MIDI Mapping Jul 18, 2021
@github-actions
Copy link

This PR is marked as stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the stale Stale issues that haven't been updated for a long time. label Dec 25, 2021
@icedream
Copy link
Contributor

icedream commented Jun 7, 2022

Dropping this bit of information found by @ghuntley here: https://github.com/ghuntley/denon-prime4/blob/trunk/engineos/usr/Engine/AssignmentFiles/PresetAssignmentFiles/JC11/JC11_Controller_Assignments.qml

These are seemingly the exact controller assignments used by the Engine software shipped on the Prime 4 firmware. Maybe that helps?

@Swiftb0y
Copy link
Member

Swiftb0y commented Jun 7, 2022

Hey @icedream. Thank you very much for sharing this. Since this PR seems to be abandoned, I don't know how useful it will be for the Prime 4 specifically, but since there are also "AssignmentFiles" for other Denon hardware, I'm sure this will be of use in the future.

@whanake-music
Copy link
Author

Hi everyone, sorry for the inactivity. Things have been getting real busy and I have recently moved, so I don't have a space or the time to work on the Prime 4 mapping at the moment. I do intend on picking this back up at some point near the end of this year though. Apologies for keeping everyone waiting.

@ghuntley
Copy link

ghuntley commented Jun 7, 2022

Totes understand @whanake-music. There have been some developments overnight that you may not be aware of however with the Prime series of controllers. We have managed to repack the firmware, enable ssh, and run X11. Thus running MIXXX on the prime controller instead of EngineOS is a very real possibility right now.

FUkz1ieWIAI4E3O

FUpKuQZWQAAGNCe (1)

See https://github.com/icedream/denon-prime4/releases/tag/v2.2.1-ssh and notes at https://github.com/icedream/denon-prime4

@Swiftb0y
Copy link
Member

Swiftb0y commented Jun 7, 2022

Thats great. A very important usecase for mixxx would also be for laptop DJs that need to use other peoples (potentially the venues) gear. Since the SC5000/6000 seem to be able to compete with CDJs, they might become more present in nightclubs in the future. Thats why I'm personally really interested in the other "PresetAssignmentFiles" that were included in this.

Thank you both for your amazing work and sharing that with the mixxx community.

@github-actions github-actions bot removed the stale Stale issues that haven't been updated for a long time. label Jun 8, 2022
@whanake-music
Copy link
Author

Wow!!! I remember seeing a reply to my forum thread talking about this a few months ago, but I'm so excited to see more progress made with it! Definitely makes me want to focus on the mapping more so it can integrate really well when we do manage to run Mixxx straight on the device :)

@Swiftb0y
Copy link
Member

the PFL volume in mixxx could be at 0.
Does the prime 4 do its headphone splitting in hardware? (My numark controller does), if so, then we need to unmap it in the controller mapping and you'll need ensure that the pfl volume and balance is set correctly in mixxx (as well as the volume).

@Swiftb0y
Copy link
Member

The "Analog Surround 7.1" label in the screenshot is also weird. Maybe there is some "virtual surround sound" shenanigans going on under the hood which messes with the channel config?

@icedream
Copy link
Contributor

Oh man that is weird... Sorry for the confusion. I'll try look into this and see what i can do to fix it. Is there any chance you could upload a video showing the Prime 4's behaviour? If you can't, it's not a problem, but it would help me understand the issue a bit better.

I can try and record a video at a later time but it's pretty much just no matter if split is enabled or not, all I hear is main out with this configuration.

The "Analog Surround 7.1" label in the screenshot is also weird. Maybe there is some "virtual surround sound" shenanigans going on under the hood which messes with the channel config?

This is what JACK spits out when PipeWire is acting as the JACK daemon. I've not checked what happens if I work around PipeWire as that requires a more involved setup.

@icedream
Copy link
Contributor

icedream commented May 20, 2023

It turns out the correct audio channel mapping for me is channel 5-6 => cue, channel 1-2 => main - cue also seems a lot louder than main if I don't zero it out properly as opposed to what the original firmware does. It might be channel 3-4 is in fact booth output? I got nothing hooked up to it to test it right now though.

And yes, it seems the cue mixing is done on the hardware side and Mixxx can only show it but not influence it in the current state.

@whanake-music
Copy link
Author

In the mapping's current state (AFAIK), Mixxx does control the gain of the cue mix as well as master gain in conjunction with the Prime 4 controlling them on its soundcard, resulting in exponential curves when moving the gain and cue knobs.

@icedream
Copy link
Contributor

icedream commented May 27, 2023

The "Analog Surround 7.1" label in the screenshot is also weird. Maybe there is some "virtual surround sound" shenanigans going on under the hood which messes with the channel config?

Turns out you were right. I found time again to read further into how PipeWire handles audio gear like the Denon Prime 4 and there is a "Pro Audio" profile that I had to switch to. Leaving it at the default would make PipeWire "upmix" the audio to 7.1 surround hence the confusion. In Pro Audio mode the channel mapping Main=>1-2 Cue=>3-4 is correct.

The Cue mix now works as intended. 👍🏻

@Swiftb0y
Copy link
Member

Thank you for your analysis. That's a bit weird, my Numark NS6II is also a 4 channel DAC but that worked pnp under pipewire, does the prime4 have more channels?
@whanake-music Since the use of pipewire will become increasingly relevant, I think the solution to this issue should be put in the manual page of the prime4.

@whanake-music
Copy link
Author

Thanks for the info. I don't use PipeWire myself but I'll make a note of this to put in the manual page in future

@icedream
Copy link
Contributor

icedream commented May 27, 2023

Thank you for your analysis. That's a bit weird, my Numark NS6II is also a 4 channel DAC but that worked pnp under pipewire, does the prime4 have more channels?

The Prime 4 registers as one output device having 8 output channels on my installation, 4 pairs of stereo. I think it just tried to autodetect those 8 channels as "looks like 7.1 surround"?

(btw those seem to map to Main Output, Cue, Booth and Zone Out. Have not tested each of the channels yet though.)

@whanake-music
Copy link
Author

I have also noticed the 8 outputs. I'll play with some audio routing next time I have some free time and see if that is the case - Using Auto DJ on deck 4 in conjunction with the rest of Mixxx for performing could be a great way to use the Prime 4's Zone Out feature-set. I don't even think Serato or Virtual DJ can do that 😉

@Swiftb0y
Copy link
Member

The Prime 4 registers as one output device having 8 output channels on my installation, 4 pairs of stereo. I think it just tried to autodetect those 8 channels as "looks like 7.1 surround"?

Thats very plausible.

@icedream
Copy link
Contributor

icedream commented May 30, 2023

Hope you allow me some shenanigans with this already. 👀

denon_prime_4_mixxx_sh.mp4

Things to note:

  • The MIDI interfaces are pretty much behaving the same as if having Mixxx hooked up to the controller via USB. Buttons, knobs, faders behave the same except for the stepped rotary dial which is meant to browse through the library, it seems to not respond.
  • The audio channel mapping is different. From first playaround I think it's Ch1-2=>Deck 1, Ch3-4=>Deck 2, Ch5-6=>Deck 3, Ch7-8=>Deck 4 via ALSA. Channel volumes for some reason apply even to Cue output when Cue is enabled for a channel.
    • Fast flickering on the Deck volume meters because Mixxx is fighting over controls with the hardware?

And yes, the interface overall is laggy because graphics acceleration isn't a thing I have successfully figured out yet but that's irrelevant to this PR.

@whanake-music
Copy link
Author

Thank you for your comments! First of all, how did you get Mixxx running on the console??? I'd love to get this working on my machine too!

In terms of the VU meters, I'm not sure what's causing the flickering. Maybe the Prime 4 has its own way of utilizing those meters when in standalone mode? When in Computer Mode, the channel-specific VU meters (not the master L+R ones) only respond to MIDI messages, not audio input AFAIK.

The browse encoder only scrolls through the library when it is in focus. Try using the BACK / FWD buttons to move from the left pane to the main library window. That should fix the issue.

@icedream
Copy link
Contributor

icedream commented May 30, 2023

Getting Mixxx running on this has been a bit of a challenge in itself, I've been working on this on and off at icedream/denon-prime4#22 and icedream/denon-prime4#8. The current state of it is we can build a custom firmware, it will boot to the splash but afterwards Mixxx has to be started up manually using a set of commands to flip the screen the way the original firmware does it, load the correct libraries and then kick off dbus and Mixxx. It's super not-user-friendly at this point and I still need to document and work on that. Not to mention of course the issues with the Mali GPU and Qt.

Maybe the Prime 4 has its own way of utilizing those meters when in standalone mode? When in Computer Mode, the channel-specific VU meters (not the master L+R ones) only respond to MIDI messages, not audio input AFAIK.

That is exactly how I understand it currently as well.

Try using the BACK / FWD buttons to move from the left pane to the main library window.

Totally forgot about those buttons existing, not going to lie. 😅

I will play around with this further tomorrow I think.

@DeathCamel58
Copy link

I thought I'd chime in to mention that this currently does not work on main.

Mixxx returns this error when attempting to load the MIDI mapping:

Uncaught exception: file:///home/deathcamel57/Documents/dev/mixxx/res/controllers/common-controller-scripts.js:251:
TypeError: Cannot call method 'substring' of undefined

Backtrace: @file:///home/deathcamel57/Documents/dev/mixxx/res/controllers/common-controller-scripts.js:251
JogWheelBasic@file:///home/deathcamel57/Documents/dev/mixxx/res/controllers/midi-components-0.0.js:773
@file:///home/deathcamel57/Documents/dev/mixxx/res/controllers/Denon-Prime-4-scripts.js:929
@file:///home/deathcamel57/Documents/dev/mixxx/res/controllers/Denon-Prime-4-scripts.js:403

There's a very similar issue with #12047 as well. Only difference is the script and line number, but still in the jogWheel part.

@acolombier
Copy link
Member

I understand there is still work to be done here. I'll mark the PR as draft for now, but feel free to make it ready for review as soon as it should be reviewed again and merged!

@acolombier acolombier marked this pull request as draft February 5, 2025 16:04
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.

10 participants