-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 MC7000 mapping #2546
Denon MC7000 mapping #2546
Conversation
Hi @toszlanyi, thanks for contributing this mapping and documenting it to great extent on the Wiki! There are some code style issues though. If you have at least Python 3.6, I suggest you install pre-commit and then install our pre-commit hooks from our repository:
Then you can just run:
That will check for code style issues with your files (and them automatically if possible). |
Another thing: 2.3 will feature colored hotcues. If you intend to add support for that, I suggest you wait until #2520 has been merged (which will hopefully happen soon-ish). |
Thanks a lot for your quick action. As this is my first commit ever then I am unsure how to follow up on that but will try to stay on top of it... As for pre-commit: I am on KDE Neon built upon Ubuntu 18.04 that includes Python 2.7.17 at present. Any chance to check the files in a different way before commit? Maybe you'd know if a plugin for KDevelop exists. On a quick search I didn't find one. Cheers! |
Try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall pretty feature complete mapping. However, there is a lot of redundant code for handling the pads which is not ideal.
// Assign Spinback length to STOP TIME knob | ||
MC7000.stopTime = function(channel, control, value, status, group) { | ||
var deckNumber = script.deckFromGroup(group); | ||
// "factor" for engine.brake() | ||
// this formula produces factors between 31 (min STOP TIME for ca 7 sec back in track) | ||
// and 1 (max STOP TIME for ca 18.0 sec back in track) | ||
MC7000.factor[deckNumber] = (1.1 - (value / 127)) * 30 - 2; | ||
}; | ||
|
||
// Use the CENSOR button as Spinback with STOP TIME adjusted length | ||
MC7000.brake_button = function(channel, control, value, status, group) { | ||
var deckNumber = script.deckFromGroup(group); | ||
var deck = parseInt(group.substring(8,9)); // work out which deck we are using | ||
engine.brake(deck, value > 0, MC7000.factor[deckNumber], - 15); // start at a rate of -15 and decrease by "factor" | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the purpose of this code? If you just need to reverse or censor the track you can use the reverse
and reverseroll
controls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I had CENSOR mapped as you suggested but instead I thought it was more useful to get a back spin assigned to this button as the platter doesn't rotate freely. With the STOP TIME knob you can adjust the length of spin back (defines the factor for midi signals 0-127 when turning the knob from min to max).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but when you want to merge a mapping so other users can use it easily, they expect the controller to act according to how it does in other applications. @Be-ing is this statement correct?
Obviously you can still use this code for your own use case, but you can't expect other users to have the same usecase as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... or I can make it optional with a user definable variable to be true or false. Standard would be Censor and if one wants to set it then easily gets the spin back function on that button. Thanks for the hint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well yes, that's what I did as well when I started mapping, but doing it is generally discouraged as it just unnecessarily bloats the mapping.
Have you taken a look at the coding guidelines for mappings yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I did look into that coding guidelines and believe that I worked to an extend of it - even not all though. Anyhow as it is called guideline and not rule I thought it was not too strict.
As for the STOP TIME function, actually Be pointed me to use it as factor for engine.brake in the forum mapping thread and to be honest the CENSOR function in my case is useless. You could still manually activate CENSOR by switching SLIP on and then use REVERSE button which is the shifted CENSOR.
One more point: I cannot maintain different versions of the mapping - which means one for "public" and one for myself so we have to find the right solution for everybody's or most users case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can understand all of your points. Frankly, I don't have the authority here, so I'd like to ask @Be-ing to decide.
@Swiftb0y, thanks a lot for looking into this. I have asked so many times in the forum when starting this mapping but got very few help so I had to guess and steal from other mappings and adjust to match the MC7000. So that coding has got several influences and things are not consistent. One piece maybe written in another way as others. Anyhow I am so glad you looking into that and I thank you for all the hints. Gonna work around the pieces as far as I can but especially would need help with PAD modes. WOuld you mind checking the forum and we continue there? https://www.mixxx.org/forums/viewtopic.php?f=7&t=13126 Again, many many thanks!!! |
// lower values make it less, higher value more sensible | ||
MC7000.jogParams = { | ||
jogSensitivity: 30 ,// default: 30 | ||
maxJogValue: 3 ,// default: 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the reason for this maxJogValue
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the scratchingExample.js code from the WIKI was not satisfying for me. But as I am still pleased with the MC4000 way how the scratching feels like then I copied the formula from there. Honestly - without really knowing what the parameters tell me. Experimenting with the values showed me different behavior though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameters only change things when moving the wheel while having vinyl mode deactivated. So they shouldn't influence the Jog behavior in any way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for confusion: You are right - this is for controlling how sensitive the the platter is when beat matching - accidentally wrote scratching...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the reason for having jogSensitivity
but not really for maxJogValue
because that just clamps the value given to mixxx which doesn't really make sense. It should make a difference for you at higher speeds. Can you set it to a really high value and then beatmatch a bit? does it get more difficult or can you do it faster (since not clamping the value should allow you to do faster adjustments)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't let me go so I checked in more detail what the author of the MC4000 wanted to happen: The "jog" values generally can be set from -3 to 3. Inside the MC7000.wheelTurn function the "jog" parameter can be narrowed down in the way when it asks for the Math.min(MC7000.jogParams.maxJogValue, jogAbsolute). So even if the jogSensitivity is high, e.g you turn too hard - which influences the maxJogValue - the value for "jog" maybe maximum 3 (or lower if you set MC7000.jogParams.maxJogValue accordingly) if the variable "jogAbsolute" exceeding it. So it works like a limiter on the "jog" value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. exactly. But I don't see a practical reason for implementing this.
I'm not active on the forum at all (I don't think I even have an account on there). |
Oh - this was my first project - never programmed before and I guess I almost know the WIKI pages out of my head now - not really but you get it. The issue is that some points are not clear if you start from zero, like me. Especially the sampler buttons seams so easy on that wiki page but also asked in the forum about how to implement - never got help. Tried different ways and came up with a quite excessive but for me easy to understand code for the PADs. I am sure this can be made much easier. As for the discussion I am happy to keep it here. Thanks again. |
When I got started with JS, I did have some previous python experience but none in JS so my code looked very similar to yours. In case you would like to dig deeper into JS and programming in general, I can recommend you codecademy. Especially their JS course. |
It makes sense to get |
Thanks everyone - by now I corrected almost all issues - the unnecessary semicolon were not detected so I do not exactly know which ones to delete.
How to proceed further? Thanks a million. |
You should get rid of all eslint errors and warnings. All the warnings are formatting/style issues and all the You should be able to get rid of the |
OK - this is the status now but especially the "Closing curly brace does not appear on the same line as the subsequent block" changes now make the code less readable. Anyhow, the warning disappeared. Thanks a lot for your further guidance.
|
Readibility is subjective. The purpose of the guidelines is to make the codebase consistent. Can you commit and push your progress? |
Please also run |
Hey, there are still some code style fails. Check the details of the "CodeFactor" check. |
I am wondering why though. Those lines have been corrected and even when I am going into my Denon_MC7000_mapping branch and wanna change the file then it is all correct. So the analyzer somehow sees something that is not there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fully satisfied but the mapping still seems mergeable.
I am not satisfied either as it is not complete but I am working (mixing) with this for approx 8 weeks now and it is very usable. I still have some work to do and I would appreciate your help. Thank you very much. |
@toszlanyi The Denon MC7000 features color hotcue pads, right? Mixxx 2.3 adds support for custom hotcue colors. Do you want to add support for that in your mapping? If so, you first need to pull in the latest master state ( You'll also need to get a mapping between colors and midi values from your controller (e.g. "if I send midi value mixxx/res/controllers/Roland_DJ-505-scripts.js Lines 981 to 998 in bf1e089
You can then get the appropriate MIDI value for a hotcue like this: var value = colorMapper.getValueForNearestColor(engine.getValue("Channel1"], "hotcue_1_color")); If you don't want to deal with color changes yourself, I suggest you switch to components-based mapping for Hotcue Buttons. Then you can just do this and everything should work: var colorMapper = new ColorMapper({
"#CC0000": 0x01,
"#CC8800": 0x02,
"#00CC00": 0x03,
"#0000CC": 0x05,
// ...
});
var hotcues = [];
for (var i = 1; i <= 8; i++) {
hotcues[i] = new components.HotcueButton({
number: i,
group: "[Channel1]",
midi: [0x91, 0x26 + i],
colorMapper: colorMapper;
});
} |
@Holzhaus, I would really love to switch to components based mapping as mine is far too complicated but I do not know how. In the forum I have asked for different versions that all did not work but unfortunately nobody could help. I always get error message that variable "components" cannot be found. Any possibility you could support with the syntax directly in my script for hotcues? Surely I would be able to adopt to the other modes then when I have got an example for the first one. Cheers! I would like to get the PAD modes somehow better coded until I switch to coloured hotcues but then yes - would be great! Thanks a lot |
You most likely forgot to include the components library in your environment. Components could also aid you in developing a better solution for the way you handle the pads. |
OT: We really should add a step-by-step tutorial how to write a good controller mapping to the manual. |
Maybe I can make a proposal then... I gonna try to rewrite the PADs using components and if successful then I could go and make a proposal to the WIKI site. Maybe I create a draft site combining all my experience as a beginner in coding and what I have learned through different WIKI sites, Forum, different mappings and your support via GitHub get my mapping done. Step by step in one page as summary but still linking to the different existing sites... Cheers! |
Sounds good to me. Can you remove the confusing |
already removed and all working fine - tomorrow I gonna check if I can somehow simplify the Roll and Slicer section so it passes the CodeFactor check. |
Co-Authored-By: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com>
Started a discussion about this here: https://mixxx.zulipchat.com/#narrow/stream/113295-controller-mapping/topic/How.20to.20write.20a.20controller.20mapping.20from.20scratch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much. Please change the mapping name to just "Denon MC7000" and add a changelog entry, then I'll merge.
Co-Authored-By: Jan Holthuis <holthuis.jan@googlemail.com>
Thank you very much! It's changed accordingly. |
@toszlanyi Please don't forget to add the changelog entry ;-) |
I did at the web page and pressed "Propose file change" ... Guess one of you guys need to accept as I do not have write access |
You should edit the CHANGELOG file on your computer, then commit the change and add it to this PR. The link was just meant to help you find the correct location in the file. |
…o Denon_MC7000_mapping
Okay, done... Thank you so much for your patience and your nice guidance. Cheers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you very much for your contribution! LGTM.
Initial Denon MC7000 mapping. PAD Modes are working for CUE, ROLL and SAMPLER.