Possible to cut/edit in BMP (beats per minute)?

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Tiggerdyret

  • Posts: 10
  • Joined: Fri Apr 27, 2018 4:57 pm
  • Real Name: Ketil Jensen

Possible to cut/edit in BMP (beats per minute)?

PostFri Apr 27, 2018 5:06 pm

Hi guys,
I am just starting out with DaVinci Resolve I plan on going through some of the great tutorials on youtube in the coming days. I want use DR to make a music video and I would find it immensely helpful, if it is possible to set a certain BMP on the time bar (don't know if this is the correct terminology), 165 BMP in the case of this song, to make it easier cut in time. Is this possible in DaVinci Resolve? If not I'll probably do my editing in Reaper and the color grading in DaVinci.

Cheer
Ketil
Offline

Spencer_Meyer

  • Posts: 114
  • Joined: Fri Apr 28, 2017 9:58 pm
  • Location: Arizona

Re: Possible to cut/edit in BMP (beats per minute)?

PostFri Apr 27, 2018 10:14 pm

I'm not aware of an automatic way, but you can tap the 'M' key to the beat of the music to drop markers. To me that certainly sounds better than trying to edit a quality video in Reaper.
DaVinci Resolve Certified Trainer
Offline

Tiggerdyret

  • Posts: 10
  • Joined: Fri Apr 27, 2018 4:57 pm
  • Real Name: Ketil Jensen

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat Apr 28, 2018 8:19 am

Okay thanks, that's a good idea. I think I'll try Reaper for this video, since I know it pretty well and the video is very simple in nature. Reaper also seems better at handle different frame rates with less hassle. But I probably will need to switch to DaVinci at some point and it's good to have this tip in the bag.
Offline

Byron Dickens

  • Posts: 219
  • Joined: Sat Jan 20, 2018 7:34 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat Apr 28, 2018 1:39 pm

Just do it by ear. It will ultimately be faster and more "musical" if you will.
DR 14.3 W10 Home. Core i7 3.4 GHz. 16GB RAM. Intel HD graphics 530.
Offline
User avatar

Glenn Sakatch

  • Posts: 672
  • Joined: Sat Apr 13, 2013 5:36 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostSun Apr 29, 2018 3:54 pm

I would suggest cutting in the form of 1,2,3 cut....1,2,3,cut is not the way to go.

Use your eyes, your ears, and your own style while you are cutting.
Offline

Tiggerdyret

  • Posts: 10
  • Joined: Fri Apr 27, 2018 4:57 pm
  • Real Name: Ketil Jensen

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon Apr 30, 2018 1:34 pm

Thanks, I ended up using Reaper, but I've just finished watching a tutorial on Resolve and it definitely looks neat, so I'll be doing all my editing in that from now on. Of course I use my ears to cut with, but it was very helpful to be able to divide the track in BPM and it would be a very welcome and neat feature, which would probably also be fairly simple to implement in a future DaVinci update.

vodkadnb

Re: Possible to cut/edit in BMP (beats per minute)?

PostWed Aug 29, 2018 9:40 am

Tiggerdyret wrote:Thanks, I ended up using Reaper, but I've just finished watching a tutorial on Resolve and it definitely looks neat, so I'll be doing all my editing in that from now on. Of course I use my ears to cut with, but it was very helpful to be able to divide the track in BPM and it would be a very welcome and neat feature, which would probably also be fairly simple to implement in a future DaVinci update.
+1
Offline

Alex Masiuk

  • Posts: 3
  • Joined: Sun Nov 04, 2018 11:27 am
  • Real Name: Alex Masiuk

Re: Possible to cut/edit in BMP (beats per minute)?

PostTue Nov 27, 2018 3:59 pm

This is most wanted function for the sound producers and music makers who want to edit video in DR with bpm grid! It's terrible, that in 2018 there is only vegas pro has that function. You can not use your ears when the task is to edit with 8,16,32, and 8,16,32 triplets. I mean duration of music notes. Or when I want to put video clips on every secondth, or every thirdth quarter of every bar, or exactly between them. This is very musthave feature for music videos. For me it's the mystery of the century why top NLEs don't have it yet. Hope it will appear some day. Reaper DAW is the example how the modern application must look like. I mean maximum opportunity to optimize everything for yourself.

However the DR 15 is great, thanks for it!
P.S. Sorry for my English it is not my native language.
Offline

Jim Simon

  • Posts: 31214
  • Joined: Fri Dec 23, 2016 1:47 am

Re: Possible to cut/edit in BMP (beats per minute)?

PostTue Nov 27, 2018 7:35 pm

Music production uses BPM, film and video production do not, and often cannot, as projects can only be frame accurate, whereas audio can be edited down to the sample level.
My Biases:

You NEED training.
You NEED a desktop.
You NEED a calibrated (non-computer) display.
Online

Sander de Regt

  • Posts: 3678
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostTue Nov 27, 2018 8:15 pm

The reason that this isn't available (probably) is because editing is an art. Always cutting exactly on the beat is boring and no editor I've ever met does it apart from the occasional time where it adds something to the proceedings. For example in trailers. But in most music pieces there are so many layers of music that you can cut to, BPM isn't the only factor. You could cut on every trumpet blast, every bass drum or whatever. Just like a conductor doesn't accentuate every beat of an orchestra, but indicates the intention of a musical piece, it's not up to the editor to cut to every beat. At least, that's how I see it.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

Dazzer

  • Posts: 228
  • Joined: Sat Aug 24, 2019 8:31 am
  • Real Name: Daz Harris

Re: Possible to cut/edit in BMP (beats per minute)?

PostThu Sep 26, 2019 8:54 pm

Sander de Regt wrote:The reason that this isn't available (probably) is because editing is an art. Always cutting exactly on the beat is boring and no editor I've ever met does it apart from the occasional time where it adds something to the proceedings. For example in trailers. But in most music pieces there are so many layers of music that you can cut to, BPM isn't the only factor. You could cut on every trumpet blast, every bass drum or whatever. Just like a conductor doesn't accentuate every beat of an orchestra, but indicates the intention of a musical piece, it's not up to the editor to cut to every beat. At least, that's how I see it.


You could make the exact same argument for music production. However every DAW has bar lines matched to a BPM. Because it's useful. Especially when moving sections around (like 16 bars or whatever). And, although i'm a newbie, i could imagine for certain styles of very fast and rhythmic editing to music, being able to "quantize" edits according to bars and beats might be creatively interesting and useful. For example, setting a "hot-spot" in a video clip as the point at which it should snap to a particular bar or beat. (these are all ideas coming from music production which is my day-job).

AFAIK, you can't turn bar lines off in most DAWs. Which is strange as not everyone wants to make music according to a grid!
Offline

vivoices

  • Posts: 474
  • Joined: Sun Apr 22, 2018 9:15 am
  • Real Name: Udo Jansen

Re: Possible to cut/edit in BMP (beats per minute)?

PostFri Sep 27, 2019 7:44 am

You can edit very precise only if you match the BPM to your projects' fps so you will have an integer (whole number) of frames per beat (FPB).

In a 24fps non drop frame project a matching list of BPMs would be:
240 BPM with 6 FPB
180 BPM with 8 FPB
160 BPM with 9 FPB
144 BPM with 10 FPB
120 BPM with 12 FPB
96 BPM with 15 FPB
90 BPM with 16 FPB
80 BPM with 18 FPB
72 BPM with 20 FPB
60 BPM with 24 FPB
48 BPM with 30 FPB
45 BPM with 32 FPB
40 BPM with 36 FPB
36 BPM with 40 FPB
32 BPM with 45 FPB

In a 25fps project you would have fewer options:
250 BPM with 6 FPB
150 BPM with 10 FPB
125 BPM with 12 FPB
100 BPM with 15 FPB
75 BPM with 20 FPB
60 BPM with 25 FPB
50 BPM with 30 FPB
30 BPM with 50 FPB

And in a 30fps non drop frame project:
225 BPM with 8 FPB
200 BPM with 9 FPB
180 BPM with 10 FPB
150 BPM with 12 FPB
120 BPM with 15 FPB
100 BPM with 18 FPB
90 BPM with 20 FPB
75 BPM with 24 FPB
72 BPM with 25 FPB
60 BPM with 30 FPB
50 BPM with 36 FPB
45 BPM with 40 FPB
40 BPM with 45 FPB
36 BPM with 50 FPB
Udo Jansen

Win 10 Pro 22H2, Resolve Studio 19 B2, R9 5950X, 128 GB RAM, Quadro P4000 (8GB VRAM) 551.61 NSD, Intensity Pro 4K | Pocket6Ks FW7.9.1 | Speed Editor
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat Jul 18, 2020 2:30 pm

Hi,
I created a solution to place a beat marker passed on the BPM wanted. It's a python script (I just started to learn Python scripting for Resolve yesterday... so maybe it's not perfect).

