diff --git a/content/blog/2023/10-27-big-builder/index.md b/content/blog/2023/10-27-big-builder/index.md index 21d6709..d0b5aa3 100644 --- a/content/blog/2023/10-27-big-builder/index.md +++ b/content/blog/2023/10-27-big-builder/index.md @@ -3,6 +3,7 @@ title: Big Builder date: 2023-10-27 tags: - computers + - ci/cd --- I finally set up CI/CD with Forgejo/Gitea. diff --git a/content/blog/2023/12-27-rock-band.md b/content/blog/2023/12-27-rock-band.md index dff5c74..622ed11 100644 --- a/content/blog/2023/12-27-rock-band.md +++ b/content/blog/2023/12-27-rock-band.md @@ -1,7 +1,8 @@ --- title: Rock Band / Clone Hero instruments date: 2023-13-27 -draft: true +tags: + - rockband --- My project this winter break is to get our Wii copy of LEGO Rock Band some controllers again. We sold the original ones years ago because they were gigantic, so any replacements need to be small and easily stored. diff --git a/content/blog/2024/01-03-wii-drum-controller/index.md b/content/blog/2024/01-03-wii-drum-controller/index.md new file mode 100644 index 0000000..552acb6 --- /dev/null +++ b/content/blog/2024/01-03-wii-drum-controller/index.md @@ -0,0 +1,79 @@ +--- +title: Wii drum controller +date: 2024-01-03 +tags: + - rockband +--- + +The Rock Band controllers (guitars and drum kit) +are working very well on LEGO Rock Band and Clone Hero. +But I'm a completionist, +so I'm not resting yet: +the cymbals don't work on Rock Band 3! + +Here's what I've found out so far about the Wii Rock Band drum kit. +This is +based on +the Clone Hero wiki, +[a forums post](https://discourse.zynthian.org/t/rockband-drums-joystick-as-a-drum-controller/2475/3), +and the +[rbdrum2midi](https://github.com/rbdrum2midi/rbdrum2midi/blob/master/src/rbkit.c) +software. +That last one was an exciting find: +someone coded up how to read the controller. +I may be able to use this program to test my controller code, +instead of having to keep restarting games on the Wii! + + +Rock Band 1 Drums +----------------- + +VID: 0x1bad +PID: 0x0005 + +This works very similarly to the guitar code. +The pads work the same as the non-solo buttons, +kick drum is the orange pad. +d-pad is sent as axis 2. +That's it! + +I have these working as I write this, +2024-01-03. + + +Rock Band 2/3 Drums +------------------- + +VID: 0x1bad +PID: 0x3110? + +These are velocity-sensitive, +but Amazon reviews claim they work with Rock Band 1. +So either RB1 will recognize PID 0x3110 as a drum controller, +the drums show up with two PIDs somehow, +or I have bad information. + +rbdrum2midi makes it look like +both PIDs use the same interface. +I think it may be likely that 0x0005 sends velocity information! + +It does specify bit 3 of byte 1 in the HID report +is the cymbal flag, +which lines up with what Clone Hero says (button 10), +and is what I'm sending. +The two kick drum bits rbdrum2midi reads +also align with what I'm sending. +But rbdrum2midi isn't going to read any of my pad hits, +because it's looking for velocity values. + +Maybe RB3 needs velocity >0 for cymbal hits. + +I'll try sending 0x7f +in the reserved bytes for pads. +These bytes seem to be ordered differently than the bits. +rbdrum2midi lists the order as: + +* byte 11: yellow +* byte 12: red +* byte 13: green +* byte 14: blue diff --git a/content/blog/2024/01-05-big-builder-arduino/index.md b/content/blog/2024/01-05-big-builder-arduino/index.md new file mode 100644 index 0000000..b50f00b --- /dev/null +++ b/content/blog/2024/01-05-big-builder-arduino/index.md @@ -0,0 +1,97 @@ +--- +title: "Arduino, Big Builder, and Make" +date: 2024-01-05 +tags: + - computers + - ci/cd +--- + +Last night, +I got Big Builder building Arduino sketches. + +Big Builder is my Continuous Integration / Continuious Development (ci/cd) +solution for forgejo/gitea. +It's nothing revolutionary, +it's just a container with a bunch of pre-installed software, +and the gitea `act_runner` with a configuration to *not* try and use docker. +This means my builds are pretty quick, +and my network use is very low, +since I already have the tools I need to build stuff, +and don't have to download mulitple OS images every time I do a build. + +## Automating embedded systems builds + +Arduino, it turns out, +has been including command-line build tools for a long time now. +Since I'm using Debian's Arduino package, +I get the older, poorly-documented `arduino-builder`. +But the newer `arduino-cli` has better documentation, +that helped me understand how to use the older command. + +Using `arduino-builder` lets me keep the source code structured +in a way that makes sense to amateur developers: +they can just load it up in the IDE and not worry about my automation. +But it also lets me automate builds on my forgejo server, +and use the command-line to build everything, +the way I've been doing since the 80s. + +Here's what I wound up with, +to build a Leonardo image: + +```sh +mkdir -p build/cache +arduino-builder \ + -build-path $(pwd)/build/ \ + -build-cache $(pwd)/build/cache/ \ + -fqbn arduino:avr:leonardo \ + -hardware /usr/share/arduino/hardware/ \ + -tools /usr/share/arduino/tools/ \ + -compile MockBand.ino +``` + +This results in `build/MockBand.ino.hex`, +which can then be given to `avrdude` to flash my board. +Easy! + +---- + +For the mockband project, +I also needed to specify a custom USB VID/PID and a CPP definition. +After reading a lot of forums posts and code, +I discovered I could easily do this with `arduino-builder`, +with the `-prefs=` flag. +This allows you to override settings in `boards.txt`, +which is apparently what Arduino uses to build a gcc flags list. + +Here's a trimmed-down version of what I implemented: + +```sh +mkdir -p build/cache +arduino-builder \ + -build-path $(pwd)/build/ \ + -build-cache $(pwd)/build/cache/ \ + -fqbn arduino:avr:leonardo \ + -hardware /usr/share/arduino/hardware/ \ + -tools /usr/share/arduino/tools/ \ + -prefs="build.extra_flags=-DUSB_VID=0x1bad -DUSB_PID=0x0004 -DCDC_DISABLED" \ + -compile MockBand.ino +``` + +--- + +My final step was to write a `Makefile` to do all this. +Since the build step is just one (long) command, +and the `-prefs` could easily use per-target variables, +`make` was an obvious tool. +Adding a target to run `avrdude` was simple enough, too. + +I no longer need the Arduino IDE at all, +but the project still works with it! + +The result was a +[Makefile](https://git.woozle.org/neale/mockband/src/commit/63bd0672500631b8c47f24f041693e642ab32533/Makefile) +which can compile, flash, and package +all three variants of the build. +It's 43 lines long, +including blank lines. + diff --git a/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/index.md b/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/index.md new file mode 100644 index 0000000..c84b15e --- /dev/null +++ b/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/index.md @@ -0,0 +1,75 @@ +--- +title: The State of Homebuilt Rock Band Drums +date: 2024-01-15 +tags: + - rockband +--- + +There are currently at least four efforts to get a working Rock Band drum kit: + +## Mad Catz Rock Band 3 MIDI PRO-Adapter (mature) + +Based on the vendor ID sent by the USB devices, +I think Mad Catz is the company that made most of the +officially licensed Rock Band instruments. +They're still selling something that takes MIDI input, +and outputs signals to look like a Rock Band 2 drum kit. + +The converter plus a decent entry-level kit will cost about $500, +and probably provides a very nice feel. +You can also use the drums by themselves or as a MIDI controller. + + +## Mockband Drums (stable) + +![mockband drums and guitars](mockband.jpg) + +Using a $33 drum toy from Amazon ($25 on sale), +you can build a tabletop drum kit. +I've been playing on it for the last month +and the experience is comparable to the Rock Band 1 kit I had 10 years ago. +It's okay, but not fantastic. + +This requires some soldering, +but all the development is done. +If you're crafty, +you can probably have this working in an afternoon. + +https://git.woozle.org/neale/mockband + + +## Polybar Drum Kit (in development) + +Some of the polybar people are working on a from-scratch 3d printed drum kit. +So far it seems they're trying to use piezos to read drum hits, +which could mean it will send some kind of velocity information. +Although probably not super accurate, +and I haven't yet seen a game that uses it, +this would be closer to the official Rock Band drum kit. +When it's closer to finished, +it will probably use the santroller firmware +(see below). + +I'm trying to help these developers +with what I've learned from Mockband. +When it's finished, +you can expect a nice detailed instruction manual +and lots of community support, +just like the polybar. +There may even be kits you can buy from etsy. + +As far as I know, +all development on this project is happening on Discord, +so there's no URL to add here. + + +## Santroller (stable?) + +Sanjay9000, +the person who was made a very nice packaged version of a Rock Band guitar controller firmware, +has released a new firmware that claims to support drums as well. +This is made to replace the firmware in an official Rock Band drum kit, +but will probably be what the Polybar effort uses, +because so much effort has been put into making the firmware easy to set up. + +https://santroller.tangentmc.net/ diff --git a/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/mockband.jpg b/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/mockband.jpg new file mode 100644 index 0000000..5492d5f Binary files /dev/null and b/content/blog/2024/01-15-state-of-homebuilt-rock-band-drums/mockband.jpg differ