Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Vixconfig Library

  1. #1
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Vixconfig Library

    Vixconfig library can be found on github.com at https://github.com/Jonpro03/DIYC_Arduino

    Description:
    Reads a Vixen2 .vix file and prepares the data for playback on the Arduino.
    • Saves track length, event period, and number of channels in <filename>.dat in the root directory of the SD card in the form:
    trackLength<eventPeriod<numChannels< unused data EX: 148000<50<32<
    TrackLength, eventPeriod and numChannels are stored in ASCII and unused data is raw.
    • Saves event values in <filename>.hex in the root directory of the SD card in the form:

    1st Channel 2nd Channel 3rd Channel Nth Channel
    1st Event FF D3 A3 09
    2nd Event 00 F8 7A 53
    3rd Event FF 08 8C 9F
    Nth Event 00 49 6A 3D

    So that the first event values for all channels are read in first, followed by the next event for all channels.

    • Will check for the existence of <filename>.dat. If found, it will return having done nothing.
    • Configuration can be forced by deleting the existing <filename>.dat file before calling vixconfig().

    EX: Rudolph.vix
    Code:
    SD.remove("rudolph.dat"); //force config
    Syntax:
    vixconfig(filenameArray)

    Parameters:
    filenameArray: Name of the sequence file minus the extension placed into a 12 byte char array.

    EX: Rudolph.vix
    Code:
     char seqNum1[12] = "rudolph";
    .
    .
    .
    vixconfig(seqNum1);
    Returns:
    Nothing.

    Usage:
    1. All file names must be in 8.3 format. This is the name of my file.vix will not work, but rudolph.vix will.

    2. The Track Length must be evenly divisible by the Event Period.
    EX. if your track length is 4:30:551 (4 minutes, 30seconds and 551 milliseconds) and your Event Period is 25ms, the configuration will fail.
    If your track length was set to the length of your music in Vixen, this will likely happen. Round up sequence time to the next event period, ie 4:30:575
    3. No more than 255 channels.

    4. Files must be placed in the root of the SD card.

    5. Only files created by Vixen 2.1.4.0 are supported

    6. Be sure to include the SD library and the Base64 library (included)

    EX:
    Code:
    #include <SD.h>
    #include <Base64.h>

    Errors:
    Debug messages are printed to the serial port.

    ERROR - FILE
    The library was unable to find the .vix file you defined. Check the file name at the beginning of the code and ensure the file is in the root directory of the SD card.

    ERROR - TRACKLENGTH
    The library was unable to find the location of the track length in the .vix file you defined. Ensure you are using Vixen 2.1.4.0 for sequencing. Replace the .vix file.

    ERROR - EVENT
    The library was unable to find the location of the event period in the .vix file you defined. Try replacing the .vix file on the SD card.

    ERROR - CHANNELS
    The library was unable to find the location of the number of channels in the .vix file you defined. Try replacing the .vix file on the SD card.

    ERROR - REMAINDER
    The library detected that the track length is not evenly divisible by the event period. Round up your track length to the nearest event period.

    ERROR - VALUES
    The library was unable to find the location of the event values in the .vix file you defined. Try replacing the .vix file on the SD card.

    ERROR - ORGANIZE
    The library was unable to find the location of the event values in the .dat file. Try force-config for this track.
    Attached Files Attached Files
    Last edited by Jonpro03; 04-30-2012 at 02:35 PM.
    - Jon Proietti

  2. #2
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Re: Vixconfig Library

    To get a good idea for time, I decoded a track that's 4min 13sec long, has 32 channels, and the event period is 50ms.

    It took about 7 minutes to decode the Base64 and an additional 21 minutes to organize the data.

    Fortunately, this only needs to be done once (unless you change your sequence).
    - Jon Proietti

  3. #3

    Default Re: Vixconfig Library

    Hi Jon,

    Since it takes about 1/2 hour for an average song, any reason not to run this process on a PC, write it to a .dat file on an SD card, then move it to the arduino for playback?

  4. #4
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Re: Vixconfig Library

    There is no reason not to; completely up to you.

    Keep in mind however that this is only setting up the data for playback, once it's finished it doesn't run again. Unless of course you change the sequence and need to decode it again, at which time you can force-config.
    You do not have to wait 30 minutes for the song to play when you go to start your show. Decode the file ahead of time. Not sure if that was clear or not.
    - Jon Proietti

  5. #5
    Join Date
    Dec 2010
    Location
    Oceanside, CA
    Posts
    2,062

    Default Re: Vixconfig Library

    I tried this on my ethernet shield which contains a microSD slot. It uses CS pin 4, so I changed that and tested your code.

    My suggestions:
    • Don't hard-code the vixen files like your defines: "file1, file2, file3". Currently, it limits you to 3 files maximum.
    • Instead of the hard coded files, there are examples for SD cards that loop through all vixen files on the root of the SD card... This would be a better approach. I see a use case like this:
      • Add (or change) Vixen file on SD card
      • Plop it into arduino shield
      Currently you would have to re-compile the code on the arduino and re-upload that to recognize the new sequence file.
    • Revision control the library (github.com!)
    • Better Error Messages... Any reason you went with simple values instead of more descriptive errors? Is your flash size getting so large you can't give something like "Error - Unable to find file1: 'rudolph.vix'" rather than "ERROR - FILE"?

    Bug?:
    • I received the "ERROR - REMAINDER" message on a file I used in my show last year which shouldn't have any strange errors as you've described... I haven't double checked that the file doesn't have some strange thing which is why I have a question mark on my "bug" heading.
    The perfect is the enemy of the good. -Voltaire

    Click here to show/hide my display details ...

  6. #6
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Re: Vixconfig Library

    My suggestions:
    Don't hard-code the vixen files like your defines: "file1, file2, file3". Currently, it limits you to 3 files maximum.
    Instead of the hard coded files, there are examples for SD cards that loop through all vixen files on the root of the SD card... This would be a better approach. I see a use case like this:
    Add (or change) Vixen file on SD card
    Plop it into arduino shield
    Those suggestions are great but only deal with the sample sketch. The library is capable of checking to see if a file has been configured already, so feel free to build a sketch that does exactly that! :D

    Revision control the library (github.com!)
    As a matter of fact, I do have a github account...

    Better Error Messages... Any reason you went with simple values instead of more descriptive errors? Is your flash size getting so large you can't give something like "Error - Unable to find file1: 'rudolph.vix'" rather than "ERROR - FILE"?
    Exactly... Compiled is around 18KB so I'm trying to save space. I had even considered leaving out the serial debug and just printing to a log file on the SD card.

    EDIT: I tested that theory and was able to save 1KB of program space by removing the serial debugging info....
    Last edited by Jonpro03; 04-25-2012 at 12:03 PM.
    - Jon Proietti

  7. #7
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Re: Vixconfig Library

    Quote Originally Posted by Materdaddy View Post
    Bug?:
    • I received the "ERROR - REMAINDER" message on a file I used in my show last year which shouldn't have any strange errors as you've described... I haven't double checked that the file doesn't have some strange thing which is why I have a question mark on my "bug" heading.
    What is the length of the track and event period in vixen?
    Last edited by Jonpro03; 04-25-2012 at 12:06 PM.
    - Jon Proietti

  8. #8
    Join Date
    Dec 2011
    Location
    Pine Forge, PA
    Posts
    33

    Default Re: Vixconfig Library

    THANK YOU GUYS!! For all the hard work going into this Arduino-Vixen Project!!!
    Jon, not sure if this is where to post??

    I downloaded your code got an error that File Not Found at end of process so I commented out the references to "file2".
    Ran FINE after that! Took about 4 minutes to complete.

    Here are the files created, What do I do with the files created now?????
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by RonNagle1967; 04-29-2012 at 12:14 AM.

  9. #9
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180

    Default Re: Vixconfig Library

    Sadly, the vixconfig library is a small part of a much larger project.

    So the question is, what would you like to do with the data? What hardware do you use for lights? Do you have a shield to play audio?

    Myself, I'll be using TLC5940's. So for me it'll be something like
    Code:
    playMP3("song.mp3");
    
    for (i = 1; i <= numChannels; i++)
        Tlc.set(i, hexFile.read());
    
    Tlc.update();
    delay(eventPeriod);
    - Jon Proietti

  10. #10
    Join Date
    Dec 2011
    Location
    Pine Forge, PA
    Posts
    33

    Default Re: Vixconfig Library

    Right now my project is just beginning. I have (4) 8 Channel DC Relay Boards. They are controlled by my MEGA. The Mega is powered by an old ATX Power Supply. The lights will be powered by a DC Power source yet to be purchased. For now just using another PC Power Supply and/or my landscape light power supply. No dimming yet! Looking at this http://www.logos-electro.com/ard-srg-ips4x4-3/ for dimming. I did purchase some Transistors similar to TLC5940 but not sure how to get a board made to connect them so I can use PWM.

    I don't have a shield for MP3 yet. Any suggestions or what direction the project is heading towards for this shield??

    Can't wait for the project to come together. I will help where I can. My electronic knowledge is low but I can program. Just need to learn Arduino IDE better. The logic comes fairly easy to me once I understand the programming language. I just started in Feb 2012.

    I will try to get an Audio Shield once I get pointed in the projects direction.

    Thanks Jon!!

Bookmarks

Posting Permissions

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