GIF to the beat

  • 11 Replies
  • 6012 Views
*

Offline Joho The Hobo

  • 22
  • 0
  • Joho The Ex-Hobo
    • View Profile
GIF to the beat
« on: April 24, 2009, 23:55:14 »
Hey, all you most knowledgeable forum-goers, I have a Question.

Does anybody have any idea how I could go about making an animated GIF move to the (automatically detected) beat of a song?

I have an idea of how to detect the song's beat, by detecting any regular peaks in the bass notes, but this is only conceptually, I haven't a clue how to put it into code. Nor, in all honesty, do I have any experience in working with GIFs, so I'm going to need help pretty much from square one in this.  :/

If anyone knows of any ready-made solutions for this, or parts of it, that'd be great. The only language I've had any real experience in is Python, though I'd be willing to give any others people think would work a try.

*

Offline StaticRomantic

  • 269
  • 1
  • it's coming to get you
    • View Profile
Re: GIF to the beat
« Reply #1 on: April 25, 2009, 00:01:27 »
You could try finding the BPM (beats-per-minute) of the song, then syncing it up with the FPS of the gif.

But I'm inexperienced with gifs and thats just me thinking out loud  :oops:

To open up a song file, try using an audio program like Audacity. Most music programs have features that automatically find the BPM. I think Audacity does as well. If nothing else, at least you would have the visual sound file in front of you. I'm sure theres other things you could do in that program that would help.

*

Offline Joho The Hobo

  • 22
  • 0
  • Joho The Ex-Hobo
    • View Profile
Re: GIF to the beat
« Reply #2 on: April 25, 2009, 00:08:49 »
Thanks :) , I have Audacity, though it never actually occurred to me to use it to find BPM.  :oops:

I'd like to be able to import GIFs to the program though, not just make them one at a time. This way I could sinc any GIF to any song, like a sort of visualizer.

*

Offline googoogjoob

  • Forum Walrus
  • 823
  • 9
  • The Walrus is me.
    • View Profile
    • I have a LiveJournal. Yes. I do.
Re: GIF to the beat
« Reply #3 on: April 25, 2009, 00:50:02 »
...I really doubt it's possible to have a GIF which auto-syncs with any piece of music. The framerate dealy of the GIF would have to be altered constantly in accordance with the beat, while the GIF was being displayed. Syncing a GIF with a particular track, though, would be reasonably easy.

In my experience, Audacity's beat finder is horrifically inaccurate, unless the rhythm is especially prominent and stays the same level throughout the track. Also, it doesn't give output in BPM; it makes a label track with flags on each (perceived) beat.
good bye

*

Offline Joho The Hobo

  • 22
  • 0
  • Joho The Ex-Hobo
    • View Profile
Re: GIF to the beat
« Reply #4 on: April 25, 2009, 02:24:22 »
Hmm... I see. Well I suppose I could break the GIF into separate images for each frame, then animate that to the music, for the same visual effect?

Thanks for the advice. In case you haven't noticed, I'm pretty much out of my depth here :P2 , but it should be a good learning experience.

As I see it, to make this work I need to:
  • Import a GIF
  • Break it up into still images
  • Import a song
  • Detect BPM, and therefore frames per sec, of the song
  • Animate the stills at whatever FPS is calculated

This involves images, audio, animation... Is there any programming languages/tools that can handle all this without too much fuss? Or failing that, handle them with fuss?

*

Offline StaticRomantic

  • 269
  • 1
  • it's coming to get you
    • View Profile
Re: GIF to the beat
« Reply #5 on: April 25, 2009, 09:13:53 »
you could get a rough estimate of BPM by using a metronome and syncing it up.
I'm just brainstorming  O_o
best bet is.... google (try the first link on there. looks promising.)
« Last Edit: April 25, 2009, 09:17:39 by StaticRomantic »

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: GIF to the beat
« Reply #6 on: April 25, 2009, 10:45:05 »
Using Gif is something that is not really possible. You cannot "sync" a gif with anything else, but you can try to program the gif so it looks synched. If however either the gif or the music holds for a second, it no longer will be in sync.

You could however, probably do this with flash.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline Joho The Hobo

  • 22
  • 0
  • Joho The Ex-Hobo
    • View Profile
Re: GIF to the beat
« Reply #7 on: April 26, 2009, 18:11:54 »
Okay, thanks to all.
Hmm, well i guess GIFs wont work, but I'll not give up on the idea, it couldn't be too hard to work around the file format, converting the GIF into jpeg stills or something. I'll look around myself some more, see if I can find anything useful.

I was inspired by this, by the way: http://emmy.eviltrailmix.com/dancedancesmall.gif   :)

I've had it open in the corner of my screen whenever I'm listening to music recently, but I'd rather have a little window which I could drag it (or any other non-synched GIF) into, to display is as a beat-following animation.
« Last Edit: April 26, 2009, 18:15:42 by Joho The Hobo »

*

Offline Joho The Hobo

  • 22
  • 0
  • Joho The Ex-Hobo
    • View Profile
Re: GIF to the beat
« Reply #8 on: April 28, 2009, 01:24:11 »
I've got a thing running which breaks a GIF into separate png files for each frame now, which is a step in the right direction, :D but I've run immediately into more problems.  :moody:

Does anybody now know any way of getting a Python module written for Python version 2.4 to work in Python 2.5? Is this even possible?

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: GIF to the beat
« Reply #9 on: April 28, 2009, 22:19:40 »
If you can program your best option would be to program a visualisation to use in say... XMPlay or another famous player. Then you have all the tools for beat detection and it works on any song without modifying anything. Though that will still be very difficult.

I have no knowledge about Python so I cannot answer that question for you.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline utherdoul

  • 181
  • 0
    • View Profile
Re: GIF to the beat
« Reply #10 on: May 21, 2009, 15:26:37 »
Sorry if this is a bit necromantic, but I just happened upon this thread. What you could do is use a film-editing such as Adobe Premiere (in my opinion the bet and most accessible, though not cheap!) and you can then import images (including animated gifs - but not on a Mac) and add your music on the audio timeline.

Actually, if you've already got a program to split the animated gif into images, it'd make the whole process much easier.

Then it'd be a case of syncing it manually (which is as simple as dragging the images to the required lengths) and then export again to animated gif. You'd have to keep an eye on the export properties to make sure it doesn't mess with your framerate.

I'm not really familiar with other film-editing programs, but I know you can do exactly the same with Windows Movie Maker other than export as anything useful (I hate Windows Movie Maker) - but I'm sure there are free video editing things out there if you can't shell out for Premiere. Then again I'm not sure what the limitations are, but you could also try using the Premiere trial version...

*

Offline Evil

  • 1112
  • 1
  • 1723
    • View Profile
Re: GIF to the beat
« Reply #11 on: June 05, 2009, 02:47:21 »
^You can get the data from the sound and convert it to keyframes  :)