Automatically place Markers on music beats

Gary James wrote on 3/8/2014, 11:42 PM
We had a discussion a few days ago about Vegas projects that produce rapid fire slide-shows timed to the beat of an accompanying audio track. http://www.sonycreativesoftware.com/forums/ShowMessage.asp?MessageID=886136&Replies=21[See here][/link]

This got me thinking about the Scope of the task of Automatically Generating markers at music beat locations. And that lead me to challenge myself to see if I could do it ..... WELL I DID!

I recently created a utility program called Playlist Tools for doing wonderful things with Audio Playlist files; so this seemed like a good place to host the beat detection functionality. I took my Playlist Tools program and added two new menu items. The first menu selection lets the user configure the analyzer settings for Bandwidth, Center Frequency, and Release Time; the second starts the beat detection analyzer on the selected file in the Playlist, to export all the beat locations to a text file as values in seconds.

Lastly I created a script DLL that imports and creates Markers from the locations written in the text file created by Playlist Tools. The Playlist Tools utility and Vegas DLL have been added to the Playlist Tools Setup program that can be downloaded from https://dl.dropboxusercontent.com/u/63993628/SonyVegas/SetupPlaylistTools104.exe?dl=1[here][/link]. Run the Setup program and it installs Playlist Tools and places the ImportMarkers script DLL in the ...\Documents\Vegas Script Menu folder. The script appears under the Vegas Tools / Scripting menu.

Keep in mind that this setup does not yet contain an update to the Playlist Tools Help file to include the Beat Detection capability. As such you'll have to fly the analyzers Beat detection settings by the seat of your pants. However, the default settings work very well for a variety of audio files that have distinctive sounding beats over the music. As the beats become more subtle, you'll have to tweak the configuration settings to find what works.

Finally, for full disclosure I've built this functionality using the BASS Audio Library which can be used for free in non-commercial products - which pretty much describes all the software I've written lately.

Enjoy ...

Comments

Rainer wrote on 3/9/2014, 12:31 AM
YOU DID! Thank you. Downloaded it, hardly wait to try it out.
Grazie wrote on 3/9/2014, 1:01 AM
Is this a realtime alternative to tapping the M key? This sounds great. I've experimented with several options one about 6 years back which was, neah, not so much. But this sounds well thought through.

Cheers

Grazie

Gary James wrote on 3/9/2014, 1:34 PM
Yes, this is totally automatic. (1) Run the Playlist Tools program. (2) Drag a file(s) into the main display. (3) Select the file in the display. (3) click on the "Export Beats of selected Playlist file ..." menu selection, then use the default name and folder location or specify a new one. (4) Wait until the process finishes. And then Import the file into Vegas.

That's all there is to it. If you see too many beats, or not enough, you'll have to experiment with the Beat Detection settings in Playlist Tools.
TeetimeNC wrote on 3/10/2014, 9:35 AM
Hey Gary, great idea for us Vegas users. Here is a possible enhancement for a future version. If your program could produce an mp3 file that was silent except with a beep at each beat it could be used with any NLE to easily line up cuts on the waveform's blips. I'm thinking specifically of Proshow Gold/Producer - It would really be a help there.

/jerry
Gary James wrote on 3/10/2014, 1:48 PM
Jerry, does Proshow Gold/Producer not have a way of importing timeline positions from a file for the purpose of marking locations on the timeline?
Grazie wrote on 3/10/2014, 2:04 PM
Gary, running it now and maybe I've been a bit too adventurous with some ZZTop-like riffs, but The Markers are coming back, er . . . . "squiffy" and in all sorts of places. Not many ON the beat. I need to understand how to weak 'em in your GUI.

I must be doing something wrong.

Grazie

Gary James wrote on 3/10/2014, 3:54 PM
I think the best way to start learning how to use the feature is to start off with an audio file that has some very distinctive beats. Download this file and run it through the analyzer with the default settings. Import the Markers and notice where they're placed. Note that in the portions of the file with the most distinctive beats, the analyzer was easily able to detect the beats. But in the portions that have little or no discernible beats, there are no markers.

Now change the Release Time from 20ms to 10ms and repeat.

Notice that in some places the analyzer detected double beats. In the following image you can see how shortening the release time caused the analyzer to become active too quickly after detecting a beat. In electronics, the release time is equivalent to a switch debounce circuit. It defines the minimum time that must expire after detecting a beat, until the next beat can be detected. Another way to look at it is like a minimum time following a beat trigger, until the analyzer is re-armed to detect another beat.

The Center Frequency and Bandwidth settings take a Frequency domain view of the audio track. If your beats are mostly lower frequency, a spectrum analyzer would show repetitive spikes at the beat frequencies. You would then set your Center Freq to the middle of the beat spike frequencies, and adjust the Bandwidth just wide or narrow enough to cover the range of frequencies timed to the beat.

One thing that I can see right off, is that I probably should add a couple more adjustment settings to run the analyzer over a selected range of the file from a starting time to an ending time. This way the other settings can be optimized for the track waveforms in specific sections of an audio file.

Grazie wrote on 3/10/2014, 4:06 PM
Gary, thanks for the extensive tutorial. And I really like your idea: [i] ....to run the analyzer over a selected range of the file from a starting time to an ending time. This way the other settings can be optimized for the track waveforms in specific sections of an audio file.[/I]

Very exciting.

Grazie

