Welcome! Log In Create A New Profile Wiibrew Wiki HackMii Blog

Advanced

Need help with ambitious project - DJ Hero Midi Control for windows.

Posted by Jezzick 
Need help with ambitious project - DJ Hero Midi Control for windows.
May 30, 2011 06:08AM
I'll start with an introduction since i'm new round these parts. B)

Im 19, Computer Science major, Huge techie and EDM fan.

I found out about osculator via youtube and immediately rushed out to get the DJ hero turntable, hoping I could begin to learn the basics of DJing with a pair of tables and Traktor Scratch, only to find out that there is no similar program/setup for Windows PC's. :(

A few weeks of research and trial and error later, I'm no further towards the convienient setup I hoped for.

I was able to hijack my moms mac for a few hours and get the setup working perfectly, but i decided I need to find a way to do it on my own computer.

I tried:
Osculator in VMware running OSX. (The versions of Osculator that are new enough to support the turntables won't run on either of my AMD computers.)

GlovePIE Programmable Midi Emulator. (The program appears to have ceased development and supports every part of the Turntable accessory but the actual platter.)

Did research into Pure Data as a Midi Controller program... which still relies on osculator to receive input from Turntable. >_<

It now appears as though if I want to use these in a windows environment, I will have to write the drivers myself. I have nowhere near the experience nessecary for this undertaking, but It appears as though most of the work has been done for me. I only need to tie these together.

My plan is to use WiiRemoteJ, a java wiimote library, to write a java program capable of translating DJ Hero table data to midi.

While WiiRemoteJ does not in itself support the DJ Hero Controller, It claims to support custom extensions, which is where most of my work will be done.

If anybody would like to help me with this project, It would be pretty sweet. No Solution exists yet, so we would be helping out a ton of people!

What I need to figure out right now, is how I can write a custom extension in wiiremoteJ, and How to interpret the DJ Hero Table Data to fit that schema.

I would be open to any other suggestions as well, for libraries or ways to accomplish this. I have only programmed in Java, so I think it will have to do, unless we can skip that step entirely somehow.

Thanks in advance, and I look forward to meeting and hearing from all of you!
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
May 30, 2011 03:02PM
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 16, 2011 04:16AM
hey, i got it to work! wii dj hero turntable on a pc (using glovepie). though glove does support the device and the buttons, it doesn't work for any of the others. to make it work, you have to get the data from the wiimote and interpret if yourself. luckily, i found a script that demonstrates this (it took a lot to find). thus alls you have to do is add in the midi output. and for those who happen to have two, you can actually double it up. as you might notice, the mixer has a connection on each side (for lefties). despite the fact they do the same thing in the game, they are actually separate data from each other, meaning you can have a 2 deck controller :D
hit me up if you're interested
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 22, 2011 11:25PM
I've been working on this same project for the past couple of weeks. My biggest hurdle has so far been a Vista/Bluetooth driver issue. Ended up using BlueSoleil (was the only thing that made any bluetooth work w/ my PC).

I see what you're getting at above would appreciate any help since I haven't coded anything in 10 years. Been getting my info by doing a lot of forum digging & a little trial & error w/ the GUI in GlovePie.
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 06:47AM
@Facing Tomorrow
Definitely interested... I have found no sign of the script you speak of... >_<
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 04:41PM
@molarkey
yeah, i've got win 7 and got the laptop with bluetooth, so just using that works for me :P once you get the bluetooth working, the rest should be pretty easy. glovepie allows for a variety of syntaxes, so you can make the same thing work slightly different ways. for the most part, the easiest way is just to type it out. to make sure you can connect the wiimote, just use a simple script:

debug=wiimote.exists

debug refers to the little window that shows up next to the run button once the script runs. this should state 'true' once it has connected (and the wiimote should have led 1 lit up). after that would be to get the wiimote to control the keyboard by saying something like:

key.a=wiimote.a
keyboard.b=wiimote.b

key and keyboard both refer to the keyboard buttons, so once you do this, it should type a when you push a on the wiimote, and b when you push b
o and when you type 'key.' or 'wiimote.' it should come up with a window telling you all the different things you can add

hope that helps a bit.


@Jezzick
yeah, i'm not even sure if i can find the original post again, but i do have a copy of it
i've edited it a bit for ease and convenience
-------------------------------
//based of some dude's alteration of the ghwt script
// (sorry, couldn't find your post again to get your name)

debug="<"+wiimote.Exists+"> "

if(wiimote.Exists) then
if(key.Space) then
debug+=" *** POKE!! ***"
var.space=true
var.ini=true
endif
if(!var.space) debug+=" Safe to connect. Press SPACE to poke"
else
debug+=" ..waiting to connect.."
endif

if(var.ini) then
debug+=" Active :D"
if(!var.init) then
WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
wait 100ms
WiimotePoke(1, 0x4A400FB, 0) // Unknown
wait 100ms
WiimotePoke(1, 0x4A40040, 0)
wait 100ms
WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type
var.init = true
endif

var.SX = (wiimote.Exp0 & 0x3F) - 32
var.SY = (wiimote.Exp1 & 0x3F) - 31
var.BE = !(wiimote.Exp5 & 0x10)
var.BM = !(wiimote.Exp4 & 0x10)
var.BP = !(wiimote.Exp4 & 0x04)
var.ED = ((wiimote.Exp2 & 0x60) >> 2) + ((wiimote.Exp3 & 0xE0) >> 5)
var.CS = ((wiimote.Exp2 & 0x1E) >> 1) - 8
var.RTT =((wiimote.Exp0 & 0xC0) >> 3) + ((wiimote.Exp1 & 0xC0) >> 5) + ((wiimote.Exp2 & 0x80) >> 7)
if (wiimote.Exp2 & 0x01) var.RTT = var.RTT - 32
var.RBG =!(wiimote.Exp5 & 0x20)
var.RBR =!(wiimote.Exp4 & 0x02)
var.RBB =!(wiimote.Exp5 & 0x04)
var.LTT = (wiimote.Exp3 & 0x1F)
if (wiimote.Exp4 & 0x01) var.LTT = var.LTT - 32
var.LBG =!(wiimote.Exp5 & 0x08)
var.LBR =!(wiimote.Exp4 & 0x20)
var.LBB =!(wiimote.Exp5 & 0x80)
if(var.CS<0)var.CS++
endif

-----------------------
pretty much you want to make sure that the turntable is not connected when you start (so glovepie sees it as a wiimote, not a wiiturntable), then once it notices a wiimote is connected, it'll tell you to connect it, then press space (as seen in the debug window) then, click on the variables tab and you should see the appropriate numbers changing. the wiimote buttons can be accessed with the 'wiimote.' and get the turntable data from the saved variables 'var.'
this should be able to get the data, so the midi part is alls that's left. now one thing i noticed is that if you spin a turntable really fast, it'll actually act like it's spinning slowly. this might be because of a missing bit or probably just overflow (cause, i doubt you'll really need to spin it that fast).



