Is this the ultimate DIY hardware VU meter? - Page 4
Page 4 of 4 FirstFirst 1234
Results 31 to 39 of 39
  1. #31
    Tech Mentor
    Join Date
    Feb 2011
    Location
    Southern Ontario, Canada
    Posts
    244

    Default

    Heh, beat me to it

    keep in mind that the more stuff you are doing (writing to lcd's, turning leds on and off, etc) the less time you have to process midi... and beyond anything else, midi latency is a no-no... One solution (which is what I will likely use on my controller) is to use two arduino's, one for midi input (leds/lcd) and one for midi output... Getting two arduinos talking to each other is pretty trivial...

    Other option would be to move up to a faster microprocessor, but that is beyond my skill set at the moment

  2. #32
    Tech Wizard Siytek's Avatar
    Join Date
    Apr 2011
    Location
    UK
    Posts
    36

    Default

    Just got my Arduino code working ... Twin VU meter that can be assigned to any MIDI CC number(s). Works exactly the same as MiL0's LCD, just for Arduino

    To use this code with Arduino you will need this MIDI library installed...

    http://timothytwillman.com/itp_blog/?page_id=240

    This code assumes you have working MIDI I/O hardware on your Arduino and a working LCD display. Don't forget to change the LCD pin numbers to the pins you are using! My pin config is different to the Arduino examples as I have a custom Arduino board. For more info on LCD, see this Arduino page ... http://arduino.cc/en/Tutorial/LiquidCrystal


    PHP Code:
    #include "WProgram.h"
    #include "Midi.h"
    #include <LiquidCrystal.h>


    ////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////
    LiquidCrystal lcd(2,3,4,5,6,7); //CHANGE TO PINS YOU USE
    // HELLO WORLD EXAMPLE: (12, 11, 5, 4, 3, 2) ///////////
    ////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////

    /////////////////////////////////////////////////////
    /////////////////////////////////////////////////////
    ///// EDIT THESE SETTINGS FOR YOUR REQUIREMENTS /////
    /////////////////////////////////////////////////////
    byte VU_CC_A 3//CC NUMBER FOR VU METER A
    byte VU_CC_B 4//CC NUMBER FOR VU METER B
    byte LCD_CHARS_PER_LINE 8//NUMBER OF CHARACTERS PER LINE ON YOUR LCD TO BE USED BY VU (LEFT TO RIGHT)
    byte VU_A_LINE 0//LINE NUMBER FOR VU A TO APPEAR ON
    byte VU_B_LINE 1//LINE NUMBER FOR VU B TO APPEAR ON
    byte MIDI_CHANNEL 0//MIDI CHANNEL NUMBER TO BE USED, 0 = ANY CHANNEL
    byte LED_PIN 13//13 IS ARDUINO STANDARD LED PIN NUMBER
    /////////////////////////////////////////////////////
    /////////////////////////////////////////////////////
    /////////////////////////////////////////////////////
    /////////////////////////////////////////////////////

    byte VU_VAL_A 0;
    byte VU_VAL_B 0;
    byte VUM5[8] = { 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F };
    byte VUM4[8] = { 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E };
    byte VUM3[8] = { 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C };
    byte VUM2[8] = { 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18 };
    byte VUM1[8] = { 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10 };
    byte VUM0[8] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
    byte b;
    byte c;

    class 
    MyMidi : public Midi {
      public:
      

      
    MyMidi(HardwareSerial &s) : Midi(s) {}
      
      
    void handleControlChange(unsigned int channelunsigned int ccnumberunsigned int ccvalue)
      {


           if (
    ccnumber == VU_CC_A){

            
    VU_VAL_A ccvalue;
             
            }
             
             
           if (
    ccnumber == VU_CC_B){

            
    VU_VAL_B ccvalue;
             
            }
             
           }


    };

    MyMidi midi(Serial);


    void setup(){
      
      
    pinMode(LED_PINOUTPUT);
      
    digitalWrite(LED_PINLOW);
      
    lcd.createChar(0VUM0);
      
    lcd.createChar(1VUM1);
      
    lcd.createChar(2VUM2);
      
    lcd.createChar(3VUM3);
      
    lcd.createChar(4VUM4);
      
    lcd.createChar(5VUM5);
      
    lcd.begin(82);
      
    midi.begin(MIDI_CHANNEL);
      
    lcd.clear();
      
    digitalWrite(LED_PINHIGH);
      
    }


    void loop(){
      
    midi.poll();
    VU_A();
    VU_B();
      
    }

    void VU_A(){
      
            
    = (LCD_CHARS_PER_LINE VU_VAL_A) / 127;
            
    = (((LCD_CHARS_PER_LINE 5) * VU_VAL_A) / 127) - (b);
            
            for(
    int x 08x++){

             if (
    b){ lcd.setCursor(x,VU_A_LINE); lcd.write(5); }
             if (
    b){ lcd.setCursor(x,VU_A_LINE); lcd.write(0); }
            }
            
            
            
    lcd.setCursor(b,VU_A_LINE);
            
    lcd.write(c);
      
    }

    void VU_B(){
      
             
    = (LCD_CHARS_PER_LINE VU_VAL_B) / 127;
            
    = (((LCD_CHARS_PER_LINE 5) * VU_VAL_B) / 127) - (b);
            
            for(
    int x 08x++){

             if (
    b){ lcd.setCursor(x,VU_B_LINE); lcd.write(5); }
             if (
    b){ lcd.setCursor(x,VU_B_LINE); lcd.write(0); }
            }
            
            
            
    lcd.setCursor(b,VU_B_LINE);
            
    lcd.write(c);
      

    Last edited by Siytek; 05-10-2011 at 07:09 AM.
    ...dreams in binary

  3. #33
    Tech Mentor escapemcp's Avatar
    Join Date
    Sep 2009
    Location
    Bristol, England
    Posts
    147

    Default Usage for S4-like loop size monitors?

    Could you use these for creating an S4-like loop size monitor?

    Using the output from the "loop size" midi out command, and limiting the midi-range to 10 (so that it outputs from 0-10 CC values), would there be any way of translating these 11 states to reflect the loop size e.g.

    MIDI CC OUT | TEXT DISPLAYED ON LCD
    0 | 1/32
    1 | 1/16
    2 | 1/8
    ...
    9 | 16
    10 | 32

    Have been looking for a way to do this for ages, but without success... would this be possible, or can it only display the "raw" cc data output?

    Many thanks & great work achieved (so far)!

    escapemcp.
    Last edited by escapemcp; 11-04-2011 at 04:35 PM.

  4. #34
    Tech Wizard zzzuperfly's Avatar
    Join Date
    Aug 2010
    Location
    stockholm, sweden
    Posts
    23

    Default

    absolutely - arduino is a computer the size of a matchbook - anything one can do with a really old computer can be done with it (about the power of an 286).



    Quote Originally Posted by escapemcp View Post
    Could you use these for creating an S4-like loop size monitor?

    Using the output from the "loop size" midi out command, and limiting the midi-range to 10 (so that it outputs from 0-10 CC values), would there be any way of translating these 11 states to reflect the loop size e.g.

    MIDI CC OUT | TEXT DISPLAYED ON LCD
    0 | 1/32
    1 | 1/16
    2 | 1/8
    ...
    9 | 16
    10 | 32

    Have been looking for a way to do this for ages, but without success... would this be possible, or can it only display the "raw" cc data output?

    Many thanks & great work achieved (so far)!

    escapemcp.

  5. #35
    Tech Guru zestoi's Avatar
    Join Date
    Mar 2011
    Location
    UK, Ukraine, Romania
    Posts
    2,836

    Default

    wow - necro thread probably better to pick up a rasberry pi now for something like this - almost full pc power in the size of a matchbox
    11mba / 13mbp / tsp2 / live9 / audio10 / 2x reloop rp7000gold / 2x xdj1000 / 2x d2
    maschine mk2 / x1 mk2 / z1 / f1 / midifighter / lpd8 / 2x launchpad / launchkontrol xl
    Quote Originally Posted by derschaich
    "wohoo, i'm touched, turn on the FX"

  6. #36
    Tech Guru MiL0's Avatar
    Join Date
    May 2009
    Location
    Brighton / Bangkok
    Posts
    1,386

    Default

    yeah hopefully my RPi will arrive in June then I'm gonna start working on a cdj-style controller again (if I can get Mixxx to work )

  7. #37
    Tech Guru zestoi's Avatar
    Join Date
    Mar 2011
    Location
    UK, Ukraine, Romania
    Posts
    2,836

    Default

    it *may* be too underpowered for mixxx - tho it runs fine on netbooks. i need to check the spec of the RPi again. i entered my email address into the RS website today actually - to hopefully get one sometime. tho just remembered now that u posted some link the other month for pre-ordering or something? i was out of cash at the time. any clue the best way to try and get hold of one?

    today i wrote my first bit of code for mixxx - implemented a spinback and brake effect for the mixxx core the last couple of weeks have just been writing mappings in javascript - to hopefully get in the 1.11 release.

    if you have issues with mixxx - then there's the bug tracking system, mailing list and irc channels to let people know about them
    11mba / 13mbp / tsp2 / live9 / audio10 / 2x reloop rp7000gold / 2x xdj1000 / 2x d2
    maschine mk2 / x1 mk2 / z1 / f1 / midifighter / lpd8 / 2x launchpad / launchkontrol xl
    Quote Originally Posted by derschaich
    "wohoo, i'm touched, turn on the FX"

  8. #38
    Tech Guru MiL0's Avatar
    Join Date
    May 2009
    Location
    Brighton / Bangkok
    Posts
    1,386

    Default

    hmm if you order one now you probably won't get it until July at the earliest. I've actually paid for two so when my 2nd one turns up I'd be happy to sell it you at cost price.

    and yeah, i saw that you're contributing to the mixxx development now... nice one

    if mixxx runs too slowly on the Pi, I wonder how hard it'd be to write/modify an existing media player so that it could be used as the basis of a cdj-style midi controller...

  9. #39
    Tech Guru zestoi's Avatar
    Join Date
    Mar 2011
    Location
    UK, Ukraine, Romania
    Posts
    2,836

    Default

    Quote Originally Posted by MiL0 View Post
    hmm if you order one now you probably won't get it until July at the earliest. I've actually paid for two so when my 2nd one turns up I'd be happy to sell it you at cost price.
    that would be awesome if at all possible not sure how i managed to miss this post

    and yeah, i saw that you're contributing to the mixxx development now... nice one

    if mixxx runs too slowly on the Pi, I wonder how hard it'd be to write/modify an existing media player so that it could be used as the basis of a cdj-style midi controller...
    as a guess mixxx in it's current guise with waveforms, audio processing and library stuff may be too much for the pi - but that doesn't mean that a stripped down version wouldn't work. i think it's a safe bet that quite a few people would be interested in something like mixxx running on a pi... i could possibly then even turn my djtech cdj101's into a full standalone media player with a small lcd display i'd love the option of being able to just plug two standalone cdj type controllers into a mixer sometimes...
    11mba / 13mbp / tsp2 / live9 / audio10 / 2x reloop rp7000gold / 2x xdj1000 / 2x d2
    maschine mk2 / x1 mk2 / z1 / f1 / midifighter / lpd8 / 2x launchpad / launchkontrol xl
    Quote Originally Posted by derschaich
    "wohoo, i'm touched, turn on the FX"

Page 4 of 4 FirstFirst 1234

Posting Permissions

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