For Reference - The Answer To Smooth Scroll Over Fixed Time

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

Sean Weaver

  • Posts: 184
  • Joined: Fri May 21, 2021 6:37 am
  • Real Name: Sean Weaver

For Reference - The Answer To Smooth Scroll Over Fixed Time

PostFri Oct 15, 2021 9:06 pm

I'm putting this here because I had asked a month or so ago on the thread about my music project, and attempting to figure out the mathematics involved in this. I believe I have arrived at the answer for how to accomplish this conclusively and it took about a month, trial and error, and going back to mathematics. If anyone sees any holes in the math or logic, please let me know. Otherwise, it was a bit frustrating to not know how to accomplish my primary goal and so I want to put this here for the benefit of others ahead. No real question to this. Just a series of steps, notes, and how I arrived here. A ton of nights working on this until after 3 am (yes I am being serious; I work too hard to solve problems and am relentless for better or worse.)

The Goal: Determine a mathematical formula in order to smoothly scroll a horizontal line of music across the screen at an even pixels-per-frame rate. The formula must work for pieces of music at various tempos, numbers of measures, width from first to last measure, and various time-spans (i.e. whether the solo is 10 seconds of 4 minutes).

The Steps:

1. Convert seconds/minutes/beats/tempo grids (Pro Tools/Logic/whatever) to video frames. I am shooting at 60 frames per second.

2. With the music length now determined in frames, establish what rate you want the scroll to be at (2, 3, 4, etc. pixels per frame).

3. I played around with scrolling a solid color background in Fusion in order to test this: Pixels/Frames = Motion. Using simple Algebra:

Frame-Length of Section x (times) Desired Motion (i.e. 2 or 3 pixels per frame) = Pixels Required to Scroll
across a given point

4. For a scroll beginning on the left-side of the screen (first note) and ending on the right side of the screen (last note), add the screen/timeline resolution to previous step.

i.e. solo is 1500 frames in length. I want it to scroll at 3-pixels per frame for a balance of stability and speed (but not too much as to make it difficult to read as the music scrolls). Therefore, 1500x3 = 4500. At 6k (yes I’m getting away with it in Fusion Studio stand-alone), add 6144 + 4500 = 10,644 pixels in width. Obviously this is easily adaptable.

(I got some really nice scrolls at 1920x1080 so this should work across the board by just plugging in the appropriate numbers).

5. Finale Notation Software (which I use; Sibelius or Guitar Pro or others probably are similar) exports graphics with the option to select or customize DPI. For DPI:

Pixels/Inches (set in Page Layout) = DPI. (yes I know it's "Dots Per Inch" and that the P does not refer to Pixels, but I checked what it was putting out and the math lined up precisely so I ran with it)

Suppose 25” of width are necessary for a clean looking continuous line containing 12 measures:

10,644 pixels/25” = 426 (rounded up) DPI.

(Once the DPI is established, in order to set the height in Page Layout, you can plug in video resolution height pixels/DPI = height. The resolution determines the height we need. The DPI has previously been established. So for example, 2560/426 = 6 inches).

We set out page layout to 25x6, and export a graphic at 426 DPI. This generates an image that is 10,644x2560.

Of course the image could be imported to PhotoShop but being meticulous with the Page Layout and DPI settings out of the notation software allows me to bypass the import/export from PS.

6. Import into Fusion. Animate Scroll.

7. Final thoughts: From this, the resolution of the image (in DPI) will always be inversely proportional to to the width of the page for a “set” number of pixels. The wider the page, the lower the DPI for a set number of pixels. I can make it look fine as low as 125 DPI or so, but higher is better, and so when the measures don’t need to be so wide, it’s good practice to keep measures no wider than they need to be for a clean looking layout of notes.

Another breakthrough, which is stupid it took me so long to realize but whatever. Resolution is size. With this in mind, the scroll-rate is directly proportional to the image resolution. Want the notes bigger? Then you sacrifice the ability to keep it at a slow speed. As image resolution increases, motion (in pixels per frame) must increase for the same number of frames within the musical selection. Without changing the length of the piece, more “zoom” necessitates faster scroll. I may want a rate of 2-pixels per frame but have to settle for 3-pixels per frame. (This just happened. I had a graphic that looked too small for an iPhone screen. Increasing the size by 1.5, I arrived at 2x1.5 = 3. The music became bigger but I had increase the pixels per frame with it. This of course makes perfect sense. For ease of reading as it scrolls, I’m hoping to never need to scroll more than 3-pixels per frame.

For longer selections of music, I have the benefit of more frames. Frames are inversely proportional to rate of motion (in pixels per frame), and so with more frames available, I can scroll at slower speeds for a particular pixel resolution.


If anything in here is blatantly wrong, definitely please let me know. So far, this seems to be holding up and at long last, gives me the formulas & steps that I desired in order to “get it right the first time” without losing hours and days trying to get a scroll (that places all of the music on screen at a good size in-time with everything on-screen by the time the note is played) work “by trial and error.” I was certain it had to be a mathematical answer and and have been formulating the steps now for several weeks.

I had the pixels/frames = motion part down a while ago but everything was getting screwed up coming out of Finale and not factoring in how DPI affected the chain.

Following all of the steps in order is so far, miraculously at last, working.

Of course I’d like to know if anything in my math and/or steps can be improved (or outright fixed; wrong is wrong) but that’s really not the primary reason I am putting this here (if something in wrong, then it won't work and I'll find out), nor is this the standard “I need help” post.

I'm putting this here because I actually want it to help somebody else, somehow, since it was such a long road for me to arrive at for myself, and not having a clear formula to follow (or resources on where to find it) led to a lot of errors, inconsistencies, and ultimately a huge time-sink. I knew that efficiency could only come from accuracy and that accuracy would have to be found within mathematics.

Sean


*Edit/Update: As I further fine-tune this and find the math is working....it bears putting here that when working in frames from the downbeat of measure 1 (start of the piece) to the very last note present, the page margins are wasted space. With 1/2 inch left and right margins, 1-inch should be subtracted from the page width when calculating these numbers. I was still getting a little bit of inaccuracy until I just now adjusted that. And now...perfection. Treble Clef starts left-screen, last note finishes coming in from the right (on time)....so subtract the margins in the calculations
Attachments
notation layout.jpg
notation layout.jpg (840.56 KiB) Viewed 380 times
DR 18 Studio
macOS Monterey 12.7.2
MBP 16-Inch, 2019
2.4 GHz 8-Core Intel i9
32GB 2667 MHz DDR4
AMD Radeon Pro 5600M 8GB

Return to DaVinci Resolve

Who is online

Users browsing this forum: ahartley, AndreN, Bing [Bot], John Paines, panos_mts, Whiffz, wunnex and 170 guests