Drunkard's Walk Forums

Full Version: Turn any song into swing!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

HoagieOfDoom

This is way too freaking cool. Someone or someones created a Python script that takes any given song and stretches and shrinks the beats in such a way that it comes out as if it had been played to a swing beat. http://gizmodo.com/5547876/a-python-cod ... song-swing]Examples and links are available at Gizmodo.
That is very cool. Kinda strange, but very cool.
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.
Reminds me of a series of ISOT novels by John Birmingham that had a 2020 joint naval taskforce transported to WWII. The collected postwar music was parsed by the downtimers and the Big Bands of the day latched onto Disco.
ETA: Some of the commenters Just Don't Get It and are swinging music that already swung 0.o
''We don't just borrow words; on occasion, English has pursued other languages down alleyways to beat
them unconscious and rifle their pockets for new vocabulary.''

-- James Nicoll
Quote:ETA: Some of the commenters Just Don't Get It and are swinging music that already swung 0.o
Possibly on purpose. (How many times was Don't Fear the Reaper sent through morecowbell.dj, again?)
--
Rob Kelk
"Governments have no right to question the loyalty of those who oppose
them. Adversaries remain citizens of the same state, common subjects of
the same sovereign, servants of the same law."

- Michael Ignatieff, addressing Stanford University in 2012

HoagieOfDoom

Does anyone here know how to use the source code? I've no experience with Python and I've stared at the code for a bit to no avail.

By the way, Foxboy, are those novels any good? They sound interesting.
You don't have to, if you don't do Python. The Code has already been implemented and you can upload (Or view other's) at The Swing Thing
---

The Master said: "It is all in vain! I have never yet seen a man who can perceive his own faults and bring the charge home against himself."

>Analects: Book V, Chaper XXVI

CattyNebulart

HoagieOfDoom Wrote:Does anyone here know how to use the source code? I've no experience with Python and I've stared at the code for a bit to no avail.

The code is reasonably clear and python is meant to be easy to learn.

I find this kind of thing easier under a unix type environment, but under windows first download and install python: http://www.python.org/download/

Now this program should probably be run from the command line to make it easy, just do go to start and choose 'run...' in the box that comes up type 'cmd' and hit enter. Navigate to the location where you have saved the file (using cd, look for help on dos if nessessary) and there type 'python swinger.py [mp3filename]' where mp3 filename would be an mp3 file in the same directory. To make it easy on yourself use a name without spaces or other special characters.

the command line tool also allows you to specify several options such as swing factor and verbosity, you can also un-swing swing music if so inclined by giving a negative swing value.

as for the sourcecode;

There are two main areas of interest,
def main(): and def do_work(track, options):

def main is where the program starts it is concerned with such niceties as file reading and writing, parsing comand line arguments and all the other stuff a good comp sci student doesn't worry about.

def do_work is the interesting function it does all the work, as input it accepts the track and some configuration options and it outputs the transfromed track. the intersting stuff starts at for beat in beats[:-1]: which causes it to go over each beat in the song and figure out how much to stretch or compress that part.

After the loop it then uses that information to generate the modified audio data whih gets send back to the main function to be written out into a file.

the raw file:
http://echo-nest-remix.googlecode.com/s ... swinger.py

The file with syntax highlighting;
http://code.google.com/p/echo-nest-remi ... swinger.py

I hope this explanation was usefull and sufficiently detailed. good night.
E: "Did they... did they just endorse the combination of the JSDF and US Army by showing them as two lesbian lolicons moving in together and holding hands and talking about how 'intimate' they were?"
B: "Have you forgotten so soon? They're phasing out Don't Ask, Don't Tell."
HoagieOfDoom Wrote:Does anyone here know how to use the source code? I've no experience with Python and I've stared at the code for a bit to no avail.

By the way, Foxboy, are those novels any good? They sound interesting.
I thought they were, but I'm very undiscriminating. The author is John Birmingham and the series starts with "Weapons of Choice"
''We don't just borrow words; on occasion, English has pursued other languages down alleyways to beat
them unconscious and rifle their pockets for new vocabulary.''

-- James Nicoll
Doesn't seem to work to well with vocals. Other than that needs more instruments.
Quote:Doesn't seem to work to well with vocals. Other than that needs more instruments.
Like more cowbell brass; swing bands are usually strong on brass.  That said, I listened to the samples, but quite frankly it didn't sound all that much like swing to me.  The change in rhythm was amusing/interesting, but there's more to swing than the beat.
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.
robkelk Wrote:
Quote:ETA: Some of the commenters Just Don't Get It and are swinging music that already swung 0.o
Possibly on purpose. (How many times was Don't Fear the Reaper sent through morecowbell.dj, again?)

What you mean like: [table]http://www.morecowbell.dj/swf/player.swfMake your own at MoreCowbell.dj[/tr][/table]
Enough cowbell?
Okay, now run that through the swingerizer.
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.

CattyNebulart

Quote:Like more cowbell brass; swing bands are usually strong on brass. That said, I listened to the samples, but quite frankly it didn't sound all that much like swing to me. The change in rhythm was amusing/interesting, but there's more to swing than the beat.

Then fix it the source is available to you Wink

But seriously this is just a minor example to show how to do some things with the api, it only modifies the beats because that is what the example is meant to show (analysis and simple tempo changes), the cowbell things is built using the same api also as an example.

http://code.google.com/p/echo-nest-remi ... cowbell.py

Now the cowbell code is not as clean and easy to understand but it would be easy to modify and merge the two examples. Go ahead and make something cool Smile
E: "Did they... did they just endorse the combination of the JSDF and US Army by showing them as two lesbian lolicons moving in together and holding hands and talking about how 'intimate' they were?"
B: "Have you forgotten so soon? They're phasing out Don't Ask, Don't Tell."

HoagieOfDoom

Thanks Catty, that does help.

@Foxboy: I'll keep an eye out for the books, thanks. Although I'm itching to reread the Symphony, so it'll probably be put off for a while.
I wonder how hard it would be to write a script that adds brass to any song...
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.