Python script turns any song into a swing number

dj BC sez, "Tristan Jehan from M.I.T. has created a unique and simple music hack, which my buddy Solcofn stumbled across on Paul Lamere's excellent 'Music Machinery' blog."
White Rabbit - The Swing Version by plamere

One of my favorite hacks at last weekend's Music Hack Day is Tristan's Swinger. The Swinger is a bit of python code that takes any song and makes it swing. It does this be taking each beat and time-stretching the first half of each beat while time-shrinking the second half. It has quite a magical effect.

Check out the examples from the likes of The Police, Daft Punk, Metallica, and Prince.

The Swinger (Thanks, dj BC!)


  1. At a friend’s request I ran all the Lady Gaga singles through this script. I think they came out pretty great, but I don’t know what most of them sound like without it. (I put the results on Soundcloud, same username as here.)

    1. This is the first time I’ve heard Lady Gaga and had it be somewhat tolerable. Thanks!

      1. Haha. Yeah, I’d only heard a couple of them before anyway. I’m sad that nothing I’ve tried other than pop has come out well–I fed it some Alice Cooper, Bad Religion, and Tchaikovsky, and none of it came out anywhere near as good.

  2. I’d like to hear something other than a pop song processed like this. I wonder how Handel’s “Hallelujah Chorus” would sound.

    1. In grammar it’s similar to the term ‘syllepsis’ (I think), a type of zeugma — that is, using a word once for two different meanings.

      “After stepping down from the transit union presidency, James vowed never to run for a bus or office again.”

      While only tangentially relevant, please correct me if this is wrong in any way. Always glad to learn!

  3. Being a huge fan of swing music in general, I can only say that this thing is incredible.

    I know how I’m going to be wasting time for the next several weeks…

  4. So has anyone tried feeding a swing number into this? I want to hear Glen Miller “double-swung”.

    1. or… feed a reversed swing tune into the processor, play/record it, re-reverse it and hear Glen Miller unswung?

  5. I love it! It’s like tilt-shift or HDR photography for music — sure fire ways to anger persnickety sourpusses and delight happy mutants!

  6. As someone who considers Brian Setzer to be a god-like being, and the whole “modern swing” sound to be the greatest form of music ever created, I am loving this tool. I can foresee losing hours and hours of my life “improving” songs with this.

  7. I don’t think that this is actually a ‘unique’ music manipulation.. there are a lot of commercial tools available to beat-map and adjust the swing of existing drumbeats, and I’m sure they could be applied to a full song as well.. that said, this tool/toy is really cool and shows just how malleable music can be, and the power of different levels of swing.

    1. You’re right. Plenty of DAWS have had this ability for years, but this is (somewhat) crisper, due to improvements in time-stretching algorithms.

      Really it’s just a re-quantization from one time signature to another, though the initial step of detecting the beats is taken care of. Pretty interesting.

      As to the lack of dynamics in modern music, I couldn’t agree more. Practically all music nowadays is optimized for MP3, not just radio.

  8. The ‘swung’ versions of ‘Money For Nothing’ and ‘Cream’ are absolute -=genius=-.

  9. Until the very end when the last “Miiiiiiinnnne” dwindles out into a free-time hanging note by which point the script should have been disabled… until that point, Sweet Child O’ Mine works better than I would ever have believed. I may never listen to the straight-time version again!

  10. OK I may just have to do this to my entire mp3 collection now.

    Enter Sandman becomes even more badass. And Poker Face becomes not only listenable but actually almost danceable.

    Definitely want to apply it to some Glenn Miller and see what happens.

  11. wow, don’t all those MP3s look maxed out on volume across their entire breadth? Dynamics are so 20th century.

    1. I had the exact same thought. Seeing a visualization of the Loudness War like this is stunning.

  12. VERY nice hack!

    BTW, it isn’t necessarily just the MP3 that’s “maxed out on volume”. Compressors are a pretty standard audio processing stage for rock and other kinds of music where subtle dynamics aren’t exactly what the listener expected. Sometimes it’s just “part of the sound”.

    Moreover, radio stations often include a compressor in their own signal chain, because compression helps the music “punch through” in noisy environments like cars, and because that helps level out the fact that one recording may be much louder than the next track up from a different album. For that same reason many MP3 players/converters also offer at least some degree of compression… though the good ones will let you turn that off.

  13. Well….technically successful, and thus of interest: but in purely aesthetic terms, less so.

    That “swing version” of White Rabbit is not what I thought 21st C music would sound like.

    Now this is what I thought 21st C music would sound like:

    And hey! What do ya know, so it does.

    But the “Swingifier” is a nice hack, nonetheless.
    After all: if it ain’t got that swing, it don’t mean a thing, eh?

  14. There’s a great potential product here. Sick of the music they constantly play at you in public spaces like supermarkets – grating modern music with a bland, incessant beat? Don a pair of headphones, hear it in the rhythm you love!

  15. I gave it “Stranger than Fiction” and it was pretty ok, if odd. “Rudie Can’t Fail” was difficult to listen to. It shortened the swung bits to where there were 4 syllables in 1/4 a second. “Raining Blood” was awful, but also gave me some great ideas on how it could be turned into a swing song.

  16. Way, way back in the early Reagan administration — or maybe the late Carter administration (lawn: you know what to do), I was seized by some inspiration with a radio a turntable and a dual cassette deck, and stayed up late mixing random stuff from the radio, when I hit upon that I could play a tape on one side (or play the turntable or radio) and record it on the other and use the pause button to edit out things. I found interesting results hitting the pause button with the beat of the music, effectively doubling the speed of the music and creating odd effects with the truncated vocals. Or cut between sources creating odd juxtapositions.

    This made me think of that.

    Still have that somewhere. It’s more impressive to me than it would be for anyone else. But when I discovered mashups in this century, there was already a place in my brain for them and they slotted right in. And things like this slide right alongside.

  17. If you think Sweet Child o’ Mine is awesome, check out Richard Cheese on the ITMS…

  18. This is exactly how people used to do it back in my tracking days: they would change the tempo of the song on every other line (the song files were a little like player piano rolls) to make the notes alternate between longer and shorter for a swing effect. Cool that someone has done it with audio files now.

    1. You’ll need Python, pynum, and the latest beta of echonest (which you can get from their svn–follow the source link at the bottom of the linked post, and go from there to the homepage); comes with it in the examples directory. And music, of course.

      I just added Mamma Mia to the collection on my soundcloud ( now that I see I can put a URL in a comment here safely). I continue to experiment with tracks, but very few of them come out so nicely, at least with the default settings.

  19. Now THIS is a wonderful thing!

    As someone who enjoys swing-dancing, I’m sitting here at my desk with a huge smile on my face as I listen through these remixed songs, resisting the urge to get up and do Charleston kicks (which is easy since my headphones’ wire isn’t that long). My office-mates are probably wondering why I’m hitting my keyboard keys rhythmically :D

Comments are closed.