Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62

Thread: Sequence file decoding on Arduino

  1. #1
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Sequence file decoding on Arduino

    Time to start cracking away at this piece of the puzzle. Question number one is what sequence file to use? I understand that Vixen uses base64 encoding. I found a base64 decoding library for Arduino. Is this the best route to take? Is there another file format that should be used?
    - Jon Proietti

  2. #2
    Join Date
    Dec 2008
    Location
    Ft. Mitchell, KY (Cincinnati Area)
    Posts
    3,720
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Maybe I missed something. Are you planning on using the controller to play Vixen Sequences? Like a standalone controller mode or are you just looking to have the Arduino recieve sequence data just like Renard-basd controllers do?

    Quote Originally Posted by Jonpro03 View Post
    Time to start cracking away at this piece of the puzzle. Question number one is what sequence file to use? I understand that Vixen uses base64 encoding. I found a base64 decoding library for Arduino. Is this the best route to take? Is there another file format that should be used?
    Last edited by kychristmas; 02-27-2012 at 04:20 PM.


    Heading into my 5th season in 2013

    www.ChristmasInKentucky.com

  3. #3
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Sorry, this will be a standalone player.

    Although, I suppose another approach would be to have the arduino 'record' a datastream from a player pc and replay that stream along with the audio...
    - Jon Proietti

  4. #4
    Join Date
    Dec 2008
    Location
    Ft. Mitchell, KY (Cincinnati Area)
    Posts
    3,720
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Quote Originally Posted by Jonpro03 View Post
    Sorry, this will be a standalone player.

    Although, I suppose another approach would be to have the arduino 'record' a datastream from a player pc and replay that stream along with the audio...
    Sounds cool. Looking forward to seeing it. Do you have a description somewhere of what you are building in terms of the controller? Will it play Audio as well? I believe Greg Bartlett has a similar configuraiton for his Helix stuff.

    Kelly


    Heading into my 5th season in 2013

    www.ChristmasInKentucky.com

  5. #5
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    It's a long read, but here is the thread: http://doityourselfchristmas.com/for...on-HELP-WANTED!

    In a nutshell, different shields for different configurations and supporting libraries, all stackable.
    Examples may be:

    RF broadcaster
    MP3 playback
    Ethernet/Wifi
    Renard8
    SDcard

    My interest is in seeing the Arduino run a lightshow without a PC. :D
    - Jon Proietti

  6. #6
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Ok, back to work on decoding .vix files.

    I made a simple sequence:


    Inside the .vix file you can see the base64 encoding

    Code:
    <EventValues>/////////////wAAAAAAAAAAAAD/////////////AAAAAAAAAAAAAAAcOFVxjarG4v8AAAAAAAAAAAAA/////////////wAAAAAAAAAAAACAgICAgICAgICAAAAAAAAAAAAAAP////////////8AAAAAAAAAAAAA/////////////wAAAAAAAAAAAAD/////////////AAAAAAAAAAAAAP////////////8AAAAAAAAAAAAApqampqampqampgAAAAAAAAAAAAA=</EventValues>
    After decoding base64 to hex, I get the following:

    Code:
    ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 1c 38 55 71 8d aa c6 e2 ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 80 80 80 80 80 80 80 80 80 80 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6 00 00 00 00 00 00 00 00 00 00

    So it appears to me that the vixen saves all the data for the first channel, then moves to the next:

    Channel1: ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 1c 38 55 71 8d aa c6 e2 ff
    Channel2: 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 80 80 80 80 80 80 80 80 80 80 00 00 00 00 00 00 00 00 00 00
    Channel3: ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff
    Channel4: 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6 00 00 00 00 00 00 00 00 00 00
    Last edited by Jonpro03; 04-06-2012 at 10:23 AM.
    - Jon Proietti

  7. #7
    Join Date
    May 2007
    Posts
    4,661
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Yes, it does.
    Phil

  8. #8
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Instead of trying to get the the arduino to pull only the information it needs from the vixen file, I think it might be fruitful to just copy/paste the base64 needed for the arduino to read. Then have the track length and event period defined at the beginning of the sketch.

    If this is too much work, I'll just figure out how to get the arduino to pull only the info it needs from the vixen file. It's just that the .seek() function really sucks because it will only accept an integer for the location in the file, and that location will always be different based on #of channels, track length, and event period...
    - Jon Proietti

  9. #9
    Join Date
    Dec 2011
    Location
    Illinois
    Posts
    180
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    Here's where I'm at so far with the code:

    Code:
    /*
     
     The circuit:
     * SD card attached to SPI bus as follows:
     ** MOSI - pin 11
     ** MISO - pin 12
     ** CLK - pin 13
     ** CS - pin 10
     */
    
    #include <SD.h>
    //#include <Base64.h>
    const int chipSelect = 10;
    File vixlog;
    
    void setup()
    {
      Serial.begin(9600);
      Serial.print("Initializing SD card...");
      // make sure that the default chip select pin is set to
      // output, even if you don't use it:
      pinMode(10, OUTPUT);
    
      // see if the card is present and can be initialized:
    
      if (!SD.begin(chipSelect)) {
        Serial.println("Card failed, or not present");
        // don't do anything more:
        return;
      }
      Serial.println("card initialized.");
    
      if (SD.exists("vixlog.txt"))
      {
        Serial.print("Deleting old vixlog.txt file...");
        SD.remove("vixlog.txt");
        Serial.println("finished.");
      }
    
    
      // open the file. note that only one file can be open at a time,
      // so you have to close this one before opening another.
      Serial.print("Creating new vixlog.txt file...");
      vixlog = SD.open("vixlog.txt", FILE_WRITE);
      vixlog.println("vixlog file initialized.");
      Serial.println("vixlog file initialized.");
    
    
      if (SD.exists("1.vix"))
      {
        vixlog.println("1.vix file found. Decoding...");
        Serial.println("1.vix file found. Decoding...");    
    
      }
      else
      {
        vixlog.println("ERROR - 1.vix - File not found.");
        vixlog.println("Ensure that the first vixen file you wish to play is named 1.vix");
        vixlog.println("Exiting...");
        Serial.println("ERROR - 1.vix - File not found.");
        Serial.println("Ensure that the first vixen file you wish to play is named 1.vix");
        Serial.println("Exiting...");
        vixlog.flush();
        vixlog.close();
        return;
      }
    
      vixlog.flush();
      vixlog.close();
      File vixen1 = SD.open("1.vix", FILE_READ);
      Serial.println("1.vix opened... ");
      if (vixen1) 
      {
        //note to self: Add 3
        vixen1.seek(102);
        while (vixen1.available()) 
        {
          
          Serial.write(vixen1.read());
        }
    
        Serial.println("end");
        //vixen1.seek(i);
      }
    
    
      //Conversion code goes here
    
    
      // vixlog.flush();
      //vixlog.close();
      vixen1.close();
    }
    
    void loop()
    {
    }
    - Jon Proietti

  10. #10
    Join Date
    Dec 2011
    Location
    Key West, FL
    Posts
    2,447
    Post Thanks / Like

    Default Re: Sequence file decoding on Arduino

    I believe you stated your intent was to run a Vixen sequence as a stand alone device.

    I would suggest not attempting to use the Vixen data as it is currently encoded - you have to decode a complete channel before you get to the next channel - you don't have enough ram.

    May I suggest decoding the Vixen bases 64 data on your PC and then recoded that data in a manner that can be placed in rom and read directly for each time slice each channel. That will minimize your ram requirements and speed up your processing.

    The more work you can do to the data on the PC before you place it into rom - the better it will be for the micro.

    Joe

Page 1 of 7 123 ... LastLast

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
  •