Edited 1 time(s). Last edit at 08/31/2011 04:56PM by FacingTomorrow.
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 06:29PM
Awesome, Thank you so much.

Ive got the code in GlovePie, and it runs great!

Now I just need to figure out how to format the midi signals to send them to traktor.

I'll keep you guys updated on my progress!
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 06:34PM
i've got it all working and more or virtual dj, if you're interested. i might suggest trying out vdj pro if you haven't already. customizability is to the extreme :D great for comp sci people. for the midi, i assume you have a internal routing program? it's not too hard, but you have to make sure to use the right midi device.
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 08:31PM
Yeah, MIDIyoke is the one that is supposed to work with glovepie, But I haven't gotten anything to work yet. How are you doing it?
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
August 31, 2011 09:27PM
first as a note, glovepie ignored capitalization, so cause i'm lazy, i'll only capitalize stuff if it makes more sense :P

i'm using LoopBe. then you have to use the right midi device, just like you would if you had several wiimotes. 'midi1.' refers to the first and 'midi2' is the second and so on. now really 'midi.' refers to the selected device (1 by default) and can be changed by setting 'midi.devicein' or 'midi.deviceout' as the number of the device you want to use. there is also a 'midi.DevNameIn' and a 'midi.DevNameOut' which will give you the name of the device. for my scripts, i would put a part at the top that would only run when the script starts, which goes through all the devices and checks their names and assigns the appropriate number to be used in the script. you could just use the number as 'midi3.' (or what ever it is), but this way, even if the midi devices get reordered it'll still work correctly without needing to be manually changed. also, you can then just use the 'midi.' making everything that much shorter :D
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 12:54AM
Thanks again! I was making do just using Midi3 but This is much more efficient. And I'll be sure to check out LoopBe.

