Arduino compatible guitar effects board

Started by Blackaddr, March 25, 2017, 08:54:06 AM

Previous topic - Next topic

audioartillery

Hey, I noticed on the second board I have that one of the jacks had no solder on half of its pins. I don't have the other board handy so can't comment on it.

No big deal, I can touch that up, but thought you'd want to know.


Blackaddr

Quote from: audioartillery on March 16, 2018, 01:25:23 AM
Hey, I noticed on the second board I have that one of the jacks had no solder on half of its pins. I don't have the other board handy so can't comment on it.
No big deal, I can touch that up, but thought you'd want to know.

Very sorry about that. Every board goes through electrical/functional testing and a visual inspection. Most assembly issues are caught during functional test, but clearly I missed some pins during visual check.

It sounds like you're pretty confident with an iron so touching those up with some solder should ensure everything is good. If for any reason you don't feel comfortable with that, I can solder it for you, with shipping entirely at my expense.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Hey, so I wanted to try out this BAMidiTest program.  Are there any instructions for that?  I saw there's an Xcode project included, but it won't compile (needs some Juce library headers).  I added the JUCE/modules path to the Xcode project and was able to compile but it hits an assert in MidiMessage::controllerEvent shortly after startup.  I don't know anything about JUCE so I'm lost at this point.

I thought maybe I  could open up the BAMidiTester.jucer file from Projucer and have it build but it complains I need to set some module path.  Is there a way to get that to work?

Blackaddr

#23
You can download the Windows version of the program here:
http://www.blackaddr.com/downloads/

To compile the project yourself, you'll need to install the JUCE SDK. If possible, use the precompiled Windows version above. It also works under Linux on WINE. I don't have a Mac so I can't advise on how to run a Windows program on Mac.

Once you get BAMidiTester loaded, in the Arudino IDE, set your Teensy port to "Serial + MIDI" when connected via USB.  Then load the BAMidiTester. The Teensy should show up as a MIDI device in the program.

If you build and load the AnalogDelayDemo on your Teensy board, you'll be able to control the effect parameters with the knobs in the BAMidiTester program. You should see the effect of changing the knobs as MIDI messages in the Arduino's IDE Serial Monitor if everything is working.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

#24
Ok, so spent a little more time on this. 

The Windows exe runs under Wine on OSX.  It's unhappy about a font so none of the text renders.  Changing the knobs didn't seem to have any effect on the serial output.