Julius_ wrote on 3/10/2014, 5:25 PM
Thank you Gary...I gave it a go and it worked really great!
Gary James wrote on 3/10/2014, 9:40 PM
I have noticed that occasionally the analyzer misses a beat. So this isn't a foolproof solution to the task. But it can dramatically reduce the time it takes to mark beats on the timeline.

So don't forget to scan through your project looking for missing beats, then add them in manually.
Gary James wrote on 3/11/2014, 1:41 PM
I've added the ability to limit beat detection processing of the audio file file to a region defined by start and end times in seconds. Simply select to process the entire file, or the specified region.

Use the same link given above to download the latest unofficial release of Playlist Tools.
PhillB wrote on 3/11/2014, 3:25 PM
Gary this is great.
Up till now I've been using Mixmeister to calc the BPM then using ultimate S to load markers and tweek from there. I'm no musician but I do know that beats can shift in music and your program seems to pick up on this although it can loose it for a few seconds which is probable down to me needing to tune the analyser.
Question is when I've finished all the tweeking of markers for a piece of music is there a way to save the marker positions using TLT so I can re import using your script next time I use that piece of music.
Gary James wrote on 3/11/2014, 4:29 PM
Phil, to export your Markers from within TLT, simply click on the Markers, Regions & FX tab. Then look at the following settings:

1. Select Markers in the Mode selection group.
2. You will see all your timeline Markers in the listbox.
3. Choose to export Frame Numbers or Time in Seconds for each Marker. And press the Select All button to select all the Markers for export. (for this use Timecode)
4. Check this if you want to include the label that's associated with the marker. ( for this leave unchecked)
5. Click the Export Selected Markers & Regions button. From the File Save dialog choose a name and folder where you want the Markers to be saved.


Steve Mann wrote on 3/11/2014, 5:55 PM
I am definitely going to try this - thanks.
There is a tool that does this now, but it ain't cheap: BCC7.
Gary James wrote on 3/11/2014, 9:42 PM
"Up till now I've been using Mixmeister to calc the BPM then using ultimate S to load markers and tweek from there."

Phil, are you able to import the Marker position text file in Ultimate-S? If so, you have all the tools needed to Detect Beats, Mark their positions in a file, Import the file, and automatically layout your Track Events to the beats.
PhillB wrote on 3/12/2014, 5:09 AM
Hi Gary,

I can save & import and export markers in ultimate s but the txt format is different from yours.
Mixeimister gives me a BPM number for me to place markers at x intervals etc.
My line of thinking was your program may end up being the fastest/most accurate method of creating beat marks so I'll try your earlier suggestion of how to save them.
Gary James wrote on 3/12/2014, 9:18 AM
Can you put up a link to a Markers text file created by Ultimate-S? I'd like to see what the differences are. If the format isn't that far off, I might be able to add it as an export option in Playlist Tools.

My Export Markers feature was originally added to Timeline Tools to mark timeline locations where I'll later place DVD Chapters. I use a program called DVD Lab Pro for all my DVD authoring. It can import chapter points as either frame numbers (the most accurate method) or as Timecode (less accurate time in seconds) from a text file.
TeetimeNC wrote on 3/12/2014, 9:44 AM
>Jerry, does Proshow Gold/Producer not have a way of importing timeline positions from a file for the purpose of marking locations on the timeline?

Unfortunately, no.

/jerry
PhillB wrote on 3/12/2014, 10:58 AM
Gary,
Not sure how to link on the forum so emailed you a copy direct.
Gary James wrote on 3/12/2014, 11:29 AM
Still haven't got the email. For future reference you may want to sign up for a free Dropbox account. Dropbox is a free service (basic account) that lets you create a shared virtual folder on the Internet. After creating an account and installing the software, you see a new folder appear in Windows Explorer. This is the local Dropbox folder. Anything you place there will be automatically synced with an associated folder on the Dropbox server. From there you can get a link to your files to share with other people. This is what I do when I want to display a screenshot or other image on the Sony Vegas forum. I drag the image to my Dropbox folder; then I get a public link, and paste it into my forum reply with the appropriate HTML markup described in one of the sticky posts at the top of this forum.
PhillB wrote on 3/12/2014, 3:03 PM

Gary, ok lets try again. This should be the file.

https://dl.dropboxusercontent.com/u/8579129/Markers%20-%20Forever%20Young
Grazie wrote on 3/12/2014, 3:39 PM
Gary! Totally ST*UNNING! I'm stunned . . . Thank you Gary!

501 Markers:



And zoomed in:



Did I say I was stunned . . . ???

Grazie

Erni wrote on 3/12/2014, 4:35 PM
Gary, I download and installed your interesting program. But the extension import markers apears in Vegas 10 but not in Vegas 12 64, in the same machine. Do you know why? Many thanks in advance.

Erni
Gary James wrote on 3/12/2014, 5:25 PM
Phil. Ok, I see what they're doing. They're writing a true Timecode value followed by, most likely, the Marker label. Let me think about this for a bit. Outside of Vegas it's difficult to write a Vegas Timecode formatted as HH:MM:SS.Frames (Time & Frames), which is what your Timeline Time Format is probably set to.

You might give this a try. Change your Time Format to Seconds. Then try to import the Beat Time file using Ultimate-S. You can then change back to whatever it was previously set to. I'm guessing that U-S reads and writes its Timecode files using whatever the current Timeline Time Format is set to.

PS. your Dropbox link worked great, but it was configured to open up the file in a web browser. To create a Dropbox link to a file that the user can download when they click on it, simply add ?dl=1 to the end of the link.