Now I'm just need to figure out how to format the individual midi messages.

The buttons are easy, just noteon and noteoff I presume.
I was fidgeting with the crossfader to begin with, the script sets var.cf as -7 to 8 depending on position, and it looks like I should use inrange to convert it to 0-127, but I'm a bit clueless as to how to actually format the message.

I think The Turntable shoul be 0-63 for velocity of counter clockwise movement, and 65-127 for clockwise, but Im not positive, and I am clueless as to how to send that. >_<
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 03:35AM
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 06:58AM
Wow. That was pretty cool... I like your mix too. ^_^

I was using Traktor, because thats what the other person who used the dj hero tables to do used. He was on mac tho. >_<

I have loaded up VDJ now, And found I do like it better. Just need to figure out how to map the midi and im good. Thus far I have not once gotten CDJ to recognize my midi signals, on MIDI yoke or LoopBe



Edited 2 time(s). Last edit at 09/01/2011 10:36AM by Jezzick.
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 07:23PM
VDJ recognizes my midi commands now... Heres what Ive got so far:

----------------------------------------------------------------------------

// Wii DJ Hero Midi Output
// Jezzick (Thanks to Facing Tomorrow and Guy from GlovePie.org)

debug="<"+wiimote.Exists+"> "

if(wiimote.Exists) then
if(key.Space) then
debug+=" *** POKE!! ***"
var.space=true
var.ini=true
endif
if(!var.space) debug+=" Safe to connect. Press SPACE to poke"
else
debug+=" ..waiting to connect.."
endif

if(var.ini) then
debug+=" Active :D"
if(!var.init) then
WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
wait 100ms
WiimotePoke(1, 0x4A400FB, 0) // Unknown
wait 100ms
WiimotePoke(1, 0x4A40040, 0)
wait 100ms
WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type

midi.deviceOut = 2
var.MidiOut = midi.OutDevName
midi.defaultChannel = 1

var.init = true
endif

var.SX = (wiimote.Exp0 & 0x3F) - 31
var.SY = (wiimote.Exp1 & 0x3F) - 31
var.BE = !(wiimote.Exp5 & 0x10)
var.BM = !(wiimote.Exp4 & 0x10)
var.BP = !(wiimote.Exp4 & 0x04)
var.ED = ((wiimote.Exp2 & 0x60) >> 2) + ((wiimote.Exp3 & 0xE0) >> 5)
var.CS = ((wiimote.Exp2 & 0x1E) >> 1) - 8
var.RTT =((wiimote.Exp0 & 0xC0) >> 3) + ((wiimote.Exp1 & 0xC0) >> 5) + ((wiimote.Exp2 & 0x80) >> 7)
if (wiimote.Exp2 & 0x01) var.RTT = var.RTT - 32
var.RBG =!(wiimote.Exp5 & 0x20)
var.RBR =!(wiimote.Exp4 & 0x02)
var.RBB =!(wiimote.Exp5 & 0x04)
var.LTT = (wiimote.Exp3 & 0x1F)
if (wiimote.Exp4 & 0x01) var.LTT = var.LTT - 32
var.LBG =!(wiimote.Exp5 & 0x08)
var.LBR =!(wiimote.Exp4 & 0x20)
var.LBB =!(wiimote.Exp5 & 0x80)
if(var.CS<0)var.CS++