I looked a little harder at the assert on the native OSX build and the deal is MidiMessage(MidiMessage::controllerEvent() requires the channel number to be between 1 and 16.  Your test code is trying to operate on channel 0 which is invalid.  Maybe an older version of Juce allowed 0?

In any case, while I can now run the test program and see the BlackAddr input and output, knobs don't seem to have any effect.  I tried changing the part in the delay demo that shifts the midi channels from 1-16 to 0-15 but that did not seem to have an effect.

I know literally nothing about midi so not sure how to debug this.  But if we an sort it out I'm happy to provide an OSX binary if you want to have it available for download.

Edit:  got it to work!  The issue was with the example code actually.  Here's the fix:

diff --git a/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino b/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino
index 3cb413a..6f674f2 100644
--- a/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino
+++ b/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino
@@ -131,7 +131,7 @@ void loop() {
       channel = usbMIDI.getChannel(); // which MIDI channel, 1-16
       data1 = usbMIDI.getData1();     // first data byte of message, 0-127
       data2 = usbMIDI.getData2();     // second data byte of message, 0-127
-    if (type == 3) {
+    if (type == 0xb0) {
       // if type is 3, it's a CC MIDI Message
       // Note: the Arduino MIDI library encodes channels as 1-16 instead
       // of 0 to 15 as it should, so we must subtract one.


I don't really understand why 3 would ever be a CC message, CC is type 0xb0 according to the MIDI documentation I found.  Typo?  Nice to have this working though.

Blackaddr

#25
Glad you got it working! Looks like the latest version of the MIDI library in Teensyduino has redefined what getType() returns. It was originally enums, then it was integers equal to the enums, now it's back to enums matching the real bytes sent (which is good!)

I'll update my Teensyduino and then update the example.

I've also updated the BAMidiTester application. You can download it here:
http://www.blackaddr.com/downloads/BAMidiTester/

I've added a box next to the "SAVE" button where you can specify which midi channel you want. You were correct that JUCE expects MIDI channel to be 1-16 in the code. My version of JUCE seems to accept 0, but that must have changed. I've updated the code to use the channel specified in the GUI by the user.

<rant>
MIDI channels are really 0-15, because that's what's sent in a MidiMessage. It's a 4-bit value, it's impossible to send '16'. But many humans (musicians?) seem to struggle with the concept of counting from zero, so many MIDI products call the channels 1-16, and map it back to 0-15 as I do in the Teensy example code.
</rant>

I've got some avenues to investigate where I may be able to compile for MacOS via virtual machine. If that works I'll put out an Apple version. Failing that, I'll try to get the fonts working under MacOS/WINE.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Blackaddr

@audioartillery
I managed to build and test a Mac OS version by using virtual machine. I've added the application to the following location. If you don't mind, let me know if it works, correct fonts, etc.
http://www.blackaddr.com/downloads/BAMidiTester/BAMidiTester_macOS_v1.1.0.zip
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Quote from: Blackaddr on March 17, 2018, 11:17:35 PM
@audioartillery
I managed to build and test a Mac OS version by using virtual machine. I've added the application to the following location. If you don't mind, let me know if it works, correct fonts, etc.
http://www.blackaddr.com/downloads/BAMidiTester/BAMidiTester_macOS_v1.1.0.zip

It runs and talks to the delay demo.  For some reason I don't see the analogDelay print value changing from 15%.  I don't remember if it did before, but I see messaging from the effect saying values are changing and the effect is bypassed and enabled etc.  Seems fine.

I have a local hack on the test app to add a couple more knobs and remove the piano keyboard.  It might be convenient to provide the MIDI test in such a configuration -- when you're early in development on an effect a lot of controls can be handy.

Blackaddr

#28
The percentage should drop to nearly 2% or so (on a T3.6) when you bypass the effect via knob A.

I wrote the BAMidiTester as a very general purpose tool I use for a lot of MIDI projects around the house, as well as to provide something that someone else can use as a starting point to customize and add upon.

Sounds like that's exactly what you've done! Congrats, getting your head around JUCE is not the easiest thing to do, I find it a bit obtuse. Personally Qt/QML is the best language for GUI design IMHO, but JUCE is built from the ground up for audio/midi processing, and it's integration with VST can't be beat.

I've also just added to BAGuitar the ability to program your own filters for AnalogDelay and added a few pre-defined ones to give, bright, warm, and dark tones. You can see a summary in this post here.

My longer term plans for this year are to continue adding MIDI controlled effects to the library, then created a virtual pedalboard application with JUCE built solely for working with the TGA Pro.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Hey, the AnalogDelayDemo example project has a name.c file with a MIDI name defined there and instructions to change it if we want our own name to show up.  I've copied that project and modified that but it doesn't appear that file has any effect.  Is there something else I need to do to get that to work?

Blackaddr

That has to do with the Teensy midi library. I just used one of their demo examples in mine, haven't tried changing the name. I away on a business trip and can't check the Arduino IDE but I think you find the midi name demo in Teensy usb midi examples. Try changing the name in that one. If it doesn't work, if you haven't yet created an account on the PJRC forums, now is a great time. For advanced Teensy library stuff, the community there is pretty helpful.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Quote from: Blackaddr on March 24, 2018, 09:03:01 AM
That has to do with the Teensy midi library. I just used one of their demo examples in mine, haven't tried changing the name. I away on a business trip and can't check the Arduino IDE but I think you find the midi name demo in Teensy usb midi examples. Try changing the name in that one. If it doesn't work, if you haven't yet created an account on the PJRC forums, now is a great time. For advanced Teensy library stuff, the community there is pretty helpful.

It turns out changing the stuff in name.c works, but OSX caches the name so you have to do a little dance with the MIDI configuration on OSX to forget that device.  Doing that works and my name shows up.

Blackaddr

#32
audioartillery asked me about mounting the board in an enclosure.

The board purposefully comes with 1/4" jacks that have a nut on the end. This will let you mount the board securely to the enclosure using the three 1/4" jacks. No need for standoffs or other mounting. To drill the 3 holes, use an offset of 20.5mm between their centres. I recommend centre punching your enclosure first, drill a pilot hole with something like a 1/8" drill bit, then finish the hole with a 3/8" drill bit.

Here's some bad ASCII art to illustrate, where the X's are your centre marks. I suggest you sanity check the 20.5 mm offset with a ruler against your board to convince yourself the offset is correct before you start drilling. Also check your 3/8" bit against the size of the thread nut to convince yourself again you've got the right bit.
X - - - - - 20.5mm - - - - - X - - - - - 20.5mm - - - - -X

To connect MIDI jacks, rather than try to drill aligning holes I recommend using your preferred chasis mount MIDI DIN jack, then fly wire them to the MIDI connectors on the board, matching up pin-to pin with the pre-installed connectors. Note that for MIDI OUT, you only need 3 wires, connecting pins 2 (GND), 4 and 5. For MIDI IN, you only need to connect pins 4 and 5 (no GND because MIDI is optically isolated).

I'll draw up a diagram when I get a chance and add to the online manual.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Thanks.  I had measured 0.800" centers which is nearly 20.5mm.  I'll correct my design with the exact measurement.

Blackaddr

I've added a mechanical drawing to the end of the datasheet. It now shows the PCB dimensions, as well as provides a drilling guide for mounting holes for the TRS jacks. This should help anyone making enclosures.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Cool, that's helpful.  I ended up building a primitive 3d model for my use since pedal enclosures tend to be tight by nature and the vertical clearances on the board matter a lot.

Blackaddr

I've been out of stock for the past 3 months but finally the new hardware revision Model B is available.

Biggest changes based on feedback was to mount the Teensy on the same side as the connectors (not an easy task!) in order to reduce the minimum height.

Also, people wanted an easier way to prototype with some basic controls (knobs, switches, LEDs) so an expansion board with all these controls is also available that plugs directly into the TGA pro board itself, no extra soldering required.

Finally, the board can be ordered without the MIDI connectors installed if you are trying to install in a small enclosure and don't need MIDI.

The new model is available on Tindie here

Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

audioartillery

Nice! Looks a lot more enclosure friendly. Though I'm loving the giant enclosure I built for mine.

Any thoughts on making a board that eliminates the Teensy? At scale these could be cheap enough for small volume pedal production but the Teensy is expensive.

Blackaddr

#38
@audioartillery some people love tiny enclosures so they fit on an overstuffed pedal board, I get that. I used to follow that mentality until I got fed up with trying to tap-dance on the board with the tip of my shoe while changing effects. It's SOOO much easier when stomp switches are well spaced apart on big multi-effect pedals. You can confidently change effects without looking down and worrying about accidentially hitting two switches at once, etc.

I think the big thing here was to reduce the height so that the board can still be used in enclosures that are only a little over 1" in height.

As for integrating the Teensy directly, that would significantly increase my assembly costs because of the BGA and probably make it too expensive to build in low volumes. Even if you buy the micro yourself, you still need to buy the TEENSY bootloader chip to make it work with the Teensy ecosystem. I may offer a configuration in the future where there are NO connectors pre-installed. This would allow you to solder the Teensy right to the board and wire everything else to jacks. This would make custom enclosures even easier to design. The difficulty for me is I need to test the boards, which is much harder to do with no connectors.

Regarding enclosures and physical controls, to further make it easier to customize the physical controls for your project, I've added some code to the BALibrary. I'll put the details in a post below.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Blackaddr

#39
BAPhysicalControls was written for incorporating pots, rotary encoders, switches and outputs (LEDs/relays) into your Teensy project.

By having controls managed by a class object, it allows code that needs to interact with the controls do so with that single object, rather than using globals or functions with lots of paramters. Switches usually work best with momentary (rather than latching switches) because they are more flexible. A latching switch can be emulated in software from a momentary hardware switch but the reverse is not true.

The class also uses some wrappers around each type to add a little more functionality. Typical use is create an instance of the PhysicalControls, then add() controls to it by registering them to a handle. Use the handle to query the inputs or control the outputs.
// Examples
BAPhysicalControls controls(NUM_SWITCHES, NUM_POTS, NUM_ENCODERS, NUM_LEDS); // This will create the object with enough memory for all the controls you will be adding. Use zero for unused control types.

// Register the controls. For example, 2 switches, 1 pot, 1 encoder, 1 output LEDs
unsigned sw1Handle = controls.addSwitch(SW1_PIN); // SW1_PIN here is the logical pin on the Teensy
unsigned sw2Handle = controls.addSwitch(SW2_PIN);

// Pots require the pin as well as the min and max calibration values. swapDirection depends on pot orientation. E.g. make sure clockwise means increase, not decrease.
// Calibration ensures the range goes all the way from 0.0 to 1.0.
unsigned pot1Handle = controls.addPot(POT1_PIN, min, max, swapDirection); // The logical analog pin number on the Teensy. E.g. A16, A17,etc.
unsigned encoderHandle = controls.addEncoder(PIN_A, PIN_B, swapDirection); // The encoder needs two input pins.
unsigned outputLed = controls.addOutput(LED_PIN);

// Check for switch toggling (pressed and released) or held down (pressed).
// Outputs can be set with setOutput(value) or simply toggled. In this example, turn the LED on whenever the switch is pressed (held down)
if (controls.isSwitchHeld(sw1Handle)) { controls.setOutput(outputLed, 1); }
else { controls.setOutput(outputLed, 0); }

if (controls.isSwitchToggled(sw2Handle)) { // returns true if switch has been pressed and released since last check }

// Pots will return true if changed, and put the new value in the provided float.
float potValue;
if (controls.checkPotValue(pot1Handle, potValue)) { //returns true if new reading is available. potValue is passed by reference so it will be overwritten with the new value }

// Rotary encoders will provide the net change in position since the last call. E.g. -5 means 5 points counterclockwise, +3 is 3 units clockwise, etc. 0 means no change.
if ( controls.getRotaryAdjustUnit(encoderHandle) != 0) { // rotary encoder has moved }




You can find the code in the BALibrary here https://github.com/Blackaddr/BALibrary

The code was written to make it super easy to work with Expansion Control Board for the TGA Pro audio shield. It has controls for 2 switches, 3 pots and 2 LEDs. An example of controlling my Analog Delay effect with this class can be found here.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com