Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 08-05-2020, 03:23 PM   #1
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default Tempo mapping, audio quantization, and digitization from tape

There would have been a "Help me!" in that title if it wasn't already too long...

I've been going around in circles for days now trying to wrap my brain around what I need to do about getting stuff in time (potentially) and keeping it in time (absolute necessity). I thought at least talking about it might help, if no one actually helps...

The gist of it is this: I digitized an old 4 track tape and I want to cut up the audio a bit and rearrange a few things. I did that but stuff is getting way too sloppy. For example, I did a lot of FX envelopes in one project, and then moved to a different project and worked on part edits - thinking I'd 'just' render the audio from the part edit project and plop it back into my 'FX envelopes' one. Done.

But not so done. There's tempo fluctuations in the source audio that make it difficult to cut one part, one track of the song and put it in another place and have it line up properly with other tracks. For example, I'd cut the drums and bass out of one section, call it section A, that had a clean digitization, no signal drops, and put it in another section, call it section B; guitar and vox are kept the same in 'section B'. However, the tempo over section A might've been 83 BPM, but the tempo in section B might've been 88 BPM. So the vox and guitar are a little off relative to drums and bass, and I have to finagle stuff to get it right - but that gets messy and cumbersome fast...

So... Basically, it looks like the digitization from tape included a tape machine that fluctuated speed such that the slowest tempo is about 83 BPM and the fastest about 88 BPM. Originally, the material was recorded to a click track (just the MIDI material) at I think 85 BPM. The performance itself is tight; it's the tape speed that's varying.

I can't say it's that noticeable, the tempo fluctuation, but the song does seem to, how do I say it, it just feels a little off at times and in places. I haven't really pinpointed exactly those places, though.

For a while now I've 'known' that I should've done something to keep all the timing in line, from the start. But I didn't. And I've done a bunch of work, like all the FX envelopes and a bunch of re-arranging, that would take a lot of work to remake were I to start from scratch...

It's just starting to gel that I should have, I think, quantized the audio source material after I digitized it. Does that sound right? The tempo fluctuations are due to the tape machine and technically tempo should be a solid 85 BPM (or maybe 86) - the only way to deal with that is to quantize the audio (and I still have to figure out how exactly to do that)...

At first I thought it was tempo-mapping that I needed to do (which I've done, now). But that just adjusts the timeline and grid to match the tempo fluctuations of the source audio, right? IF I want the song to have a rock-solid tempo, then I'd need to do the quantize thing, right?

I guess one additional question is, Is this common - that a digitization from tape will have tempo fluctuations of this magnitude (83-88 BPM)? And, is this magnitude really all that bad? That's the worst it is, in one or two spots, most of the time it's maybe plus or minus 1 BPM...

I think I'll leave it at that for now. Any insights, suggestions, direction, confirmation, etc. would be most appreciated...
eq1 is offline   Reply With Quote
Old 08-05-2020, 06:59 PM   #2
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Here's a thought: I just came across a thread that mentioned using the play rate envelope to deal with tape speed fluctuation.* On the surface it seems like the most one-to-one type of 'fix' of the core of my problem: tape speed varied when digitizing?, so why not vary playback rate to compensate?

And tempo mapping tells us how the tempo (speed) varies: Is there some straight forward way to, like, convert the tempo map into an envelope for play rate?


* post 20 in this: https://forum.cockos.com/showthread....pe+restoration
eq1 is offline   Reply With Quote
Old 08-05-2020, 07:11 PM   #3
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
I guess one additional question is, Is this common - that a digitization from tape will have tempo fluctuations of this magnitude (83-88 BPM)?
I can't quote figures, but yes, it's common that transference from old four track tape (cassette, presumably) would have chronic tempo fluctuations.
Quote:
Originally Posted by eq1 View Post
And, is this magnitude really all that bad?
Well, it ain't good!

What you probably should have done is to transfer all four tracks to digital simultaneously. Failing that, you're looking at a lot of work with stretch markers, I think.
Fex is offline   Reply With Quote
Old 08-05-2020, 10:55 PM   #4
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
What you probably should have done is to transfer all four tracks to digital simultaneously.
I did. The 4 tracks are in sync, just that the tempo fluctuates. It becomes an issue - in terms of track-to-track timing - when I, say, want to copy some measures from one track or another, from one section of the timeline, and paste it into another section of the timeline. Then all 4 tracks might not be in time...

Quote:
Originally Posted by Fex View Post
Failing that, you're looking at a lot of work with stretch markers, I think.
I'm really thinking my idea above, about using tempo map envelope points/values to create a playrate adjustment envelope, seems like the appropriate fix. I just have to figure out A) if there's already a script or something that does the conversion, or B)figure out the math and do something myself... Or C) kludge something together in a more manual way...

Are there any statistical-like tools to deal with tempo marker values? The calculations to convert tempo marker values to playrate adjustments should be pretty straight forward. I'll post something a little later, I have to work it out a bit...

EDIT
OK, here you go. These are the calculations/steps needed (I think) to create playrate envelope values that will compensate for fluctuating tempo, as determined by the tempo map marker values:

mean tempo (for this particular song) is 144 measures X 4 beats/m= 576 beats / 6.7127167 min. = 85.807 BPM

1st tempo marker value is 85.669 BPM, 2nd is 85.635.

1st marker playrate adjustment value:
mean 85.807, 1st marker 85.669 BPM, ratio 85.807/85.669= 1.00161

The ratio of mean tempo over tempo marker value is the playrate envelope point value.


2nd marker: 85.635 BPM, mean 85.807, ratio mean/marker= 1.002001

If the tempo marker value were 88 BPM: 85.807/88= 0.97508
If the tempo marker value were 83 BPM: 85.807/83= 1.033819

Now, how can we automate these calculations for all the tempo marker values - and make the calculated values the new playrate envelope point values, where the point locations correspond to the tempo marker locations?

I've been trying to figure out if there's even a way to export tempo marker point values, so I can simply calculate the playrate adjustment values in a spreadsheet and import back somehow or simply enter them manually. Anyone know if exporting tempo marker values is possible, or perhaps where these data reside in a file on disk?

Last edited by eq1; 08-05-2020 at 11:54 PM.
eq1 is offline   Reply With Quote
Old 08-06-2020, 12:07 AM   #5
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
I did. The 4 tracks are in sync, just that the tempo fluctuates.
Okay, then! There are two opposing approaches to this, and a third option which might make more sense. The correct approach might be different from song to song.

Approach 1: Let the fluctuations win. Accept that the quality is never going to be perfect, and make the fewest changes you can get away with. Consider editing all tracks at a particular point in a song, even if three of those tracks were good to start with, if it means that you will end up with a better match than if you were to try to force a passage into a new context where it doesn't want to fit.

Approach 2: Force everything to tempo. It's supposed to be to click, right? So, before you even start editing, find the beginning of every bar, place a marker, put stretch markers in the same position on every track, and drag those suckers to the grid.

Approach 3: If there's really going to be an enormous amount of work involved, maybe the effort would be better spent re-recording the whole thing from scratch, perhaps using samples from the original, and perhaps not. There's nothing you can play that you can't play better. Priceless performances from long dead friends? Well, let the dead bury the dead.

Anyway.... using tempo markers to fix playrate....

I like to create templates for this sort of thing. Having found a good rough approximation of the tempi by converting time selections to tempo markers, I might ruthlessly hack the audio to shreds. Really. Cuts on every track at every bar line. Maybe cuts on beats in places. Then I'd cut and paste all the pieces at once into a second project in a second tab, where the tempo doesn't fluctuate from the target. Timestretch everything to grid with a simple alt and drag.

Will this sound good? Probably not - but at this point, I'll know what sort of problems the material is going to present when I start editing properly - which parts will survive this approach, which parts will need more careful handling, and which parts really ought to be left alone.

$0.02

I've got a box full of old four track tapes somewhere. The machine itself died twenty years ago, and my only decent cassette player is currently missing a drive belt. Ah well.... maybe one day....

Quote:
Originally Posted by eq1 View Post
Now, how can we automate these calculations for all the tempo marker values - and make the calculated values the new playrate envelope point values, where the point locations correspond to the tempo marker locations?
Oh, way too much maths for my little brain. 85.807 BPM is a ridiculous tempo. It's 86.

Quote:
Originally Posted by eq1 View Post
Anyone know if exporting tempo marker values is possible
Of course it's possible. The protocol required is called MIDI!

Last edited by Fex; 08-06-2020 at 12:13 AM.
Fex is offline   Reply With Quote
Old 08-06-2020, 12:30 AM   #6
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
...85.807 BPM is a ridiculous tempo. It's 86.
Funny - I think it really is 86 - that the tape machine not only fluctuates speed but was slow. I noticed that things sounded more right when I upped the playrate to 1.003 -- turns out that 1.003 X the mean tempo happens to be 86 BPM.

But using the mean tempo like that above - 85.807 BPM - just makes this tempo marker conversion thing more straight forward.
eq1 is offline   Reply With Quote
Old 08-06-2020, 12:36 AM   #7
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Of course it really is 86 BPM! Or was.... You wouldn't have set your metronome to 85.669, would you?
Quote:
Originally Posted by eq1 View Post
Anyone know if exporting tempo marker values is possible, or perhaps where these data reside in a file on disk?
I figured that it had to be in the RPP, so I did an experiment - made a project with nothing but a title and three tempo markers, at 120, 130 and 140 BPM. Opened the RPP in notepad. Found this:

<TEMPOENVEX
EGUID {9362FB4A-89DD-4BBC-A052-862C3049AA54}
ACT 1 -1
VIS 1 0 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1 -1 -1
PT 0.000000000000 120.0000000000 1
PT 1.500000000000 130.0000000000 1
PT 3.346153846154 140.0000000000 1

And to think that there are people amongst us who actually understand this stuff....

I was serious about the MIDI, BTW. Make a MIDI part with no actual notes, and you can export the tempi in a MIDI file. I don't know where that gets you, but I'll bet it gets you somewhere.

Last edited by Fex; 08-06-2020 at 12:41 AM.
Fex is offline   Reply With Quote
Old 08-06-2020, 12:47 AM   #8
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

^ Yeah, I read a little about the MIDI thing and exporting tempo, but I don't think that produces the data I need at this point...

What's "RPP"? That looks like something I need to find - I could just copy and paste, import, those tempo values.

edit: Duh - "RPP" = extension of a Reaper project file...
eq1 is offline   Reply With Quote
Old 08-06-2020, 12:55 AM   #9
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Software exists to compensate for tape degradation, of course. They use it to restore recordings of historic value.... it calculates wow and flutter based on subtle (and some not so much) variations in pitch.... perhaps imperceptable to the human ear, but consistent, and measurable. Then it compensates automatically.

The downside is, last time I checked, the software sold for around $3000.00, which, to me, might as well be $3,000,000. Still, some dumb sucker bought it, and is waiting for you to find him and buy him a pizza.

This is quite remarkable, I think....

https://www.youtube.com/watch?v=3k6I...JSx82CKTCSBNrf

.... it's a Woody Guthrie live concert recorded on a wire the thickness of a human hair, and restored to something quite listenable.


Last edited by Fex; 08-06-2020 at 02:58 AM. Reason: "degredation" my butt.
Fex is offline   Reply With Quote
Old 08-06-2020, 01:03 AM   #10
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
Duh - "RPP" = extension of a Reaper project file...
Indeed - I've just saved again after gradually extending tempo 120 > 130 in Reaper. I thought it would mess with the "DEFSHAPE" - it didn't.

<TEMPOENVEX
EGUID {9362FB4A-89DD-4BBC-A052-862C3049AA54}
ACT 1 -1
VIS 1 0 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1 -1 -1
PT 0.000000000000 120.0000000000 0
PT 1.440000000000 130.0000000000 1
PT 3.286153846154 140.0000000000 1

OMG, I'm decoding Justin....

I wonder what ACT 1 -1 is.... King Lear?
Fex is offline   Reply With Quote
Old 08-06-2020, 02:20 AM   #11
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

OK, we're getting somewhere, but I'm tired now.

I've successfully created a playrate envelope that has the adjustment factors I described above, for all tempo marker points. Fex, your tip to the 'RPP' was key.

I copied the tempo marker envelope points in arrange view and pasted them into the playrate envelope. Then I went to the RPP, copied both the tempo values and the playrate values, imported them into Excel, calculated the adjustment rates as I explained earlier, then copied that stuff back to notepad, then back to the RPP. The RPP now has the new, adjustment playrate values. I open it up and there you go, a playrate envelope with points corresponding to the tempo marker points, with values that should adjust the play rate to compensate for the fluctuating tempo in the source audio file, that was due to fluctuating tape speed...

Now, the only thing I have to do is remove the tempo markers, or bypass them (is that possible, I'm not seeing how). Correct me if I'm wrong, but the tempo markers actually change the speed, too. The way I had it before, it's just that the tempo changes, the tempo marker values, corresponded to the changing speed of the source audio. But if I go in and edit a tempo marker value it would change the tempo, right?

So, I need to get rid of the tempo map and let the playrate envelope dictate the change of the tempo/speed - and those changes should even-out the speed, make the tempo 85.807 BPM. I'll have to do these things tomorrow. Here's a screen shot of the RPP with playrate before I made the changes and the values to which I changed, at right:

Attached Images
File Type: jpg tempo_to_playrate_adjust1.jpg (54.1 KB, 451 views)
eq1 is offline   Reply With Quote
Old 08-06-2020, 02:48 AM   #12
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

I am utterly bewildered, TBH. I can't do basic arithmatic, have never used Excel, didn't know that a playrate envelope was a thing - and eq1 just gets all this stuff, but didn't figure out that tempo changes would have to be recorded in the RPP, and had to think about what an RPP was.

Dude, how does your mind work?

Quote:
Originally Posted by eq1 View Post
Correct me if I'm wrong, but the tempo markers actually change the speed, too.
Well, speed either means tempo or playrate so.... I'm lost. Except maybe I'm not. I think you're asking whether tempo changes necessarily change item/track/project playrates, and the answer would be that it depends on whether the item/track/project timebase is set to "Time or to "Beats." So, to change that across the project,

File > Project settings

and (bearing in mind that while I understand your ultimate objective, I have no clue what you're really doing here), just in case you need it,

to change timebase per track
Right-click on track > Track timebase.

and

to change timebase per item
Right-click on item > Item properties

Quote:
Originally Posted by eq1 View Post
The way I had it before, it's just that the tempo changes, the tempo marker values, corresponded to the changing speed of the source audio. But if I go in and edit a tempo marker value it would change the tempo, right?
Well now you're asking if changing the tempo changes the tempo. I'm just going to go and kill myself.

It's been fascinating, and I'm glad to have been of help.
Fex is offline   Reply With Quote
Old 08-06-2020, 05:41 AM   #13
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

OK, read up on tempo mapping on these forums.

Maybe have a look here https://forum.cockos.com/showpost.ph...&postcount=144
It's a good way of doing it but needs a "helper" - Sonic Annotator or Audacity.

You need to be sure the timebase is set to "time" - I should think.

Done that? Right. Tempo map your piece, then split it into chunks (what? 4 bars, 8, 2, whatever suits). Now throw the tempo map away, make sure the project tempo is set to what you want (85bpm, in the example given) and stretch the chunks to fit the appropriate numbers of bars at the constant bpm (incidentally, 88/83 is the best part of a semitone, so you probably *won't* want to preserve pitch)

That's it, you're done. Pretty much.
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 08-06-2020, 07:02 AM   #14
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

That looks like a very elegant solution. I'm pretty sure that eq1 is intent on seeing his chosen course through to the bitter end, however. I wanna see what happens....
Fex is offline   Reply With Quote
Old 08-06-2020, 01:58 PM   #15
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
Well, speed either means tempo or playrate so.... I'm lost. Except maybe I'm not. I think you're asking whether tempo changes necessarily change item/track/project playrates, and the answer would be that it depends on whether the item/track/project timebase is set to "Time or to "Beats."
That's right, I didn't grasp that when I wrote what I wrote. So, my time base is "time," not beats, so the tempo marker values I have and that can be seen to change between markers while the song is playing do NOT change the tempo, rather, they just show me what it is...

See, this is the stuff I've been trying to wrap my brain around, there's so many ways to mess with 'time' that I just get lost.

In any event, after I posted my last post yesterday, I went ahead and messed with the tempo markers, deleted them, erroneously thinking they impacted the timing. And... my playrate adjustment envelope doesn't sound good. It 'works,' as in it changes the playrate as the song progresses, and those changes should be what compensates for the changes in the tempo map. But it's not musical. Now it really sounds like I had problems when I digitized from tape!

I'll have to dig in a little and see if I can suss-out exactly why that's the case, but it just looks like my tempo map is too course (every measure) and so playrate-changes over a measure make changes to pitch more noticeable, above and beyond what the original tempo fluctuations do...

Unfortunately the conversion methods I used - digging into the RPP and calculating in a spreadsheet, et al., aren't without pain. So it's not totally easy to just try something different.

Does anyone know how to find the beginning of a line in a notepad or wordpad or text editor doc (I searched online)? Or, if one actually needs the 4 spaces at the beginning of each line in the RPP? That was the only really painful step, everything else was only 'a few key strokes'. With that I had to add 4 spaces at the beginning of each RPP line, manually, for like 400+ markers, so that's 1600 spacebar presses! If I could 'find' the beginning of each line I could then 'replace' it with 4 spaces - if those spaces are actually needed...
eq1 is offline   Reply With Quote
Old 08-06-2020, 02:14 PM   #16
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by jrk View Post
...You need to be sure the timebase is set to "time" - I should think. Done that? Right. Tempo map your piece...
I think I've gotten up to speed, just about, with this much...

Quote:
Originally Posted by jrk View Post
...then split it into chunks (what? 4 bars, 8, 2, whatever suits). Now throw the tempo map away, make sure the project tempo is set to what you want (85bpm, in the example given) and stretch the chunks to fit the appropriate numbers of bars at the constant bpm (incidentally, 88/83 is the best part of a semitone, so you probably *won't* want to preserve pitch)
...and this is the part I've probably got to do, now. This is the "audio quantizing" part, right?

I guess I've been thinking this would or should be possible to achieve, though, by creating that playrate adjustment envelope, and in theory that should be the correct fix for a tape player with speed fluctuations. So it seemed.
eq1 is offline   Reply With Quote
Old 08-06-2020, 04:01 PM   #17
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Quote:
Originally Posted by eq1 View Post
I guess I've been thinking this would or should be possible to achieve, though, by creating that playrate adjustment envelope, and in theory that should be the correct fix for a tape player with speed fluctuations. So it seemed.
For sure, that's certainly A way of doing it. And would work fine if you were just wanting to correct speed variation. It doesn't help you at all when it comes to moving parts around - since you're moving bits that work at playrate x to new positions where playrate y applies. As you've found out. Unless you manage to get you playrates spot on, in which case you can render a corrected version which will work. Really tricky.

One way or another, you'' probably have to work in chunks (even if you do it with stretch markers, which you might snap to grid). There are various actions & scripts that might help you, you'll have to find a way that suits you. Good luck!
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 08-06-2020, 04:11 PM   #18
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Well, here's a couple updates:

-you don't need the 4 spaces at the beginning of each RPP line, so that makes converting tempo marker values to playrate envelope adjustment point values a breeze.

-It looks like you need to use a mean tempo based on the overall project length and the number of beats (like I explained in my original calcs way above), rather than just taking an average of the tempo marker values. I did the latter yesterday, but error creeps in and the marker positions tend to drift. It has to do with weighting, not important to get into.

So the basic procedure goes like this:

-Copy your tempo map points to playrate envelope, save project, close.

-Open the RPP, copy the lines that include tempo map values, paste to a text doc, copy lines that include playrate values, paste to a different text doc.

-Open Excel and import these data, space delimited. Put tempo in one sheet and playrate in another.

-Calculate the overall mean tempo -- number of beats divided by the length of your project, or the length of the selection you're working with. For example, my project is 580 beats / 6.75965 minutes = 85.80326 BPM. The mean tempo is what we want the project to be at the end of all this, and we're trying to achieve that by negating the tempo fluctuations throughout the song with playrate changes... Instead of adjusting the timeline with tempo markers we're adjusting the play back speed of the audio item - so the item should fall as close to the grid as your tempo map does/did.

-OK, now we calculate the playrate adjustment point values based on mean tempo and tempo marker values: In your spreadsheet, in one column, divide mean tempo by each tempo marker value.

-Replace (copy and paste as values) the values in the playrate spreadsheet with these. The existing values are nonsensical, they're simply the tempo marker values, simply a place holder. So you replace them with these real values.

-Copy these data, paste as a new text doc, copy a tab space and paste it into the "find" command field in the text editor/notepad. You need to replace all the tabs with just a space, as far as I can tell. That's the formatting of the original stuff in the RPP. In the "replace" field hit the space bar, click 'find and replace all'. All the tab spaces are replaced with just a single space.

-Copy these data and paste them into the RPP where the playrate data are. Save, change the .txt extension back to .RPP.

That's it. Now when you open the project you'll have a playrate envelope with adjustment values. If you delete the tempo map and change the overall tempo to the mean tempo, the grid should align with your playrate envelope points - as good as it did with the tempo map, at least.

Will it sound right? Probably not. Still working with that. My tempo map was actually every other beat, not every measure as I said earlier. Maybe even that's too course. Or maybe something even more course would be better? I think I'm gonna try this again with a finer resolution tempo map. Seems like at least part of this conversion is only as good as your tempo map, but I'm not sure... There's a lot of things I'm not sure about.

-Also, note that we don't want to 'preserve pitch' when playrate changes; in theory, the playrate changes should fix whatever pitch fluctuations that exist due to tape speed fluctuations. Heavy on the word theory. At this point I hear more pitch fluctuations with the playrate envelope than I did without them...

fyi, here's a scatter plot of my tempo marker values. Thought it might be interesting for you to see:

Attached Images
File Type: jpg tempo_map_scatter.jpg (29.5 KB, 427 views)

Last edited by eq1; 08-06-2020 at 04:29 PM.
eq1 is offline   Reply With Quote
Old 08-06-2020, 04:20 PM   #19
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by jrk View Post
...It doesn't help you at all when it comes to moving parts around - since you're moving bits that work at playrate x to new positions where playrate y applies. As you've found out. Unless you manage to get your playrates spot on, in which case you can render a corrected version which will work. Really tricky.
That's what I was thinking I'd do, or be able to do in theory - render the corrected tracks and use those as the source data thereon out...

Quote:
Originally Posted by jrk View Post
One way or another, you'll probably have to work in chunks (even if you do it with stretch markers, which you might snap to grid). There are various actions & scripts that might help you, you'll have to find a way that suits you. Good luck!
Yeah, I'm guessing what I'm trying to do won't work at the end of it all. If it really worked I'd think there'd already be a script/tool to do it, it's so easy to do even manually... It makes perfect sense in theory - but there must be some reason it doesn't exist, and that software to accomplish similar costs $4500... I think I just need to get some sense why it won't/doesn't work...
eq1 is offline   Reply With Quote
Old 08-06-2020, 05:08 PM   #20
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

hmm, I think I'm on the verge of giving up. My playrate envelope points are still drifting off the grid - they shouldn't do that if all the 'maths' were on the level. I'm thinking that maybe tempo marker values and/or playrate marker values either have different precision or maybe are not that precise overall. I was looking around for some info and found one post that said the precision of playrate values was 0.01 - two decimal places. Here's a link to that:

https://forums.cockos.com/showthread.php?t=220932

Dude says: "What works better is the play rate envelope, yet it isn't precise enough as changes are introduced at steps of 0.01. This is confusing for me since you can set the playback rate in item properties and on the transport much more precisely."

If anyone knows the math behind playrate, the precision, etc. I'm all ears. I don't know where dude came up with the 0.01 precision figure. If I double click on a playrate point to try to set point value manually, the value in the field is "0.99x", for example. Maybe that's where "0.01" came from.

If that's the case, if it's only 2 decimal places, then this isn't going to work. It'd be like the finest resolution of BPM change I can get is 0.01 X 85.803 BPM = 0.86 beats per minute, i.e. the smallest step from point to point is 0.86 BPM, when the tempo fluctuations are a lot finer...

Bummer.

Here's another link to a short thread that mentions playrate precision:
https://forum.cockos.com/showthread.php?t=165973

hmm, yeah, there's a few discrepancies/issues: 1) playrate is only 2 decimal precision, which is too course in itself, 2) tempo markers seem to have 3 decimal precision, so there's that discrepancy vs. playrate, and 3) the tempo envelope has an option to smoothy transition from one point value to the next, whereas I don't see that in playrate.

If these discrepancies are real, then I don't think there's a way to convert a tempo map into a playrate adjustment envelope.

* * *

Here's a few charts illustrating the 'issues' above. If playrate, at least for envelope points, is really just 2 decimal places, the resolution is hell. The first chart shows a scatter plot for raw data values, and the second those values rounded to 2 decimal places. The third shows the raw values rounded to 3 decimal places - I think even just one more decimal place would make a big difference, maybe enough? Not sure...



Attached Images
File Type: jpg playrate_raw_scatter.jpg (28.9 KB, 411 views)
File Type: jpg playrate_round2_scatter.jpg (24.9 KB, 395 views)
File Type: jpg playrate_round3_scatter.jpg (30.5 KB, 413 views)

Last edited by eq1; 08-06-2020 at 06:05 PM.
eq1 is offline   Reply With Quote
Old 08-06-2020, 07:13 PM   #21
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
It makes perfect sense in theory
Theory and practice are the same.... in theory, anyway.
Quote:
Originally Posted by eq1 View Post
but there must be some reason it doesn't exist, and that software to accomplish similar costs $4500
Only $200 to rent, BTW.

Just wiseacring, but I think I've figured out a way to do it for free. I'm not going to tell you what it is - for one thing, I'm still trying to decide whether it should be regarded as blatant theft. My conscience does allow to tell you that such a way probably exists, however, even though I know you to be a smart guy. Your conscience is your own affair, after all.

If you want to know how to build an atomic bomb, I'd be happy to tell you that. I think it might be easier than the task you have undertaken.
Fex is offline   Reply With Quote
Old 08-07-2020, 12:39 AM   #22
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Quote:
Originally Posted by eq1 View Post

Does anyone know how to find the beginning of a line in a notepad or wordpad or text editor doc (I searched online)? Or, if one actually needs the 4 spaces at the beginning of each line in the RPP? That was the only really painful step, everything else was only 'a few key strokes'. With that I had to add 4 spaces at the beginning of each RPP line, manually, for like 400+ markers, so that's 1600 spacebar presses! If I could 'find' the beginning of each line I could then 'replace' it with 4 spaces - if those spaces are actually needed...
Well, if you're using an editor with a pattern matching facility (I often use notepad++), the caret '^' will match the start of a line.
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 08-07-2020, 05:10 AM   #23
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

Quote:
Originally Posted by Fex View Post
That looks like a very elegant solution. I'm pretty sure that eq1 is intent on seeing his chosen course through to the bitter end, however. I wanna see what happens....
Of course, the "modern" way of doing this with Reaper is probably with stretch markers:

Something like:
Tempo-map.
Place stretch markers at likely looking spots (on measure boundaries)
Discard the tempo map and set a fixed tempo.
Set the grid to measures.
Snap the stretch markers to the grid.
When happy, glue it.

But hey, if the OP has time on their hands - it's a project, right?
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 08-07-2020, 05:29 AM   #24
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Stretch markers, chopping up the audio (the little fades Reaper creates by default are imperceptible) and stretching the individual items, or perhaps a combination of both. Three or four passes.

Tempo and pitch will have varied subtly with every revolution of the capstan as the signal made its way to the tape, and with every revolution of the capstan as the signal made its way to the computer. It really shouldn't matter much, and trying to fix it without prohibitively expensive (for most of us) software is unlikely to yield good results.

Still, OP learned a thing or two along the way.
Fex is offline   Reply With Quote
Old 08-07-2020, 03:47 PM   #25
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

I'm still working with this a bit. It's starting to gel why I've tended to think an automated, mathematically-based process is the way this should be handled. The task falls into the realm of 'not easily perceived' errors: you know errors exist, even if you're not readily able to perceive them - the tempo mapping process shows you that the tempo varies between 83 BPM and 88 BPM (in my case). You know it's supposed to be say 85. You know that will cause pitch variation, along with timing feel. And you know it has to be due to tape speed. You want to 'undo' this seemingly matter-of-fact source of error - if just to analyze the impact speed fluctuations are having on the song...

You take the time to make an accurate tempo map - after which it should be an easy, quick step to convert that tempo map into a playrate adjustment envelope. The question is: Do you want to adjust the grid to fit your audio media, or do you want to adjust your audio to fit the grid? It's really just basic math. Tempo and playrate - they're the same thing, but they're seemingly handled differently in Reaper, where tempo map is 3 decimal precision and playrate is only 2. Yet you can see in those charts I posted what a huge difference just a single decimal place makes.

A playrate adjustment envelope is simply the tempo map inverted: the tempo map shows you that the 'speed' of the audio media goes from say 84 BPM at time 1 to 87 BPM at time 2. When you know that variation is due to a mechanical error - the tape player - you want to compensate for that. You want to increase the play rate at time 1 so the speed of the audio media is played at the overall mean tempo - say 85 BPM. A play rate of "1", i.e. 100%, is the mean tempo, mean tempo divided by tempo marker value is the adjustment - 85/84=1.012, or speed of audio should be played at 101.2% to bring it up to the mean tempo. For the second marker, 87 BPM is a little fast: 85/87=0.977, the audio should be played at 97.7% of the tempo marker value to bring it down to the mean tempo...

But, since Reaper's playrate envelope seems to be only 2 decimal precision, that 97.7% is treated as 98%, that 101.2% is 101%...

I read that 6% difference in speed is a semitone. So, I think the relevant conversion/math to assess how 'bad' things are is like this: the mean tempo here is 85, the min is 83, the max is 88, 88-85=3, 3/85=3.5% -- at worst the pitch in my song is going to be sharp by about 1/2 a semitone. If you go back to that chart I posted of the tempo map data points, you can see the frequency of the largest variations and get a sense of how often/much speed fluctuations are distorting pitch... It'd be worse if one of the slowest points in the audio were followed by one of the fastest, where the change in speed could be perceived as almost a full semitone change in pitch (say going from 83 BPM to 88 BPM).

The thing is, these distortions are hard to perceive. You know they're there, but a lot of the pitches are warbling anyway, simply because I've got warbly stuff going on (like a flanging effect, not very good singing, etc.). BUT, you'd really like to be able to cut-out distortions that are purely 'mechanical'. It's like getting rid of noise - tape speed fluctuations are analogous to tape noise, you just want to press a button and get rid of it, then take it from there...

It seems like something very close to this would be completely possible - if Reaper had at least one more decimal precision in its playrate envelope data...

Last edited by eq1; 08-07-2020 at 05:15 PM.
eq1 is offline   Reply With Quote
Old 08-07-2020, 03:56 PM   #26
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by jrk View Post
Well, if you're using an editor with a pattern matching facility (I often use notepad++), the caret '^' will match the start of a line.
Thanks for the tip. Turned out those 4 spaces at beginning of each line in the RPP don't matter in a functional sense.
eq1 is offline   Reply With Quote
Old 08-08-2020, 12:54 AM   #27
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

There is at least one free tool that claims to tackle (tape) speed issues. Might be worth looking at?

https://github.com/HENDRIX-ZT2/pyaud...ki/pyrespeeder

https://github.com/HENDRIX-ZT2/pyaudiorestoration
__________________
it's meant to sound like that...
jrk is offline   Reply With Quote
Old 08-08-2020, 02:29 PM   #28
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

^ Thanks, I'll check those out...

Meanwhile... I've moved on to some baby steps with 'audio quantizing' with stretch markers. So far pretty horrendous results.

Basically I split my audio item(s) on the tempo map grid, inserted stretch markers, got rid of the tempo map, realigned grid based on mean tempo, snapped markers to that grid. I did this with and without pitch correction. The non-pitch corrected version sounded terrible, warbly pitch. The pitch corrected version just sounded bad, lots of artifacts.

There was a couple other non-stretch marker things I tried before this, like just snapping the split items to the grid, but I have a hard time understanding what exactly I'm doing, how the actions I'm taking are actually manipulating the audio. For example, in one or another case I did something that seemed like it should make the items smaller - because they were to be played faster, but I think the item length just stayed the same, with simply 'more audio material' fitting 'within the item'. I still don't have an iron-clad conception of what an 'item' is, it messes with my head.

A lot of times I'm thinking of an item as a discrete piece of audio, when in fact it's more like a window into audio that itself can be a moving target... There's something very fundamental about the way Reaper conceives of the whole process that I just don't find intuitive at all. I think it has to do with 'items', like items are so fundamental - it's where all the 'power' is - yet I still can't wrap my brain around what they are. It's like, underneath it all I'm manipulating pointers and values in a table, etc., yet the graphical representation makes me think I'm working with something else - like discrete slices of audio...

Anyway, enough of my gripe. Time to forge ahead...
eq1 is offline   Reply With Quote
Old 08-08-2020, 02:36 PM   #29
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Try thinking of an audio item as a slice of tape that can be stretched and shrunk, changing tempo, pitch or both, and which can (if you haven't spilled glue on it) be pulled in a special magick way which reveals what else is on the tape that you cut it from.


I don't suppose there's any chance of you uploading a wav of your recording somewhere so I can have a go?
Fex is offline   Reply With Quote
Old 08-08-2020, 03:18 PM   #30
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
Try thinking of an audio item as a slice of tape that can be stretched and shrunk, changing tempo, pitch or both, and which can (if you haven't spilled glue on it) be pulled in a special magick way which reveals what else is on the tape that you cut it from.
That's a great way to think about it! But, I too often get stuck on the first part - and forget about the 'glue' and the 'magic'.


Quote:
Originally Posted by Fex View Post
I don't suppose there's any chance of you uploading a wav of your recording somewhere so I can have a go?
It's too embarrassing! It's like one of my first 'songs' from 1992, something I just threw together. I've been more or less using it as a 'study' to dig into Reaper, figure out how to use Reaper in all these ways that I've never gotten around to...

OK, here's what should be a link to the 16 or so bars I'm working with in this 'quantize' experimentation. I've only used this Microsoft Onedrive storage thing once maybe a long time ago. I have no clue whether it works, it looks like it should on my end...

There's 4 tracks plus a stereo render of the original, plus an RPP.

https://1drv.ms/u/s!AskciUu3eSuSgQp-...Y6J18?e=aAP0Pw

I'll remove the file once you get it - I don't want such embarrassment floating around!

Note that guitar is out of tune from the rest by about +0.12. 'All the rest' I think is also out of tune from equal temp; it's supposed to have a tonic of D but it's sharp by about 48 cents I think. Also note that the bass half the time is on an 'F' note, while the other stuff is on a 'G', and that can mess with your sense of pitch. There's also weird panning and FX on the backing tracks (the left and right perc. and bass); that makes pitch warbly as well... And vox just sort of drifts around a few notes and isn't very precise. Point is, it's almost impossible to tell what's honestly bad stuff, from what's bad due to fluctuating tape speed.

Oh, one other thing: there's FX installed in the project that are holdovers from an earlier iteration, so they won't quite work in this one. And I had the left and right tracks sent to a stereo one earlier, but I deleted that here. I was just using this project with completely dry, original digitizations of the tape tracks.

Last edited by eq1; 08-08-2020 at 04:00 PM.
eq1 is offline   Reply With Quote
Old 08-08-2020, 03:54 PM   #31
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
I'll remove the file once you get it - I don't want such embarrassment floating around!
Thanks, got it. Now I'm gonna make some coffee, and see what I've got.
Fex is offline   Reply With Quote
Old 08-08-2020, 04:02 PM   #32
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

^ OK, Fex. Thanks.
eq1 is offline   Reply With Quote
Old 08-08-2020, 04:32 PM   #33
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

I've experimented a little - not much, obviously, it's only been a few minutes - but I've heard enough to know that I don't want to mess about with it any more. I think it's rather charming as it is.

I have an observation which I hope might be of use.

I'm fairly sure that the whole thing would have been recorded to concert pitch, because, if nothing else, the Korg synth-bass would surely have been at concert pitch. You wouldn't de-tune a synth to fit with a guitar that wasn't in concert pitch, would you?

Well, it's a long way from concert pitch now. The parts are all in tune with each other, of course.... but A is a long, long way from 440Hz.

That's surely got to be a massive pointer in the direction of the original tempo?

Last edited by Fex; 08-08-2020 at 04:40 PM. Reason: Pointy things.
Fex is offline   Reply With Quote
Old 08-08-2020, 06:10 PM   #34
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

^ Yeah, you'd think that's what I would have done - but no. I recall at some later date (post-1992) realizing that the Korg was detuned - I guess it would have been that +48 cents I mentioned earlier. And then I probably tuned the guitar based on something else - so the guitar is out of tune with the Korg... And on top of all this is the speed of the tape player - recording in 1992 and then digitizing some 28 years later...

At this point the guitar can be tuned to the Korg by dropping it about 12 cents. And then the entire thing is still sharp by some amount, can't remember how much. Since the original tempo is 86 BPM (as I've come to realize), yet the mean tempo now is like 85.832, the pitch now is lower than it would have been originally, I guess that would be 85.832/86, or about 1/6 of a semitone, or about 17 cents**... Sooo, if you add it all up, and my memory of the Korg being +48 cents is correct, the digitization now should be 48 minus 17 = 31 cents sharp from 'concert pitch' -- plus or minus the amount it fluctuates due to the speed fluctuations, that is.

** This isn't correct. 85.832/86=0.998, or 99.8% - only a -0.2% difference, not a 1% difference. I think I glanced at my calculator and thought the "8" in 0.998 was a zero. So the difference in pitch on average caused by the overall slowness of the tape player is miniscule. 6% change in speed is about a semitone, 1% 1/6 of a semitone, or about 17 cents, so 0.2% should be only about 3.4 cents.

Last edited by eq1; 08-08-2020 at 06:45 PM.
eq1 is offline   Reply With Quote
Old 08-08-2020, 06:32 PM   #35
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Always, always, always tune your instrument!

If that synth had been in tune, my approach would be:

# Grab an instrument known to be tuned to concert pitch - tuned by ear, not by maths - an instrument I can put my hands on, outside the box (outside Reaper, outside the PC). For me, that would be a steel strung acoustic guitar.

# Play along with the soloed synth track, adjusting the Playback rate on Reaper's transport bar until the synth sounded in tune with the acoustic guitar.

# Check the result by playing along with the recorded vox and guitar unmuted.

I would then return the Playback rate to 1.0, set the project tempo to 86 BPM, select all items, change all item playrates to the previous project Playback rate, and timestretch to place transients somewhere close to the grid.

The difference between 86BPM-IRL and 86BPM-per-the-clock-on-the-machine-that-made-the-click-when-recording would be trivial.

The difference between my perceived pitch and pitch-per-the-synth would be trivial.

So that would work, I think. It would negate the tape speed factor.

So, you could pitch all items -48 cents, and then do all that.

But actually, I believe that 48 cents is very, very close to the difference between the recorded pitch and concert pitch anyway.

I think the tape speed factor is trivial, my friend. There's certainly nothing very much wrong with the audio quality.

I'm gonna have another look at this....

Last edited by Fex; 08-08-2020 at 07:05 PM.
Fex is offline   Reply With Quote
Old 08-08-2020, 06:58 PM   #36
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
^ Yeah, you'd think that's what I would have done - but no. I recall at some later date (post-1992) realizing that the Korg was detuned - I guess it would have been that +48 cents I mentioned earlier.
+54

A playrate of -0.54 brings everything very close to concert pitch, the natural pitch fluctuations of vox & guitar notwithstanding.

The whole 17 bar snippet is nicely aligned with the metronome, and stretches neatly to 86 BPM without stretch markers.

Job done?

Last edited by Fex; 08-08-2020 at 07:03 PM.
Fex is offline   Reply With Quote
Old 08-08-2020, 07:23 PM   #37
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

I just tuned all vox pitch centres to 100%, flattened pitch drift in the "do" following "smile" by 40%, and moved the following "do" down by a semitone. It's perfect now. If that's you singing, you'll never agree, but it is. Let me know if you want to hear it.
Fex is offline   Reply With Quote
Old 08-08-2020, 07:28 PM   #38
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
+54

A playrate of -0.54 brings everything very close to concert pitch, the natural pitch fluctuations of vox & guitar notwithstanding.

The whole 17 bar snippet is nicely aligned with the metronome, and stretches neatly to 86 BPM without stretch markers. Job done?

hmm, I'm not too concerned with the overall pitch, as long as different instruments are in tune with each other (and don't artificially fluctuate in eggregious ways). But I'll try what you did...

I tried something that seems to work, at least for this section. I calculated the length that this 17 bar item should be were the tempo 86 BPM, added stretch markers at the ends, and then shrank it to that length. I'll have to A/B compare the result to the 'original' file to be able to tell sound-quality wise. But in general it seems like if I do this with other sections I should be able to have a single tempo, have beats aligning with the grid, and be able to edit different parts of the timeline without too much fuss...
eq1 is offline   Reply With Quote
Old 08-08-2020, 07:36 PM   #39
eq1
Human being with feelings
 
Join Date: Sep 2011
Location: PNW, USA
Posts: 658
Default

Quote:
Originally Posted by Fex View Post
I just tuned all vox pitch centres to 100%, flattened pitch drift in the "do" following "smile" by 40%, and moved the following "do" down by a semitone. It's perfect now. If that's you singing, you'll never agree, but it is. Let me know if you want to hear it.
Sure, I'll listen. Let me know how to get the file...

I don't care too much about my bad singing, or bad guitar playing, though. I think for the most part I'm trying to walk a line between preserving the original as best I can, but also improving the 'audio engineering' as much as I can, however long I can stand to work on this song - as I learn Reaper. Lots of objectives here... Like I might tweak the vocals like you have, but it'd be for learning not because I care that the pitch drifts here and there... I don't know, it's fine line...
eq1 is offline   Reply With Quote
Old 08-08-2020, 08:02 PM   #40
Fex
Human being with feelings
 
Fex's Avatar
 
Join Date: Dec 2011
Location: Portsmouth, UK
Posts: 4,376
Default

Quote:
Originally Posted by eq1 View Post
Sure, I'll listen. Let me know how to get the file...
I'll have to think about this. I think I have a dropbox I haven't used for about five years.
Quote:
Originally Posted by eq1 View Post
I don't care too much about my bad singing, or bad guitar playing, though.
They're not bad. Not in the part I've heard, anyway. Natural pitch fluctuations would be a good thing in this context.
Quote:
Originally Posted by eq1 View Post
I think for the most part I'm trying to walk a line between preserving the original as best I can, but also improving the 'audio engineering' as much as I can, however long I can stand to work on this song - as I learn Reaper. Lots of objectives here... Like I might tweak the vocals like you have, but it'd be for learning not because I care that the pitch drifts here and there... I don't know, it's fine line...
Well, you can have several versions of a thing. On the one hand, you should keep a copy which sounds close to the way it did when you recorded it. On the other hand, I've got a fuzzbox, and I'm going to use it.


(I'm not even joking, BTW - that guitar sounds awesome through an overdriven valve amp sim. YMMV.)
Fex is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.