midi.Control1 = MapRange(var.SX,-31,32,0,1)
midi.Control2 = MapRange(var.SY,-31,32,0,1)
midi.Control3 = var.BE
midi.Control4 = var.BM
midi.Control5 = var.BP
midi.Control6 = MapRange(var.ED,0,31,0,1)
midi.Control7 = MapRange(var.CS,-7,7,0,1)
midi.Control8 = MapRange(var.RTT,30,30,0,1)
midi.Control9 = var.RBG
midi.Control10 = var.RBR
midi.Control11 = var.RBB
midi.Control12 = MapRange(var.LTT,30,30,0,1)
midi.Control13 = var.LBG
midi.Control14 = var.LBR
midi.Control15 = var.LBB

endif
--------------------------------------------------------------------

Now I just need to figure out how to map the jogwheels in VDJ to the turntables. everything else works, but I have yet to figure out how to wire them. I will most likely have to write a definition and a mapper to do so, but we will see. ^_^
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 08:30PM
yeah, i made a device definition, which will let you name all the midi signals with name, so it's waay easier to see what's what in vdj. it'll also let you do output (LED control, etc.). o and one thing you might notice is that because this scripting is a repetitive type, unlike most other programming, i'll sometimes do weird things. like if you map a button to 'play_stutter', you might find that holding it down causes it to stutter so fast it doesn't move. what i've done with most of the messages is make it so it only updates it when you need to. for most of the buttons you only need to send the 'true' value to trigger it and you only want to actually send it once the button is pushed (not the whole time it is pushed). it might be alright for a while, if you can make it work for you, but if you keep expanding you code and it passes the magical barrier, you have issues. really what i mean is LoopBe seems to have two ways to detect feedback, sending a unique message that if found on the input will then mute the routing, and if it has too many messages at once (like all you controls are trying to send messages at once). i annoyingly found this out the hard way. if you have things like using the wiimote pitch, turntables, and other things that use a good amount of data always going, it will overload it. so you might keep a variable, and only when that variable changes then update the midi message. it'll also make it easier for debugging. for me, i just used my daw to look at the midi stream, thus telling me what messages/values are being sent. if one is being sent continuously, it's really hard to see the stuff that isn't
i see i'm being kinda vague, so if you have specific questions, i can answer them more directly :P
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 01, 2011 09:28PM
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 04, 2011 03:41AM
the channels are actually 0 indexed, so channel="1" is channel 2
if that doesn't work, on mine, i made the name the same as the driver name, though not sure if that makes a difference (anywhere at all...)
other than that, it looks good so far
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 14, 2011 06:19PM
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
September 14, 2011 06:41PM
o hey, one thing i noticed is that when you use a low number control (control5, etc.), it appears that it also doubles it on a control message 32 higher. so if you happen to expand you code to use more than 32 control messages, once you map the 33rd it'll also react to the first one. i believe this is from the actual midi, having a LSB and MSB for certain values.

nice Moz, though the different syntaxes throughout the code can get a bit confusing :P
also, one thing you might put in your code is a way so the script finds the proper midi device to use incase your loopbe/midiyoke isn't the first device
o and is the ' for not? it looks like it might be, but then you use it on var.sx (non-boolean)
and like i say earlier, i would suggest you try out virtual dj pro, even if you don't plan on using it. the scripting is amazing on it
Re: Need help with ambitious project - DJ Hero Midi Control for windows.
December 10, 2011 05:48AM
alright, hope all is going well on your guy's endeavors!
so i finally played the actual dj hero game today and noticed something that would normally go un-noticed
it appears that the euphoria button has a light, which is obviously controlled by the game
anyone know of a way to control this light, so you could like make it show the state of an fx or flash to the beat
Sorry, only registered users may post in this forum.

Click here to login