Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: Custom midi Controller for Traktor 2

  1. #1

    Custom midi Controller for Traktor 2

    Hi,
    I want to build a custom midi Controller for Traktor 2(Dj program). My goal is to create a controller which has 2 turntable decks and a mixer. Just like

    http://www.instructables.com/id/A-Fr...tylish-Modula/

    this one.I will need at least 19 axis(knobs), 6 sliders and 74 buttons. However I couldnt decide what teensy should I go for. Creator of that instructables used Teensy++ but Teensy 3.1 has more analog ports. So my question is Will it be logical to choose 3.1?
    Also I want to make a shift button which makes us able to map 2 actions for 1 button.For example if you press a button without pressing a shift it will do the action1 but if you press the same button while shift is also pressed it will do the action2.So how I can make a shift method?(if shift option is too hard I will need more than 74 buttons)
    There is another issue Modern Controllers have a encoder?(I really dont know the name of that electronic but let me describe that: it is like a potentiometer however it does not have an end,I mean you can rotate it forever also it has stoping points.It is just like the knob on cars radio). So when I rotate it clockwise it must select next song, when I rotate counter clockwise it selects the previous song.
    If I accomplish that goal as I desired. My future plan for this project is to add led Output for the buttons(for example when I press play button Green led will illuminate). Will I need an additional teensy for the outputs?

    Greetings from Turkey

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,108
    An encoder (more precisely, a rotary quadrature encoder) appears functionally to the DJ as if its an endless potentiometer, but as far as the Teensy is concerned it is very different. A potentiometer is usually used by putting a known voltage across it and measuring the voltage at the wiper using an analog input. (That is how you will measure the position of the sliders).

    A rotary encoder on the other hand outputs two digital signals, so each encoder needs two digital pins. If they only used one pin, you would be able to tell the encoder moved but not which direction it had moved. By using a pair of signals, the direction of rotation can also be worked out.



    There is an encoder library for Teensy which does this for you.

    For a small number of encoders, this is fast and easy if the pins support interrupts. Which means your code can get on with other things and is told by the interrupt that one of the encoders moved. On Teensy++ 2.0 there are eight interrupt pins (0, 1, 2, 3, 18, 19, 36, 37) so you can connect four encoders while using interriupts. More can be added but then it will be slower and tie up your code in polling (repeatedly asking the encoders for their values, and seeing if anything changed). On Teensy 3.0 and 3.1 all of the digital pins support interrups so you could connect more encoders (but there are still not enough pins for 19 encoders plus 74 buttons).

    For the buttons, luckily you don't need one pin per button. Its best to arrange the buttons on a grid, electrically. For example, 8 rows and 8 columns uses 16 pins (8+8) and gives you 64 buttons (8x8). I said electrically because the grid refers to how the buttons are wired, not how they are physically arranged on your controller. There are also expander chips that effectively give you more pins. As an example this SX1509 16 Output I/O Expander Breakout gives you 16 digital pins (enough for an 8x8 matrix of 64 buttons) while using only two pins on Teensy for I2C communication.

    There is a library for I2C as well. For historical reasons its called the "Wire" library.

    A shift is just another button. Its your code that decides what to do when a button is pressed (which you can vary depending on whether another button is pressed, for example, or the position of a slider, or anything you want, really).

    LEDs can be controlled by Teensy but again that needs more pins. Pretty soon it needs more power, too (you can't draw all the current you need from the Teensy pins. Instead you use the Teensy to control power from a more capable power supply). There are libraries for that too, several of them depending on how your LEDs are configured.

    Then for MIDI output you have a choice of two ways to connect: the older DIN socket and the newer USB one. DIN is slower but more compatible with older equipment and doesn't need a computer. USB is faster but need s computer or some other USB host. Since Nativ Instruments Traktor is a computer program. USB MIDI is the right choice so read this page about USB MIDI on Teensy.

    So all of that is possible but its a large and complex project which will involve port expanders and might involve multiple Teensies talking to each other. Its probably best to order a Teensy 3.1, a few encoders, a couple of sliders and some buttons (maybe 20, 16 for a 4x4 grid plus some others for a shift and so on) and then you can get some experience connecting these up and writing code to make them work. Having done that you will be in a better position to decide if you can expand it all up to the large, complex controller you want. Plus you will have a small controller that you built yourself.

    This is a lot better than ordering hundreds of parts and ending up with an expensive, intimidating pile of electronics that you are not sure how to hook together.

  3. #3
    Thanks for your reply. I think you are absolutely right. I will start from just the mixer(2 decks are in future goals).However I think you misunderstood my encoder thing. I will use 19 potentiometer. I will just use 3 encoders. Well since I am not building the 2 decks now , I will only need 1 encoder. How can I hook 19 potentiometer to teensy because I will need some pins to add the buttons?

  4. #4
    By the way I am counting sliders as potentiometers. (Sliders+knob potentiometers=19)

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,559
    I'm curious how you're planning to map the encoder data (presumably from the Encoder library) to MIDI messages?

    I know a couple guys who use Traktor, but other than watching them DJ from a safe distance, I really don't know much about Traktor. Does it have some well-defined way for MIDI messages to represent continuous rotation encoders?

    Edit: I'd also agree, it's best to start with just a few buttons, pots and encoders to build up some experience. Odds of getting a large system working are much better if you've done a small one first.

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,108
    Quote Originally Posted by berathan90 View Post
    By the way I am counting sliders as potentiometers. (Sliders+knob potentiometers=19)
    Okay, so each one needs to be read as an analogue voltage. Since there aren't enough analogue inputs you need a multiplexer to connect them. (The various analog input pins on Teensy all connect to one (on in the case of Teensy 3.1, two) ADC via a multiplexer on the chip.

  7. #7
    Dear Paul,
    I don't know how to describe the function of the encoder but i will try my best. When I turn the encoder clockwise it must go down on the list when i turn it counter clockwise it must go up on the list. It must do the same duty as in our cars frequency finder.(it turns endless but in increments). If you still didn't understand. You can also look "ddj sx"
    From google images. The encoder is just top of the middle part which helps you to select songs from the directory.
    Thanks for your reply

  8. #8
    Dear Nantonos,
    So I will need
    https://www.sparkfun.com/products/299

    This to multiply the amount of analog inputs and

    https://www.sparkfun.com/products/11502

    This to multiply the amount of digital inputs.Right??

    Also what will happen when I need more than 64 buttons in the future? Will I have to add another i2c multiplexer? Also my programming skills are very tiny from java and I am still learning (I study computer science and its my first year at University). When I look codes for arduino , teensy I understand what it does and how it operates. However I am not capable of righting that code. And is it a difficult task to write a code for i2c multiplexer matrix?
    I couldn't understand how can teensy control power supply?
    One last question, if the two parts(the 2 links) are correct setup for my case, how many pins are occupied on teensy with this setup?
    Thank you very much

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,559
    Quote Originally Posted by berathan90 View Post
    When I turn the encoder clockwise it must go down on the list when i turn it counter clockwise it must go up on the list.
    The Encoder library will give you this functionality.

    http://www.pjrc.com/teensy/td_libs_Encoder.html

    Just use Encoder.read() to get the number, which will automatically increase or decrease as you turn the encoder shaft. Before you try controlling Traktor, first just connect the encoder and run the example program where you can see the number change in the Arduino Serial Monitor.

    Technical projects are done this way, where you get smaller pieces working and tested, and then you put them together.

    My question was about what MIDI messages Traktor expects to receive to tell if the encoder has rotated?

  10. #10
    I will map buttons one by one traktor lets the user to map any button to any action (mostly). By the way i really don't know what traktor expects. But I tried with a Joystick and I was be able to map Joystick buttons to traktor actions.However traktor doesn't understand Joystick so I used a little application which emulates Joystick as a midi controller. I mean it converts Joystick input data to midi .

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,559
    Well, Teensy is capable of sending any MIDI message. Sounds like you've got some research (or experimenting) to do on which MIDI messages are needed to control Traktor the way you want.

    I hope you'll share your findings on this?

  12. #12
    Junior Member
    Join Date
    Jun 2018
    Posts
    5
    Quote Originally Posted by berathan90 View Post
    Hi,
    I want to build a custom midi Controller for Traktor 2(Dj program). My goal is to create a controller which has 2 turntable decks and a mixer. Just like

    http://www.instructables.com/id/A-Fr...tylish-Modula/
    Hi there!

    I am working on a similar project and trying to map MIDI messages to Traktor, but I seem to be lost. I also came across the Fuzzy Wobble instructable and he seems to use usbMIDI.sendNoteOn(note, velocity, channel) for this. Using channel 126 and 127 for backwards and forwards, respectively, and changing the note also. But still too fuzzy for my lack of programmng skills. How did it work for you?

    Best regards,
    Natasha

  13. #13
    I don't have the code anymore. (I have it in my backup drive which is not with me) What I can offer you is watch Evan Kale's midi keyboard video on Youtube and modify the codes. Sending midi notes are not hard at all. I was a beginner when I did that project. By best advice would be start small on breadboard and then expand it.
    Due to corrosion my controller doesn't work but it used to work. And I don't have time to fix it, plus I dont need it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •