Raspberry Pi Lights: how to sync Christmas lights to midi audio

**UPDATE**

Check out Todd Gile’s project which uses the Raspberry Pi to sync mp3 audio by way of real time sampling! It’s really an awesome project, and if you want to use mp3 instead of midi, you should definitely check it out. https://bitbucket.org/togiles/lightshowpi

**UPDATE**

I’m recommending the use of the SAINSMART mechanical relays instead of the solid state ones I was originally using. There have been some reports that the PI does not have enough amperage to drive the solid state relays in some cases.

This post will show you the details of my Raspberry Pi powered synchronized Christmas lights project.  I really enjoyed working on this and I wanted to share it with anyone interested in this sort of thing.

It’s fun to begin at the end, so here is a video of the Pi Lights playing to Star Wars.

Also, the Peanuts theme song:

Theory of operation:

Untitled drawing

First, a Midi file is fed into Linux’s ALSA midi sequencer service, destined to be played on a particular port.  The sequencer then broadcasts accurately timed midi events to all programs subscribed to said port.  One of those programs is Timidity, which is a free midi synthesizer that will take care of playing the sound.  The other is a simple C program that I wrote to  control the GPIO pins based on midi events.  Each GPIO pin controls a solid state relay, which ultimately toggles the main electricity  going to each bank of  lights.

Materials required:

1 Raspberry Pi and case

612WbLY1UCL._SL1500_

SainSmart 8-Channel 5V Solid State Relay Module Board  (30$ on amazon.com)

Female to male jumpers

Cooper Wiring Devices 15-Amp White Duplex Electrical Outlet

6 Electrical outlets ( < $1 US  each)

CARLON 2-Gang Plastic Old Work Electrical Box 2-Gang Almond Standard Duplex Receptacle Plastic Wall Plate 2-Gang Light Almond Blank Nylon Wall Plate

3 Electrical boxes and cover plates  (prices vary)

 50' 14 AWG Non-Metallic Wire

50 feet of Electrical cable of appropriate gauge

IDEAL 50-Count 1/2-in Plastic Insulated Staples

A bag of electrical cable staples

Plytanium 15/32 x 4 x 8 Pine Sheathing Plywood

Enough Plywood to build a ~24″/12″/24″ box

Product Details

A small amplifier (~$20 amazon):

PYLE PLMR24 3.5-Inch 200 Watt 3-Way Weather Proof Mini Box Speaker System (White)

Outdoor speakers: (~$20 amazon )

Software needed:

Debian Rapsberry Pi distro  (http://www.raspberrypi.org/downloads)

Timidity (apt-get install timidity)

Alsa devel libraries (http://www.alsa-project.org/main/index.php/Main_Page)

Gordon’s wiringPi library (https://projects.drogon.net/raspberry-pi/wiringpi/)

About Midi Files:

Midi files are comprised of a sequence of events that richly describe how to play a song.  There are many different kinds of events, but the most interesting ones for my purposes are the NOTE ON and NOTE OFF events.

NOTE ON event {

Note value: { 0..127 }

Channel { 0..15 }

}

NOTE OFF event {

Channel { 0..15 }

}

Think of the note value part of the NOTE ON event as corresponding to key on an imaginary piano that has 128 keys.

Controlling the GPIO pins based on midi events:

I decided to control the pins based on the pitch of the notes.  There are 12 notes in an octave, so the pitch is obtained by taking modulus 12 on the note value.  From there, it’s again divided among the number of pins.  Using 6 pins, pin 0 corresponds to notes with pitch 0-2, pin 1 corresponds to 2-4, etc.

Getting Started – Software:

The first thing to do is download Timidity and make sure midi playback works properly.  After installing, configure it to run as a daemon.  Then use the ‘aconnect -o’ command to verify that it is listening on a midi port.  It should display something like this:

client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0′

client 128: ‘TiMidity’ [type=user]
0 ‘TiMidity port 0 ‘

Try playing a midi file using the ‘aplaymidi’ command.  For example, ‘aplaymidi –port 128 yourMidiFile.mid’.

It’s probably the case that the default Timidity settings will be too aggressive for the Raspberry Pi to handle.  The midi playback may stutter and crackle.  To remedy this, modify the /etc/timidity/timidity.cfg file.  Uncomment these lines and restart Timidity.

opt EFresamp=d          #disable resampling
opt EFvlpf=d            #disable VLPF
opt EFreverb=d          #disable reverb
opt EFchorus=d          #disable chorus
opt EFdelay=d           #disable delay
opt anti-alias=d        #disable sample anti-aliasing
opt EWPVSETOZ           #disable all Midi Controls
opt p32a                #default to 32 voices with auto reduction
opt s32kHz              #default sample frequency to 32kHz

Once that’s all sorted out, it’s time to get started with the pin controller program.  You’ll need to download Gordon’s wiringPi library.  Download the latest software from the his repository, and follow the easy installation instructions (https://projects.drogon.net/raspberry-pi/wiringpi/).

The ALSA libraries should be installed by default on debian.  If you are using a different distro, go to http://www.alsa-project.org/main/index.php/Main_Page and get the latest development libraries.

You can then download the source code for my program here, called light organ.  http://code.google.com/p/pi-lightorgan/source/browse/trunk/lightorgan.c.  Check out the code to your pi using this command:

svn checkout http://pi-lightorgan.googlecode.com/svn/trunk/ pi-lightorgan-read-only

Compile the program by issuing the ‘make’ command.  Feel free to edit the code to suit whatever new ideas you come up with.

At this point, you should have a binary for the pin controlling program.  Run lightorgan as root.  Open another terminal and issue the command ‘aconnect -ol’ to list all of the active midi outputs.  You should see three entries: Timidity, lightorgan and the midi thru port.  The midi thru port needs to be configured to send it’s output both to lightorgan and Timidity.  Here is an exmaple of doing that:

aconnect -ol

client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0′
client 128: ‘TiMidity’ [type=user]
0 ‘TiMidity port 0 ‘
client 129: ‘LightOrgan’ [type=user]
0 ‘listen:in       ‘

aconnect  14:0 128:0

aconnect 14:0 129:0

aconnect -ol

client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0′
Connecting To: 128:0, 129:0
client 128: ‘TiMidity’ [type=user]
0 ‘TiMidity port 0 ‘
Connected From: 14:0
client 129: ‘LightOrgan’ [type=user]
0 ‘listen:in       ‘
Connected From: 14:0

At last, the ports are configured properly.  Now all midi traffic destined for port 14 (the through port) will be copied to ports 129 and 128 – Timidity and lightorgan.  You can use aplaymidi –port 14 midifile.mid to send to both Timidity and lightorgan.

If you’ve reached this point and everything is setup properly – you should be able to test the setup using a breadboard and some LEDs.  Here is an example with 4 LEDs:

In the file lightorgan.c, change MY_NUM_PINS to be the number of pins you plan on using.

Wire your pins to the LEDs using the chart at Gordon’s site: https://projects.drogon.net/raspberry-pi/wiringpi/pins/

Be sure to check out his tutorial on how to get started with GPIO on the Pi for more information.

Putting it all together:

I chose to build an enclosure using plywood to house the PI, the amplifier, outlets, relays, and connectors:

Photo: Construction has begun for my sound synchronized christmas light project. The photo shows six solid state relays and a half completed wooden enclosure. Also, a cat named dewey.

The junction box on the left is where the power comes in.  From there, individual runs of romex are run across to each relay, the ‘hot’ wire for each of these runs is separated by a solid state relay.  When voltage is run through the bottom terminals of a relay, the power is able to travel freely onto the outlet on the right side:

Photo: Oh what tangled webs we weave.

Shown above are 8 outlets (and also, my cat Dewey).  Two of the outlets are not connected to the relays, they are there to provide power for the Pi and the amp.  The connections on the left side are yet to be made.  Here is a view from another angle:

b

From here, the only thing left to do is complete the enclosure, add in the amp, add the Pi and wiring from the Pi.

a

This is the finished state of the box.  I probably should have cleaned it up a bit more, but I was too eager to see it in action. With everything being in an outdoor environment, I put a container of Damp-Rid in the box to try to mitigate the threat of condensation.

I hope this has been helpful.  If you have any questions, please comment.

-Chivalry Timbers

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

191 Responses to Raspberry Pi Lights: how to sync Christmas lights to midi audio

  1. Pingback: Pumpkin Pi | The Accidental Adept

  2. Hello there! I just recently came across your great post as I’m looking for a unique solution. Have you given any thought on a version of this system that could transmit wireless data to other control boxes such as the one you’ve made? Essentially, could I have a distribution box that plays my files and controls the lights on my house but my neighbor’s house as well?

    Thanks for the great info already!

    • Chivalry Timbers says:

      Hi Sean, thanks for the feedback!

      I think your goal of having multiple control points is very acheivable using multiple Raspberry Pis and a wireless network. Here’s what I suggest you try:

      1) Get LightOrgan running as a service on both Pi’s using the instructions in this post.
      2) On the ‘client’ or ‘listener’ pi, Use the ‘aseqnet’ command to create an ALSA sequencer connector over the network. See this page for a reference (http://ccrma.stanford.edu/planetccrma/man/man1/aseqnet.1.html) – or just use the man page. Use ‘aconnect’ to connect the network sequencer port to route to port 14 (AKA the MIDI THRU port that LightOrgan listens on)
      4) On the ‘server’ or ‘broadcaster’, use ‘aseqnet’ and ‘aplaymidi’ to play a midi file onto the network port. Use ‘aconnect’ route data from local port 14 to the aseqnet port.

      In summary, here’s a diagram

      [From Server PI, ]
      [play midi file to 14]
      ...|
      ...|---> Rendered on Server, LightOrgan
      ...|---->Rendered on Server, Timidity
      ...|
      ...|---> Network Connected Sequencer Port
      ............|
      ............|
      ............->Rendered on client (remote) LightOrgan

      • Anonymous says:

        How do I load the songs I want? I have them in midi format but I cant seem to load them? When I start My pi it auto runs some music, where is that pulling from?

  3. Thank you very much!! I’m using your code to realize simple Musical Christmas Light for my children.

    It is a great work!

  4. steven says:

    can you play the music via pin 4 fm radio instead of using speakers

    • Chivalry Timbers says:

      I imagine that it’s possible. The first step would be to change the light organ source code to never use pin number 4. I’m not really sure what to do after that though. Good luck

  5. I just built a setup using this as a guide and bought the same solid state resisters that you have listed above. I’m having a problem. No matter how I wire up the breadboard, I can’t get enough juice to flip the relay completly. I played around and I got it to barely flip, but not enough to bring the lights on completely.

    I have tried it with a 9v battery so I know the relays work.

    I have also tried with LED lights on the breadboard and that works like a charm.

    Any advice? or could you give a more detailed example of how you went from the pi pins to the relays?

    • Anonymous says:

      Followup Question – I’ve been doing some research and I think if I put a transistor utilizing the 5v power supply off the pi (breadboard setup for this), it would give it enough juice to flip the SSR.

      Anyone have any experience?

      • wynneth says:

        The problem with trying to power the relays off the pi directly is a matter of current. Without any USB devices, the 5v of the pi can only provide 200 to 300mA. Depending on which particular relays you use, each relay might use 15-80mA of current. It wouldn’t take many to draw too much. Keep in mind, if you attach anything USB to the pi then that requires current too. I have the sainsmart 8 channel ssr board and I just connected a
        Separate 5v power supply to the relay board. The pi gpio pins only have to provide a tiny signal to turn the relays on and off, but not actually power them.

      • Chivalry Timbers says:

        If you’re using the same resistors that seems a bit odd that they wouldn’t flip. I would try to run the PI without anything USB plugged in as a test. Also, check to make sure that you’re using a 1000mA power supply for the pi. The transistor and external power supply method would definitely work and you can utilize your breadboard, some transistors, and an external power source.

      • Thanks for the information. I’ll give it a try when I get back into town later this week.

      • I got a chance to try it last night. The GPIO pin by itself would not every cause the SSR to flip. I hooked up a transistor using the 5 V power on the PI and it all works find now. It is a 1000 mA Power Supply. Very strange that we are getting different results. I did some looking around on the web and it appears the lower end results on SSR depend significantly on batches and manufacturing locations.

      • Chivalry Timbers says:

        That is odd indeed Tim, I’m going to update the page to recommend Wynneth’s sainsmart relays so others don’t run into the same issue. Thanks for your feedback and goodluck.

  6. So, could I provide the 5v power or more to the breadboard from another source and use a transitor with the GPIO pin as a signal to it?

    I’ve already built the setup with SSR and have it all enclosed safely at this point, so If I can make it work simply then I’m inclinded to try.

    • I’ve had the same problem. I ordered the same sort of relays, and I’ve found that 5 of the 8 work fine with the GPIO pins, but 3 will not switch. They do fine with a 9 volt though. I’ve resorted to ordering the sainsmart board the others are using.

      I did find that using a 2000 mA power supply and putting my wifi dongle off to a powered USB hub, the GPIO voltage increases just enough to get 1 of the 3 relays to switch. So I’m down to two that don’t work.

      My idea for getting the other two to work was to wire up a quick little darlington transistor switch and plug a 9-volt into it and just have it draw current from that to actually switch the SSRs. I decided though that doing that for two channels was too complicated, and would rather get a single board with reliable specs….

  7. Kyle says:

    Hi,
    I was wondering if there is any other way to get the alsa libraries besides the one in your post.
    Thanks,
    Kyle

  8. Dennis Kelley says:

    I am using a 8 channel Relay board. 6 of the 8 relays only fire for any of the midi files I have. I know you mentioned ‘In the file lightorgan.c, change MY_NUM_PINS to be the number of pins you plan on using.’ in changed the file and it still does not fire the last two relays. is there something else I need to do to get all the relays to work?

    • Chivalry Timbers says:

      Hi Dennis, the problem with having more than 6 pins is that most songs are played in certain “key”. That key usually uses a maximum of 7 different pitches. LightOrgan uses the pitch of the note to decide which pin to fire. It doesn’t know what the key is of the song is while it’s being played. If it did, it could effectively use 7 pins. Unfortunately, it’s not that smart, so it uses a maximum of 6 pins as a result. That seventh pin is lost due to rounding errors from not knowing what the key of the song is.

      I have a solution for you though. I updated the lightorgan code (at googlecode page) and added options for dedicating pins to play the PERCUSSION, SYNTH, and BASE instruments. These instruments aren’t played by the 6 melody pins, but you can certainly use them to make an impressive light show and make use of your seventh and eighth channels.

      In your case, where you have 8 total pins, this is how I suggest you set it up:

      1. Get the latest lightorgan.c from googlecode
      2. Modify lightorgan.c to read
      #define NUM_MELODY_PINS 6
      int PERCUSSION_PIN_IDX = 7;
      int BASE_PIN_IDX = 6;
      int SYNTH_PIN_IDX = 6;

      This will give you 6 “Melody” pins (pins 0-5) that will be dynamic with respect to the pitch of the midi. The PERCUSSION track (drums) will play on pin 7. Any BASE or SYNTH instruments will play on pin 6.

      Hope this helps,

      Chivalry Timbers

      • Dennis Kelley says:

        I can see how this should work. But i am not sure how to use the extra pins. you said ‘These instruments aren’t played by the 6 melody pins, but you can certainly use them to make an impressive light show and make use of your seventh and eighth channels.’ but how do i use them? so am i just not using a midi file that has percussion? should i try another file. Thank you by the way for the change is code and for a great tutorial.

      • Chivalry Timbers says:

        Dennis, all you have to do is download the new code, make the changes I suggested, then recompile it.

        Yes, the songs that you use do matter in that they must use a percussion / base / synth for you to see an effect. But chances are high that the songs you are using already do have some of those instruments. Try it out with a few songs and get back to me.

      • I tried the new code and it works great for the bass and drums. However, it is not picking up any percussion instruments.

        Looking at my midi files, I don’t see anything that stands out to me as Percussion. I see plenty of drums and bass.

        Are percussion tracks rare?

        Should I change it to the following and give up on percussion?:
        int PERCUSSION_PIN_IDX = 7;
        int BASE_PIN_IDX = 7;
        int SYNTH_PIN_IDX = 6;

      • By the way, I’m assuming Base is Bass, please let me know if I”m wrong on that.

      • Chivalry Timbers says:

        Yep, it’s bass :) you can certainly put percussion on the same channel as bass or synth. Percussion is aka the drum track, it seems to not be used very often

  9. Dennis Kelley says:

    That is what I was doing wrong. which was one of my questions. Did i have to recompile it.
    I am new to programming and the Raspberry pi. So that info helps me.

    Thank You!
    Dennis

  10. I ran into a new issue yesterday and today. Overnight, the sound stops working. I check aconnect -ol and it shows all the ports mapped correctly, however no sounds play. The lights flash.

    I tried playing directly with Timidity and sound works.

    If I reboot, everything works fine.

    This is rather annoying because I was wanting to just leave the thing running non-stop but now I have to reboot every day for it to work.

    I’ve tried search for errors on the programs, but can’t find anything.

    Any ideas?

    • Chivalry Timbers says:

      Tim, I too have this issue, it’s really annoying!

      The problem is that timidity just seems to stop working after about 24 hours or so. After I issue “service timidity restart”, the problem seems to be resolved. I haven’t looked into it too much, anyone else experience this?

      • I’ll try that tomorrow. If it works, I’ll just add it to my initialization script to run before 1st song.

        Do you have to remap it with aconnect after restarting it?

      • Chivalry Timbers says:

        Yes, you do have to remap unfortunately

      • alseadon says:

        if you have it set to start running on boot like I do you can just hook it up to a timer and let the timer reboot for you

      • wynneth says:

        If it’s an issue of the daemon/service not working correctly a full reboot isn’t always necessary. You can setup a cron job to stop and restart the service in question at set intervals. I’ve currently got my light show running completely automated with the use of cron. Mine’s a bit different than the default setup here and the images provided: I use lightorgan, but I just use aplaymidi to route the midi output to lightorgan (no timidity) and play a matching full audio mp3 file with omxplayer out to my fm transmitter. I setup shell scripts for each song (to match the timing of starting the midi and the mp3 audio), and a shell script to loop the playlist until the date command shows it to be 11pm. In cron I have the looping script begin at 6pm, another cron job starts a second “metal music” only show for a bit after 11pm, then another job turns just the icicle lights on for the rest of the night and then off in the morning. Here’s Slayer’s South of Heaven: http://www.youtube.com/watch?v=L4mEm0hVnAU

      • I’ve got it set where Cron runs my script at set intervals. If it is in the window I have set to start, it starts, else it just exits.

        I’ll add to the execute part if it passes to restart timidity and aconnect commands before starting to play the songs.

      • Here is the script I wrote for crontab to run. It also has the option if you put a time at the end it will consider it the stoptime (1420 means 2:30 PM).

        It works well but I’m always open to suggestions.

        #!/bin/bash
        # Grab initial time
        TIME=$(date ‘+%k%M’)

        # Setup Initial Variables
        FILES=/SHARES/MIDI #Need to put in the right path
        ENDTIME=2130

        # Test for time input
        if [ "x$1" != "x" ]
        then
        ENDTIME=$1
        fi

        # Reset the services
        service timidity restart
        # Pause to give time to line out
        sleep 5
        # remap to midi player port
        aconnect 14:0 128:0

        # Loop until time exceeds endtime
        while [ $TIME -lt $ENDTIME ];do

        # Runs ls on the given dir, and dumps the output into a matrix,
        # it uses the new lines character as a field delimiter, as explained above.
        file_matrix=($(ls “${FILES}”))
        num_files=${#file_matrix[*]}
        FILE=”$FILES${DIR}/${file_matrix[$((RANDOM%num_files))]}”

        # Play the File
        aplaymidi –port 14:0 $FILE

        # Need to recalc time
        time=$(date ‘+%k%M’)

        done

  11. Wynneth, how did you get a MP3 and Midi file to be the same length and such? As I read around everyone says there is not a decent converter for an MP3 file to Midi.

    Also, does anyone have a favorite program on adjusting midi file volume? I’ve found mine change in volume so much, it either can’t be heard or the neighbors are calling.

  12. NR says:

    Does anyone have instructions for wiring up the high-voltage part of the system for someone with no high-voltage experience but a basic understanding of circuits etc?

    • Chris says:

      Hi NR
      What is your application? Where will the project be situated and in what type of enclosure? The high voltage side should be protected by a 30ma rcd somewhere in the system, the earth and neutral for each output come straight from the supply source (the plug/inlet) and go to your outputs. if you are using any metal in or outside of your enclosure then you should cross bond this to your earth. The live from your supply source should ideally go into 8 fuses ( rated at 10amps or less) then from each fuse you would go to the common terminal on each relay, I think the relay board you have is the same as I have, in which case I believe the middle contact on each relay is the common, you will then need to connect from the normally open or normally closed terminal of each relay (depending on if you would like the lights to turn off if triggered or to turn on if triggered) to each live off your outputs. I hope you can understand this and I will try to draw a circuit diagram and upload a link to it

      • NR says:

        Hi Chris,
        The project will be situated indoors. I haven’t quite found a good enclosure yet, I was thinking some sort of large plastic box. A circuit diagram would be extremely useful, thank you so much!

      • Chris says:

        If your lights are going outdoors you still need an rcd, I would recommend using one even if everything is indoors, I think a plastic abs adaptable box is the best way to house the bits, remember that the solder contacts on the bottom of the relay board are high voltage when powered up so make sure you use pcb standoffs or ensure they are mounted to something non conductive obviously, I do not have time now to make a circuit diagram but have taken a short video to hopefully help you out, mine is still an unfinished project and still needs a lot of work such as fuses inline as I state in the video, hope it helps any questions let me know http://youtu.be/byYf_-yoLMw

      • NR says:

        Thanks, that video is very informative. Are there any significant differences for “mains” power in the US (110/120 VAC) or is it the same configuration?

  13. plstearns says:

    I’m working on my box right now but I only need 4 outputs. Do I have to recompile or can I just change the lightorgan.c file?

  14. Kyle says:

    Can anyone provide me with a wiring diagram for the sain smart relay board?

  15. Pingback: Hallelujah! Raspberry Pi Lightorgan - Christmas Light Show | The Accidental Adept

  16. wynneth says:

    For everyone’s future reference, here is a (somewhat crude) diagram of wiring the Sainsmart 8 channel solid state relay board:

    http://s908.photobucket.com/user/wynn3th/media/Engineering/sainsmart8ssrdiagram.jpg.html

  17. togiles says:

    Thanks for the excellent post… became the starting point for my own project to make a Raspberry Pi light show. I moved away from just midi and went the route of taking the frequency response (via fft) of any mp3, wav, etc… thus enabling a light show created for any song.

    Thanks again for the initial inspiration and ideas to launch from!

    My code / project is available here for those interested in taking a peek, a few others have joined in and we’ve been adding other features like SMS voting for the next song to be played, Admin control via SMS, and more…:

    https://bitbucket.org/togiles/lightshowpi

    https://plus.google.com/communities/101789596301454731630

    • Chivalry Timbers says:

      Wow togiles, that’s some amazing work! I’m glad to have inspired you, but clearly your idea and work are original in it’s own right. I will be trying your system, for sure! Also, I will add a link to your project on the main blog entry.

      • Todd Giles says:

        Sure … but it awesome to be able to learn from others that have already started down a similar path. You’ll have to share your experiences with our project after you play around with it — hoping it should work directly on your existing hardware!

  18. NR says:

    One more thing, I assume the easiest way to get power into the whole thing is like cutting open an extension cord and wiring the neutral and ground wires directly to the outlets and switching the hot wires with the relays. Is this assumption correct or am I extremely misguided?

    • I put an outlet in the inside of my box. I bought cord and a plug and powered the outlet from that cord. then I ran the power to the other outlets from that outlet box. This main outlet could then be used to power the pi and the amp. I’m assuming you know how to wire up outlets.

    • wynneth says:

      I did similar to Tim. I used a small power strip and 18 gauge electrical wire to wire from one outlet on the power strip to 8 electrical sockets I mounted on the front of my box. The power strip as well as the cord are all rated 15A max, and I’m primarily using some LED lighting with some incandescent – I’ve probably got less than 4A total running on it. Something I would recommend though that I did not do (yet) would be to isolate the power to the raspberry pi and any external power source of the relays from the power going to the lights, just as a precaution. My box is in no way up to code, but it’s run from inside the home with the cords to the lights protruding outside – here’s a photo of the mess: http://i908.photobucket.com/albums/ac286/wynn3th/Engineering/81E8E1B1-5997-4C7C-BFA1-629BE98CCF1D-13898-00000397B2559AD5.jpg
      It does all connect back to a properly grounded outlet.

  19. vierwout says:

    Is it possible to do this in combination with shairport?
    I would like to play music via Airplay and still have the awesome result as you.

    • NR says:

      That doesn’t sound possible, as I believe shairport plays audio directly to the system out. It is definitely not possible with Chivalry’s pi-lightorgan program, as that uses MIDI. If you could modify togiles’ program to accept a stream of some sort from shairport, then you might have a shot. But I think neither of the programs here are built for that, it is mostly for playing from an already existing file. You could make a web interface and control your lights from your iThing that way, though.

  20. KnC says:

    Thank you for a great Raspberry Pi project for the season. LightOrgan provided just the motivation to get us to put up lights.

    We used an idea found on YouTube to play an MP3 along side Lightorgan and just turn off Timidity… We used an open source midi editor on our Mac to customize the midi files and give us more control of the lighting. It turned out pretty good and with a little more work and more lights it should be incredible next year.

    QUESTION: if we put a header on P5 and wire the other four ALT2 GPIO channels, can they be used? I think our goal is to use 12 GPIO output pins and use 1 pin per note. This should make creating sequences from midi pretty easy to create from our keyboard…

    Yes, we have tape on the keys telling us what channels each note triggers. We just listen to the MP3 and hit the key corresponding to the pin (lights) we want to trigger. We didn’t have much time this year, but now we have 12 months to perfect our midi sequences. :D

    BTW: SainSmart SSR boards work excellent. If you take a USB phone charging cord and feed the 5 volts to the relays instead of using the RPi’s 5 volts it works flawlessly. ;)

    Check out our psuedo blog of our 2013 Christmas Light Project at
    http://Pi-Lites.K-n-C.com
    We provided pictures and videos of our adventure as well.

    Thanks again, and we look forward to seeing what others have done.

  21. KNC says:

    I HAVE 2 QUESTIONS:

    1.
    if we put a header on P5 and wire the other four ALT2 GPIO channels, can they be used? I think our goal is to use 12 GPIO output pins and use 1 pin per note. This should make creating sequences from midi pretty easy to create from our keyboard.

    2.
    if lightorgan is compiled with 12 channels, what will be the sequence? Since there are 12 notes in an octave we have tried to compile and use a test midi, but are tests are inconsistent with how they play… help. Are you using wiringPi’s GPIO sequence? instead of the physical pins?

    • Chivalry Timbers says:

      Hi KNC, thanks for your interest in the project.

      I believe that it should work given the properly crafted midi and lightorgan compiled with 12 pins.

      The wiringPI’s gpio sequence is used, you should check out gordon’s wiring pi guide for the numbering he uses.

      One thing that you might want to check is if lightorgan is filtering out certain notes because it considers them to be BASS or SYNTH or PERCUSSION type instruments.

      If you want to send me the midi file, I can try to debug the lightorgan code. Just shoot me an email.

      • KnC says:

        Haven’t had time to put a header on P5 yet, but we will post what we find. We are still using the older lightorgan.c. Just downloaded the new one, and checking out the file. Looks like you have been doing some playing. We were starting are first pin on pin 7. (GPIO4?), so that explains why our midi file was tripping channels 1,2,3,4,5,6,7,0 out of sequence.

        We have an idea to use CAT5 to send the GPIO signals to the relays, and use 3 different breakers to power our display. 12 channels for 1 octave Should be easier to sequence?

        Thanks again for the awesome program. We need to get more into programming, so we understand what is going on, but for the time being your work is awesome, and we are having fun blinking lights to our music. ;)

  22. Pingback: 12 Ways To Make The Most Of Raspberry Pi | DIGIZENS

  23. Pingback: Adam Ickes | Editing with a side of Raspberry Pi

  24. Pingback: 12 Cool Projects For Your Raspberry Pi

  25. Pingback: Raspberry Pi(ラズベリー・パイ)でここまで出来る!12のクールな使い方 | ReadWrite Japan

  26. Pingback: Techy Tenor | A tenor in search of tech

  27. Pingback: 12 tutorials for taking your Raspberry Pi to the limit | TopNewsSites

  28. How do I put background music in my Youtube video?

  29. Unknown says:

    Therefore, you will need to make sure that you understand your obligations being a borrower and browse every one of the fine print that the
    bank provides Unknown cash advances should basically be useful for serious situations.

  30. Pingback: Raspberry Pi Powered Christmas Lights | Alex K Projects

  31. Pingback: Haskins Arduino Fans | Raspberry Pi Lights: how to sync Christmas lights to midi audio | The Raspberry Pi and I

  32. Michael Iverson says:

    Can do this project without using a MIDI file? If so how? Or can I run a song through a MIDI File to make it work?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s