I use DVR 16.2 free with MacOS Mojave.

#!/usr/bin/ python

# Beat Marker Python Script
# Made for Resolve V16.2 free
# Copyright 2020 Guillaume Hullin

### CONFIGUARATION VARIABLES
# FPS of your timeline
fps = 29.97
# Beats per minutes
bpm = 112
# How many beats per time
time= 4
# Offset the beat by the number of frame
offset = 0.0
# On which audio track is your sound and which item number is your item
track = 2
item = 1

### END CONFIGURATION

import sys

sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")
import DaVinciResolveScript as dvr_script

try:
resolve = dvr_script.scriptapp("Resolve")
pm = resolve.GetProjectManager()
proj = pm.GetCurrentProject()
tl = proj.GetCurrentTimeline()
mp = proj.GetMediaPool()
rootfolder = mp.GetRootFolder()
rootclips = rootfolder.GetClips()
ms = resolve.GetMediaStorage()
folder = mp.GetCurrentFolder()
clips = folder.GetClips()

except:
print("Open the script file and copy/paste in DVR Console :)")
sys.exit()

# Get the item of the audio track
tli = tl.GetItemsInTrack("audio", track)
tli = tli[item]

max = tli.GetDuration()

# Calculate where should be placed the beat marker (return the frameNbr)
def calcBeatFrame(beatNbr):
global offset
return (((60.0/bpm)*fps)*beatNbr)+offset

tli.DeleteMarkersByColor('Red')
tli.DeleteMarkersByColor('Yellow')

beat = 0.0
x = 0

while beat < max:
x += 1
beat = calcBeatFrame(x)

if x % time:
tli.AddMarker(beat, 'Yellow', 'Beat Nbr{}'.format(x) , '', 1.0)
else:
tli.AddMarker(beat, 'Red', 'Beat Nbr{}'.format(x) , '', 1.0)

print 'Beat Nbr{} created at {} frame'.format(x,beat)

print
print 'End of script'


To use it:
1- copy the code into a text file
2- change the configuration variable to your preference
3- open Workspace>Console in DVR Edit Tab
4- Select Py2 as interpreter
5- Paste the modified code and hit Enter

It will make for a 4/4 tempo it will make 3 yellow marker and 1 red marker.

Hope it helps some people :D
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

ArondenOuden

  • Posts: 6
  • Joined: Sat Jan 12, 2019 3:18 pm
  • Real Name: Aron den Ouden

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat May 22, 2021 1:20 pm

GuillaumeH wrote:Hi,
I created a solution to place a beat marker passed on the BPM wanted. It's a python script (I just started to learn Python scripting for Resolve yesterday... so maybe it's not perfect).

I use DVR 16.2 free with MacOS Mojave.

#!/usr/bin/ python

# Beat Marker Python Script
# Made for Resolve V16.2 free
# Copyright 2020 Guillaume Hullin

### CONFIGUARATION VARIABLES
# FPS of your timeline
fps = 29.97
# Beats per minutes
bpm = 112
# How many beats per time
time= 4
# Offset the beat by the number of frame
offset = 0.0
# On which audio track is your sound and which item number is your item
track = 2
item = 1

### END CONFIGURATION

import sys

sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")
import DaVinciResolveScript as dvr_script

try:
resolve = dvr_script.scriptapp("Resolve")
pm = resolve.GetProjectManager()
proj = pm.GetCurrentProject()
tl = proj.GetCurrentTimeline()
mp = proj.GetMediaPool()
rootfolder = mp.GetRootFolder()
rootclips = rootfolder.GetClips()
ms = resolve.GetMediaStorage()
folder = mp.GetCurrentFolder()
clips = folder.GetClips()

except:
print("Open the script file and copy/paste in DVR Console :)")
sys.exit()

# Get the item of the audio track
tli = tl.GetItemsInTrack("audio", track)
tli = tli[item]

max = tli.GetDuration()

# Calculate where should be placed the beat marker (return the frameNbr)
def calcBeatFrame(beatNbr):
global offset
return (((60.0/bpm)*fps)*beatNbr)+offset

tli.DeleteMarkersByColor('Red')
tli.DeleteMarkersByColor('Yellow')

beat = 0.0
x = 0

while beat < max:
x += 1
beat = calcBeatFrame(x)

if x % time:
tli.AddMarker(beat, 'Yellow', 'Beat Nbr{}'.format(x) , '', 1.0)
else:
tli.AddMarker(beat, 'Red', 'Beat Nbr{}'.format(x) , '', 1.0)

print 'Beat Nbr{} created at {} frame'.format(x,beat)

print
print 'End of script'


To use it:
1- copy the code into a text file
2- change the configuration variable to your preference
3- open Workspace>Console in DVR Edit Tab
4- Select Py2 as interpreter
5- Paste the modified code and hit Enter

It will make for a 4/4 tempo it will make 3 yellow marker and 1 red marker.

Hope it helps some people :D


Maybe the code that doesn't work with the newer version, but I'm getting an error message.
Image

Can you help me out?
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat May 22, 2021 6:56 pm

ArondenOuden wrote:
GuillaumeH wrote:Hi,
I created a solution to place a beat marker passed on the BPM wanted. It's a python script (I just started to learn Python scripting for Resolve yesterday... so maybe it's not perfect).

I use DVR 16.2 free with MacOS Mojave.

#!/usr/bin/ python

# Beat Marker Python Script
# Made for Resolve V16.2 free
# Copyright 2020 Guillaume Hullin

### CONFIGUARATION VARIABLES
# FPS of your timeline
fps = 29.97
# Beats per minutes
bpm = 112
# How many beats per time
time= 4
# Offset the beat by the number of frame
offset = 0.0
# On which audio track is your sound and which item number is your item
track = 2
item = 1

### END CONFIGURATION

import sys

sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")
import DaVinciResolveScript as dvr_script

try:
resolve = dvr_script.scriptapp("Resolve")
pm = resolve.GetProjectManager()
proj = pm.GetCurrentProject()
tl = proj.GetCurrentTimeline()
mp = proj.GetMediaPool()
rootfolder = mp.GetRootFolder()
rootclips = rootfolder.GetClips()
ms = resolve.GetMediaStorage()
folder = mp.GetCurrentFolder()
clips = folder.GetClips()

except:
print("Open the script file and copy/paste in DVR Console :)")
sys.exit()

# Get the item of the audio track
tli = tl.GetItemsInTrack("audio", track)
tli = tli[item]

max = tli.GetDuration()

# Calculate where should be placed the beat marker (return the frameNbr)
def calcBeatFrame(beatNbr):
global offset
return (((60.0/bpm)*fps)*beatNbr)+offset

tli.DeleteMarkersByColor('Red')
tli.DeleteMarkersByColor('Yellow')

beat = 0.0
x = 0

while beat < max:
x += 1
beat = calcBeatFrame(x)

if x % time:
tli.AddMarker(beat, 'Yellow', 'Beat Nbr{}'.format(x) , '', 1.0)
else:
tli.AddMarker(beat, 'Red', 'Beat Nbr{}'.format(x) , '', 1.0)

print 'Beat Nbr{} created at {} frame'.format(x,beat)

print
print 'End of script'


To use it:
1- copy the code into a text file
2- change the configuration variable to your preference
3- open Workspace>Console in DVR Edit Tab
4- Select Py2 as interpreter
5- Paste the modified code and hit Enter

It will make for a 4/4 tempo it will make 3 yellow marker and 1 red marker.

Hope it helps some people :D


Maybe the code that doesn't work with the newer version, but I'm getting an error message.
Image

Can you help me out?


Thanks for the data, basically it seemed that the copy paste of the code was a problem and skipped all the indentation.
I uploaded the script my GitHub so you can pick it up there.

https://github.com/GuillaumeHullin/davi ... 0Marker.py
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

bounceHouse

  • Posts: 371
  • Joined: Tue Apr 14, 2020 12:40 am
  • Real Name: Wesley McDermott

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat May 22, 2021 9:11 pm

Thanks!
PC Win 10 Pro, 64GB ram; NVidia 522.30; dual monitor; RTX 3080 (10GB); auto/CUDA processing mode; SSD cache, separate SSD for data; Davinci Studio 19b33 build
Offline

ArondenOuden

  • Posts: 6
  • Joined: Sat Jan 12, 2019 3:18 pm
  • Real Name: Aron den Ouden

Re: Possible to cut/edit in BMP (beats per minute)?

PostSun May 23, 2021 10:05 am

Sorry that I'm bothering you so much, but I'm now getting a different error when I run it.
I says that it can't import 'DavinciResolveScript'. Can you help me out?

Image
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostSun May 23, 2021 10:16 am

Davinci Studio 17.2 build 11
Windows 10
Python 2.7.8 amd64

I get the same error...
Attachments
Consol DR.jpg
Consol DR.jpg (120.22 KiB) Viewed 12768 times
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostSun May 23, 2021 11:18 am

If you are running on Windows you need to update
Code: Select all
sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")


I run on MacOS so I can't be sure but try:
Code: Select all
sys.path.append("C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Modules")
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 9:44 am

Hi GuillaumeH!

Thank you !

"If you are running on Windows you need to update"

How / where to put in the code ?
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 9:49 am

I’m talking about updating the code I wrote :) on line 24. Replace the path which is written for MacOS and put the path for windows.
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 10:11 am

Okay, after updating line 24 ... I got this error ...

Think I'm trying with my Mac mini instead!
Attachments
Consol DR.jpg
Consol DR.jpg (120.72 KiB) Viewed 12690 times
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 10:19 am

If you use a Mac then I guess it should work like that... but note that I'm running DVR 16 and MacOS Mojave... I don't know if that matter much.
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 10:26 am

With my Mac Mini M1, it seems to work ! Thank you !
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 10:30 am

Sure.
If it works with Big Sure and Mojave... should be good for every mac user ;)
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 11:23 am

Have tested a little bit with Windows ... now it seems to work!
Attachments
Consol DR.jpg
Consol DR.jpg (175.81 KiB) Viewed 12646 times
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 11:26 am

Is the path I wrote earlier for Windows correct? or you used something else?
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline

Ole Kristiansen

  • Posts: 284
  • Joined: Tue Nov 28, 2017 8:37 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 11:32 am

Is the path I wrote earlier for Windows correct? Yes, that's your script !
Offline
User avatar

GuillaumeH

  • Posts: 13
  • Joined: Sat Jul 18, 2020 10:10 am
  • Location: Malmö, Sweden
  • Real Name: Guillaume Hullin

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon May 24, 2021 5:27 pm

Ok thanks, I updated my GitHub repo to add some readme and the path for Windows.

https://github.com/GuillaumeHullin/davi ... ve-scripts
Dell Precision M3800 with MacOS Mojave
Davinci Resolve 16.2 (Free)

https://www.youtube.com/guillaumehullin
Offline
User avatar

Mylonas Films

  • Posts: 64
  • Joined: Mon Aug 05, 2019 5:41 am
  • Location: Central Coast - Australia
  • Real Name: Stephen Mylonas

Re: Possible to cut/edit in BMP (beats per minute)?

PostWed Jun 02, 2021 11:08 pm

Nice, This worked in V17.2.1 on my Windows machine.

After some trial and error (I'm a newbie to scripts) I eventually figured I had to remove the Hashtag before the sys.path in your script.

I'll paste what worked below. Thanks so much for the great script!

Code: Select all
#!/usr/bin/ python

# Beat Marker Python Script
# Made for Resolve V16.2 free
# Copyright 2020 Guillaume Hullin, www.youtube.com/GuillaumeHullin

### CONFIGUARATION VARIABLES
# FPS of your timeline
fps = 25
# Beats per minutes
bpm = 130
# How many beats per time
time= 4
# Offset the beat by the number of frame
offset = 20.0
# On which audio track is your sound and which item number is your item
track = 1
item = 1

### END CONFIGURATION

import sys

sys.path.append("C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Modules")

import DaVinciResolveScript as dvr_script

try:
    resolve = dvr_script.scriptapp("Resolve")
    pm = resolve.GetProjectManager()
    proj = pm.GetCurrentProject()
    tl = proj.GetCurrentTimeline()
    mp = proj.GetMediaPool()
    rootfolder = mp.GetRootFolder()
    rootclips = rootfolder.GetClips()
    ms = resolve.GetMediaStorage()
    folder = mp.GetCurrentFolder()
    clips = folder.GetClips()

except:
    print("Open the script file and copy/paste in DVR Console :)")
    sys.exit()

# Get the item of the audio track
tli = tl.GetItemsInTrack("audio", track)
tli = tli[item]

max = tli.GetDuration()

# Calculate where should be placed the beat marker (return the frameNbr)
def calcBeatFrame(beatNbr):
    global offset
    return (((60.0/bpm)*fps)*beatNbr)+offset

tli.DeleteMarkersByColor('Red')
tli.DeleteMarkersByColor('Yellow')

beat = 0.0
x = 0

while beat < max:
    x += 1
    beat = calcBeatFrame(x)

    if x % time:
        tli.AddMarker(beat, 'Yellow', 'Beat Nbr{}'.format(x) , '', 1.0)
    else:
        tli.AddMarker(beat, 'Red', 'Beat Nbr{}'.format(x) , '', 1.0)

    print 'Beat Nbr{} created at {} frame'.format(x,beat)

print
print 'End of script'
-----------------------------------------
stephen.mylo@gmail.com
DOP/Colorist
DaVinci Resolve V18
Windows 10 Pro 64-bit (10.0, Build 19041)
GeForce RTX 2070Super Gaming OC 8GB
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz (24 CPUs)
Memory: 132GB RAM
Offline
User avatar

Mylonas Films

  • Posts: 64
  • Joined: Mon Aug 05, 2019 5:41 am
  • Location: Central Coast - Australia
  • Real Name: Stephen Mylonas

Re: Possible to cut/edit in BMP (beats per minute)?

PostWed Jun 02, 2021 11:13 pm

GuillaumeH wrote:Ok thanks, I updated my GitHub repo to add some readme and the path for Windows.
https://github.com/GuillaumeHullin/davi ... ve-scripts


Nice, This worked in V17.2.1 on my Windows machine.

After some trial and error (I'm a newbie to scripts) I eventually figured I had to remove the Hashtag before the sys.path in your script. That's all I had to do and it worked. see below path for windows.
Code: Select all
sys.path.append("C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Modules")

I'll paste what worked below. Thanks so much for the great script!
Code: Select all
#!/usr/bin/ python

# Beat Marker Python Script
# Made for Resolve V16.2 free
# Copyright 2020 Guillaume Hullin, www.youtube.com/GuillaumeHullin

### CONFIGUARATION VARIABLES
# FPS of your timeline
fps = 25
# Beats per minutes
bpm = 130
# How many beats per time
time= 4
# Offset the beat by the number of frame
offset = 20.0
# On which audio track is your sound and which item number is your item
track = 1
item = 1

### END CONFIGURATION

import sys

sys.path.append("C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting\Modules")

import DaVinciResolveScript as dvr_script

try:
    resolve = dvr_script.scriptapp("Resolve")
    pm = resolve.GetProjectManager()
    proj = pm.GetCurrentProject()
    tl = proj.GetCurrentTimeline()
    mp = proj.GetMediaPool()
    rootfolder = mp.GetRootFolder()
    rootclips = rootfolder.GetClips()
    ms = resolve.GetMediaStorage()
    folder = mp.GetCurrentFolder()
    clips = folder.GetClips()

except:
    print("Open the script file and copy/paste in DVR Console :)")
    sys.exit()

# Get the item of the audio track
tli = tl.GetItemsInTrack("audio", track)
tli = tli[item]

max = tli.GetDuration()

# Calculate where should be placed the beat marker (return the frameNbr)
def calcBeatFrame(beatNbr):
    global offset
    return (((60.0/bpm)*fps)*beatNbr)+offset

tli.DeleteMarkersByColor('Red')
tli.DeleteMarkersByColor('Yellow')

beat = 0.0
x = 0

while beat < max:
    x += 1
    beat = calcBeatFrame(x)

    if x % time:
        tli.AddMarker(beat, 'Yellow', 'Beat Nbr{}'.format(x) , '', 1.0)
    else:
        tli.AddMarker(beat, 'Red', 'Beat Nbr{}'.format(x) , '', 1.0)

    print 'Beat Nbr{} created at {} frame'.format(x,beat)

print
print 'End of script'
-----------------------------------------
stephen.mylo@gmail.com
DOP/Colorist
DaVinci Resolve V18
Windows 10 Pro 64-bit (10.0, Build 19041)
GeForce RTX 2070Super Gaming OC 8GB
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz (24 CPUs)
Memory: 132GB RAM
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostThu Dec 29, 2022 10:25 pm

Made a script that is very convenient also to detect BPM and Offset when placing a few audio clip or timeline markers.
The time format of Length and Offset is the same as it's used in Resolve. Hence, it's very easy to handle. With BPM you can do simple Math A*B+C, A/B-C, A*B etc. to get quick matching results.

Colored Markers can be placed onto the TimeLine or onto the audio clip.

You might like to download the lua file here: (it's only tested on an MAC M1)
https://drive.google.com/file/d/1WuPfr2 ... share_link
Attachments
Beat Marker.png
Beat Marker.png (221.45 KiB) Viewed 6891 times
Offline

Shrinivas Ramani

Blackmagic Design

  • Posts: 2785
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Possible to cut/edit in BMP (beats per minute)?

PostFri Dec 30, 2022 11:52 am

Please take a look at Fairlight's grid mode and musical tempo.
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostFri Dec 30, 2022 12:14 pm

Would be great, if it's available on the edit page as well. But you are right, I think one of the best explanations for its use in Fairlight is the following tutorial:

Last edited by TiDa on Sat Jan 14, 2023 7:54 am, edited 5 times in total.
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostThu Jan 05, 2023 1:50 pm

An update of the BeatMarker lua script and more infos at:
https://www.steakunderwater.com/wesuckl ... 277#p43277
Online
User avatar

Charles Bennett

  • Posts: 6514
  • Joined: Sat Nov 05, 2016 11:55 am
  • Location: United Kingdom

Re: Possible to cut/edit in BMP (beats per minute)?

PostThu Jan 05, 2023 7:24 pm

This video may be of interest.
Resolve Studio 19.0b3 build 33
Dell XPS 8700 i7-4790, 24GB RAM, 2 x Evo 860 SSDs, GTX1060/6GB (551.86 Studio Driver), Win10 Home (22H2), Speed Editor, Faderport mk1, Eizo ColorEdge CS230 + BenQ GW2270 + Samsung SA200, Canon C100mk2, Zoom H2n.
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat Jan 14, 2023 8:00 am

Be careful with his explanations, this is correct: viewtopic.php?f=21&t=73101&p=911219#p911219
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostSat Jan 14, 2023 8:08 am

Made an update, where you can move the Playhead beat and sub beat wise in the Cut, Edit and Fairlight Page by assigned keyboard shortcuts:
https://www.steakunderwater.com/wesuckl ... 321#p43321
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostWed Oct 04, 2023 9:34 am

TiDa wrote:Made an update, where you can move the Playhead beat and sub beat wise in the Cut, Edit and Fairlight Page by assigned keyboard shortcuts:
https://www.steakunderwater.com/wesuckl ... 321#p43321


It takes some time to place several Markers on the audio track or timeline when running a repetition. An interesting speed-up occurs when two different scripts start at the same time. For example, markers to track1 with the first script and to track2 with the second. The marker build-up is not displayed at the UI until the faster script finishes.

But the overall time to finish both is several times faster than expected.

Would be great to be able to suspend the UI adaptation to speed things up. Has somebody an idea how this can be done?
Offline

TiDa

  • Posts: 32
  • Joined: Mon Mar 25, 2013 1:05 pm

Re: Possible to cut/edit in BMP (beats per minute)?

PostMon Jun 10, 2024 3:38 pm

Be interested? This Macro used in the Generator section might run on the free version of Davinci Resolve:
https://www.steakunderwater.com/wesuckl ... 938#p48938

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Lmuno1 and 182 guests