Got my double tap detection working. The timer code I use was acting a bit ‘weird’ but I found that increasing the timer time to two seconds seems to have cured most of the issues with it. Not sure why it was behaving strangely. I guess that’s the problem with using other people’s library routines, you never quite know what they are really doing. That is unless you want to spend a load of time figuring them out in which case you may as well just write your own. I might still do that, the timer library code has some strange behaviors that I’ve had to code around, always hate that.
Posts Tagged ‘Jamman’
My ‘one more mod’ was to detect a double tap stop and avoid setting the internal ‘playing’ indicator on the second tap which is what happens now if you do a double tap (which is why I need the foot switch on the box to be able to reset it).
Should be dead easy, setup a timer and if you see a second stop within the timeout period, ignore it.
However I have found that the timer library I am using (TimerOne) seems to drive the timer exit as soon as you attach it. This might be great for turning an LED on and off but not so much use for my intended use which is as an actual timer!
I’ve managed to finagle the code to ignore the initial timer interrupt and it mostly now works, I’ve just got one ‘glitch’ in the code somewhere where it still fails to ignore the second ‘stop’ under certain circumstances.
Sometimes what looks simple just isn’t!
One last thing I want to do (for now anyway LOL). If I double tap the stop button on the Jamman to force an immediate stop vs the fade out I usually use, the Hackman treats the second tap as a start and sets the playing flag (and LED) to on. This is one way the Hackman status can get out of sync with the Jamman and why I have the ‘reset’ switch on it now.
So it seems to me I should be able to detect a double tap and ignore the second stop command if it occurs quickly enough after the first one, say within half a second.
Let the experimenting begin!
Until you have a sticker…
So the Version 2 box is done. The main difference is that there’s only one switch now that is connected to the Arduino to reset the ‘playing’ flag if things get out of sync between what the Hackman thinks the Jamman is doing and what the Jamman actually is doing. I’ve not done the reset software yet though so the switch does nothing.
Enough chatter, some pictures…
Midi in and out:
Power socket and programming connector:
The guts of the beast (I always think it’s a shame that you have to hide the most interesting bit):
I tested it with the version one software and it works fine so it’s on the pedal board. I’ve got a gig tomorrow morning so it’ll be a chance to try the new setup out. I’ll take the old Hackman along just to use it as a switch box for the Beat Buddy since the switches are not connected to anything internally. Also, if this one fails for any reason, the guts are still inside the old Hackman so I can just swap them over. Since I’ve got spare boxes and switches, I may just build a new switch box and leave the old Hackman as a spare.
Turns out that I can turn off the feature in the Beat Buddy that causes it to set a new tempo every time I change songs so now, as I scroll through songs the tempo remains at whatever I last set it to.
This means I don’t need to resend the tempo from the Hackman so the Hackman does not need to control song scrolling either.
So what I am going to do now is continue to make the new Hackman but just have a single push switch on it to reset the play flag and gut the old one as before, just leaving the switches and socket in it so that I can use it as an off board switch (that is easier to reach) to scroll through the Beat Buddy songs.
At last I think I have a plan (maybe LOL!)
Well it turns out I cannot easily make the Hackman step though the songs in the Beat Buddy because there’s no midi function in the BB to let me do that. I can select specific folders and songs within folders but not simple step forwards and backwards through them.
I cannot really use the specific folder/song method because there’s no way for the Hackman to ‘know’ what folder/song the Beat Buddy is set to. I could set them to match manually but if I manually change the folder/song on the Beat Buddy, they would be out of step but then as soon as I changed the folder/song via the Hackman, it’s just to whatever the next folder/song the Hackman was set to. Overall, not an ideal user interface.
However I could still send the last known tempo which is the whole point of this (to avoid me having to do a tap dance on the Jamman after I change Beat Buddy tracks) so it might be still be worth it.
So I think that what I am going to do is to continue building the new Hackman and even still install two switches in it but Hooked up to the Arduino, so that I can at least still reset the internal ‘playing’ flag and hope that at some point in the future they add the midi function I need to the Beat Buddy. I’ll then remove the Arduino from the old Hackman and just use that as an external ‘off pedal board’ switch box to select drum tracks just like I do now, but being off pedal board will make it easier to get to since right now being at he back of the board, it’s not easy to reach.
So one thing I mentioned earlier that I needed to do was to add a reset switch for the play mode function in the Hackman. but then I got to thinking about the switches I already have in there. Right now those are hooked up directly to the switch input in the Beat Buddy and are used to switch songs up and down. But then it occurred to me that you can switch songs up and down with midi so why not connect the switches to the Arduino inside the Hackman and have IT then send the appropriate midi commands to the Beat Buddy. What’s cool about this is that I could also make it resend the last tempo it saw any time it switched Beat Buddy tracks. That would mean I would not need to do a load of foot tapping on the Jamman to reset the tempo if I changed Beat Buddy tracks since the Hackman would do it for me.
It would also remove the need for the switch cable from the Hackman to the Beat Buddy OR I could still keep that and assign different functions to a pair of switches. If I did that I think I’d make the external switch box free standing instead of being attached to the pedal board because reaching over to the back to press buttons is not that easy and it’s just be a simple plug and go operation to setup since there’s no power involved.
The other advantage of integrating the Hackman switches into the Arduino is that I could also detect when both switches are pressed together and use that to reset the play mode flag internally. Since this in not something I need to do very often (only when I mess up my foot tapping between pedals) I think that would work great and be a usable solution to what I am trying to do.
Sometime I amaze myself at how bloody good I am !
So right now I have my Hackman is setup to only send tempo midi messages to the Beat Buddy when the tempo changes. This is fine, so long as it actually changes. However, if for example track 130 and 131 are the same tempo for some reason (maybe I was messing around on 131 andset it to 130 bpm) and I change drum tracks on the BB, then I need to toggle the track on the Jamman to get the Hackman to send a tempo command the the BB.
If I just toggle to track 131 say, and then back to 130 the tempo did not change because both are at 130 so the Hackman does not send a tempo command to the BB.
So I plan to change it so that when it is NOT in playing mode the Hackman sends a tempo command to the BB any time it receives as tempo message from the Jamman. When the Hackman thinks the Jamman IS playing, I’ll only send a tempo command when the tempo actually changes.
Another way of handling this would be to hook up the BB midi OUT to the Hackman and then resend the current tempo any time the drum track changes on the BB. However that would require me to add another socket and wiring to the Hackman for the midi out from the BB so the previous solution seems easier for now. However I might still do this latter mod later on.
Another thing I need to do is to add a reset button to the Hackman to reset the internal ‘playing’ mode flag. If I hit the stop button when the Jamman is in fade out mode the Hackman thinks it’s started playing again and so sets the play flag on (The Jamman sends out a stop signal at the end of the initial recording loop even though it is dropping into ‘play’ mode so I have to treat both stop and play as actually meaning play). This then results in a lot of random toe tapping between the Jamman and the stop button to reset the play mode flag in the Hackman. It will be a lot easier if I just have a simple button I can press to reset the play mode flag if/when I mess up, even if I have to bend down to do it.
A short video describing my pedal board setup and yes, that is me at the start of this video. Let’s just say that I am happy on the inside and leave it at that LOL!
Well, I had to make a new pedal board as it was NOT going to all fit on the old one. Well, it would so long I did not want to actually connect anything to anything else! So here’s the new board:
All the power leads are hooked up although I still need to hook up the midi cable from the Hackman to the Beat Buddy (all I’ve got is a really long one for now) but most annoyingly, I’ve misplaced (I.E lost) a TRS cable I had with right angle plugs on it to hook up the Hackman to the Beat Buddy so it looks like I’ll have to make a trip to the music store soon to get another cable.
So I finished up the Hackman tonight. I have a few small and annoying problems like the power connector on the mock up Arduino I as using (an old one that did not work) was set slight further back than the one on the actual board I was using which resulting in the actual board not fitting onto the mounting plate until I’d opened up the hole for the power lead to accommodate it. That and a bad connection inside one of the plugs I’d made up to connect the midi out connector to the daughter board I’d built which cost me another couple of hours to track down.
Oh, and I wired the bloody indicator led up backwards Duh!
However once all that was done, it works fine.
All I’ve got to do now is make room on the pedal board for the drum pedal, mount Hackman on the pedal board above the other pedals because it will be at the back and squeeze another two wall wart power supplies in there for the drum pedal and the Hackman.
Still, all in all, pretty cool.
Now that I’ve got the Jamman and the Beat Buddy working together about as nicely as I can for now, the next step is to put it all into a project box so that I can mount it on my pedal board. I’ve used an eBay sourced Hammond 1590bb knock off box to house everything. I’ve used this size box before for Arduino projects and it works well.
Since it’s now got a box to live in, I’ve dubbed it “HackMan” for want of a better name.
Some pictures to relieve the boredom….
I drilled and then filed a square hole in the end of the box to take the Arduino USB connector so that I can easily reprogram it without having to take everything apart. The round hole next to it is for the connector to a 9v wall wart (+ve center, NOT negative like most pedals!!!).
At the other end there’s a regular midi connector for the midi out to the Beat Buddy and a 1/8 inch TRS socket to take the jamsync cable (midi in) from the Jamman.
The astute among you will notice that there are two foot pedal switches and a 1/4 inch TRS jack in there as well. The Beat Buddy can use an external two button foot switch for various functions (programmable within the Beat Buddy). Since they wanted $50 for a box with two switches and a socket and since I am nothing if not cheap (ask my wife!) I decided I’d make my own. But rather than build a separate box just to house two switches and since yet another box (in addition to the HackMan) would take up more space than I have on my existing pedal board, I decided I could incorporate the switches and socket in the HackMan and save myself some room, especially since the HackMan itself is just a black box and would otherwise just take up room on my pedal board.
You might also notice a small hole between the switches, that’s just for an LED that tells me whether the HackMan thinks the Jamman is playing or not. I use that to know when to send a stop signal to the Beat Buddy when I press stop on the Jamman. It’s a bit of a kludge but it’s the best I can do with the signals the Jamman sends out, and it works although it’s easy to confuse it as well!
So I’ve just got to wire it all up which I will do tomorrow night and then see if I can squeeze it onto my pedal board. If not I’ll be building another pedal board! I’ll be glad when this is all done because I have a cafe/bar gig in just over a week and I want all this done before then so that I can at least have a little practice with it.
Well, one is. I found that the Jamman, for whatever reason, was on one (prerecorded) track only, sending out sysex data that said the tempo was 131 but was displaying and I guess playing it at 132 BPM.
I just adjusted the tempo up by one, save it then put it back and it was fine.
As for the Arduino tracking the ‘play’ state of the Jamman, so far I think the only real solution to that is practice.
First off, I found that when I select a track on the Jamman with a tempo of 132 (it’s a pre recorded track), the BB goes to 131 instead of 132 BPM. Guess I need to dump the sysex from the Jamman and see what data values it’s putting out.
I also modified the code so that stopping the Jamman would cause the Beat Buddy to play the drum Outro and then end. This enables me to stop them both with a single push of the stop button on the Jamman foot switch.
This is somewhat complicated because when recording to a blank track there are NO messages about the recording actually happening until you press the pedal again to stop recording and start playback at which time you get a STOP message which is rather confusing.
Anyway I figured I could just track the Jamman pedal state internally (playing or not playing) and switch state when I see the stop message. I could then use the perceived play state and stop message to send a ‘play outro’ CC message to the Beat Buddy.
This works most of the time but since the Arduino does not really know the play state of the Jamman it can get itself lost and stop the Beat Buddy when it should not.
It’s still better than a lot of double pedal tap dancing to stop them both and when it works (which is most of the time) it works really well but it still needs a bit of tweaking I think before it’s ready for prime time.
Just a little video showing the Beat Buddy tempo setting tracking the tempo set in each track of the Jamman Solo XT:
It didn’t work because I am an idiot. I’d modified my code to make it ‘more efficient’ (ha ha!) which broke it. Once I figured out what I’d done (which took hours for me to actually ‘see’) I changed it to the way it should have been in the first place and it works fine. The Beat Buddy tempo now tracks that set in the Jamman track.
I did do a video of it but it’s crap so I’ll do another one tomorrow. In the meantime, here’s a picture of my desk:
I received the latest firmware upgrade (1.79) for the Beat Buddy today so I installed it and gave my rig a try. It worked perfectly, right until it didn’t!
So here’s what I am playing with. I have two MIDI interfaces for the Arduino. One is a MIDI shield that uses the on board UART and one is a DIY thing I put together using a breakout board. For the shield interface I am using the Arduino MIDI library and for the DIY setup I am using the SoftwareSerial library. The difference is that with the SoftwareSerial library I can use different pins on the Arduino as the input and output pins which lets me see diagnostic messages I put in the code (to see what the heck is going on!) using the Serial Monitor part of the Arduino toolkit.
So first off I tried it using the MIDI shield and it worked fine right until I tried to set 130 BPM as the tempo. Then it just did not work.
So I switched to the DIY board so that I could see the values I was sending in the code. That interface worked fine all all tempos.
So next up I hooked up the MIDI shield to my iPad using an iRig MIDI interface and used a little app to ‘see’ the midi that was actually being sent.
What I found was that it was fine until I tried to go above 127 BPM, then the data that the code was sending was just plain wrong! Now the same calculation works fine in my DIY code so it has to be something in the Arduino midi library that is messing things up but aso far I’ve no idea what.
I also noticed that even though the CC message I am sending is only supposed to have three bytes in it, the library seems to be sending an extra data byte which further leads me to believe that there’s something wrong in the library.
That’s a shame because using the library makes my code very simple which means it is also much easier to modify in the future. However it’s of no use if it does not work so I may well have to stick with my roll your own code for now because at least that works!
So I had a play with the Jamman and the Beat Buddy last night and made some progress to the point where I think I have a setup will work. I say ‘will’ because I need to upgrade the OS in the Beat Buddy to the latest (but still beta) level of the firmware in order to get certain midi functions that I need (ability to set tempo from midi).
In it’s current state, the idea is use an Arduino based ‘black box’ that I have programmed to convert the sysex from the Jamman into midi signals to set the tempo in the Beat Buddy.
So this is the basic midi setup:
On the Jamman from tracks 1 to 200 I have every five tracks setup to the same tempo as the track number. So track 60 is 60 BPM, track 65 is 65 BPM etc. On tracks 201-400 (on the SD card) I have prerecorded backing tracks (for longer songs) with the tempo already set in them.
So any time I select a track on the Jamman (using the up/down buttons on the three button switch that is plugged into it), the jamman sends a sysex midi message to the the Arduino that then convers that into midi CC messages to set the tempo in the Beat Buddy.
When scrolling (quickly) through the Jamman tracks, it does not send out midi messages for every track so it’s a case of getting up the track you want and then maybe stepping up a track, pause and then down to the track you want, just to ensure the Jamman has time to settle and send the midi sysex out for the new tempo.
So the way this will work is like this:
- Select the drum track you want to play on the Beat Buddy (using the foots witch to step up/down through the tracks).
- Select the tempo (or track if prerecorded) on the Jamman which will set the Beat Buddy to the same tempo.
- Press the Beat Buddy pedal to start the intro drum sequence.
- When the next bar starts, press the Jamman pedal to start the Jamman recording for a blank track or playback if a prerecorded track.
I’ve already established that they stay in sync (provided they are set to the same tempo and started on the beat) even without midi sync messages so I’m not to worried (at this stage) about timing drift although I’ll see how it works out in real life soon I guess!
At the moment I have to stop each pedal independently which is a bit of a pain (and a mess) and results in some fancy tap dancing. however I ‘think’ I’ve come up with a way to have the Jamman tell the Beat Buddy when to stop (with help from the Arduino).
At the end of recording the initial phrase to a blank track or at the end of playback the Jamman sends out a ‘stop’ message which I think I can convert into a ‘play song outro’ midi message for the Beat Buddy which should cause it to play the outro and then end.
Because the Jamman seems to send the SAME midi message at the end of recording AND playback I’ll need to keep track of what I think the Jamman is doing (playing/recording or stopped) in the Arduino but so long as they are both in the same state (I’ll have a little LED on the Arduino box to tell me what state it ‘thinks’ the Jamman is in) it should work.
I’ve contacted Digitech support about getting hold of the sysex spec and maybe even them making some changes to it but I got the usual canned “we’ve passed your message on” sort of reply so I’m not expecting much, such is the nature of large corporations (that seem to think their customers don’t matter) but they may surprise me yet.
So the reason I am attempting to hack the Jamman is so that I can hook it up to this, A beat Buddy….
In case you are not familiar with it, it is a really neat little drum machine in a guitar pedal sized case. I want to use it to replace the somewhat simple (I.E boring) drum beat from the Jamman with something more interesting, dynamic and flexible.
The Beat Buddy uses pretty much standard MIDI while, as we have already discovered, the Jamman does not.
In my case I want to use the Jamman as the master although I am not sure that is even possible yet due to the lack of any MIDI signals when you start recording on the Jamman but another function of the MIDI is to sync the two unit together so they play in time, but more importantly, that the timing does not drift relative to each other over time.
So out of interest today just set them of playing independently at the same tempo. First I started the Beat Buddy and then on a down beat I started the Jamman to record a blank loop (no sound, just the background drum beat from the Jamman). After that I left them running for maybe twenty minutes (turned the volume on my system down so as not to drive my wife nuts with THUMP, THUMP, THUMP !).
To my (pleasant) surprise there was no noticeable drift at all between the two pedals. So in the worst case I could just run them independently, start the BB first then the Jamman and stop them independently. It may even be possible to use the stop signal from the Jamman to stop the BB but other than that let them run independently.
An alternative may be to build a ‘master’ pedal to control them both to some degree, at least to set tempo on the Jamman etc and maybe track and perhaps tempo on the BB.
We shall see. Let the experimenting begin.