Video and audio?

Little Bear's icon

I don't know what forum to put this under. I am kinda new to Max MSP Jitter. I am trying to get into video scrubbing. I was wondering if there is an easy way to control treble, and bass levels coming out of a jit.qt object that is play an .mp4, also lets say there is music being played by two jit.qt's how would someone go about creating a beat matcher for the audio outputs.

Rob Ramirez's icon

Quote: Little Bear wrote on Thu, 01 May 2008 18:12
----------------------------------------------------
> I don't know what forum to put this under. I am kinda new to Max MSP Jitter. I am trying to get into video scrubbing. I was wondering if there is an easy way to control treble, and bass levels coming out of a jit.qt object that is play an .mp4,

look at the spigot~ object (assuming it's working on your platform and max version). otherwise, extract the audio as an aif or wav, and load it in a buffer controlled by a groove~ object. fairly trivial to sink a qt.movie to the right output of groove~.
then send this output (either spigot~ or groove~) to an fffb~ object.

> also lets say there is music being played by two jit.qt's how would someone go about creating a beat matcher for the audio outputs.

not sure what you mean here. please be more specific. you mean two movies, each with their own soundtrack (music videos), and you want an automatic way to sync their bpm? there's no automatic way to do that in msp, and it would be very complicated for a beginner to implement something.

maybe others have more suggestions.

Little Bear's icon

Thank you for the reply.

I don't necessarily want to make them match automatically. I simply need a way to determine the beats per minute from the video file. Is there an external object that I can stick into the spigot~ object that will give me the bpm?

Rob Ramirez's icon

> Is there an external object that I can stick into the spigot~ object that will give me the bpm?
----------------------------------------------------

nope.
requires spectral analysis and some math, and probably heuristics to get it to really function.
take a look at the cnmat externals, if you're up to the challenge.
http://cnmat.berkeley.edu/downloads

better off creating your own tap tempo mechanism (bang -> timer -> !/60000, probably throw in some averaging math as well).

if you're just dealing with loops, then it's much easier to get the bpm upon loading the file.

Mattijs's icon

Quote: Little Bear wrote on Fri, 02 May 2008 02:12
----------------------------------------------------
> I don't know what forum to put this under. I am kinda new to Max MSP Jitter. I am trying to get into video scrubbing. I was wondering if there is an easy way to control treble, and bass levels coming out of a jit.qt object that is play an .mp4, also lets say there is music being played by two jit.qt's how would someone go about creating a beat matcher for the audio outputs.
>
>
----------------------------------------------------

I always advize people to load the audio of a movie separately into a buffer~ and use msp to control the playback of jit.qt.movie instead of using spigot~.

Since this request comes up a lot on the forum, I decided to make a template that shows what I believe is the optimal way to use msp together with a quicktime movie.

I attached it. If you have any questions, please let me know.

Best,
Mattijs

Little Bear's icon

What is the advantage of using the buffer? I cannot see the video, I can only hear the audio?

bryanteoh's icon

While jitter is equipped to mess with audio, it is much easier and more
efficient(?) to mess with the audio in msp. I think the idea is to use
jitter to play back the movie, but load the aiff from the video into the
buffer, and to use the phasor output of [groove~] to control the video
playback of the [jit.qt.movie] object. This way both video and audio will
be playing and you'll be able to manipulate the audio without having to
capture it from the movie file first.
Beat detection seems difficult. I have a friend who figures out the bpm
(and sometimes key center) of samples beforehand, and labels them with the
info. When he loads them into his patches, the information is parsed out
from the file name and the appropriate adjustments are made. Perhaps
something like that would make beat matching videos easier?

On Sat, May 3, 2008 at 2:59 AM, Miles wrote:

>
> What is the advantage of using the buffer? I cannot see the video, I can
> only hear the audio?
>

Little Bear's icon

Ahh... Right now I have a patch that can loop video through an rslider. So is groove~ the way I can set up that feature? Sorry for all the questions, jitter seems to make more sense to me. I am trying to mix two videos together while being able to control the audio. So the most effective way would be to have two jitter object go through two buffers that controls the rate, and volume of both the music and the video. By doing this I can control different variables of the sound, I could use a groove~ that would change the music loop, which changes the video loop? Then finally have an out put of both jitter objects that go through video fadersRGB and other bells and whistles to control the visual?

Ha. The only part that I seem to have control over is the beat. I came up with a solution for the BPM.

Mattijs's icon

Quote: Little Bear wrote on Sat, 03 May 2008 08:59
----------------------------------------------------
> What is the advantage of using the buffer? I cannot see the video, I can only hear the audio?
----------------------------------------------------

Hmm, maybe this general solution is a bit over your heads for now, sorry for that. When you start building more complex programs with audio and video processing you'll see what I mean. I'll try to put this template online somewhere.

Best,
Mattijs

Little Bear's icon

I think I am slowly getting the hang of it.

Are there any tutorials I can read to help me understand it a better, other than the ones on Max? I have been messing with your patch and I was able to put in looping via groove~, the only problem is that when I do this function it speeds up the video instead of looping it with the sound. Any ideas?

Mattijs's icon

Quote: Little Bear wrote on Sun, 04 May 2008 01:26
----------------------------------------------------
> I think I am slowly getting the hang of it.
>
> Are there any tutorials I can read to help me understand it a better, other than the ones on Max? I have been messing with your patch and I was able to put in looping via groove~, the only problem is that when I do this function it speeds up the video instead of looping it with the sound. Any ideas?
----------------------------------------------------

Did you do all the max and msp tutorials yet? I think those are a very good starting point.

In my patch it shouldn't be necessary to replace anything inside the subpatchers. Just load one video, enable dsp and then it starts a looped playback with the audio and video coming out of separate outlets.

Probably, you won't need the second copy of the playback subpatcher. It's merely there to demonstrate that you can have the same video playing back multiple times (at different rates) without loading it twice.

If you change the speed of a playback subpatcher, both the audio and the video will speed up, which is expected, I assume?

Mattijs

Little Bear's icon

Quote: Mattijs wrote on Sun, 04 May 2008 04:47
----------------------------------------------------

> In my patch it shouldn't be necessary to replace anything inside the subpatchers. Just load one video, enable dsp and then it starts a looped playback with the audio and video coming out of separate outlets.

The question is how do I control the size of the looped playback? I want to be able to only loop certain sections of the audiovideo. I added a groove~ in the patch, and it looped the audio in places I wanted but the video rate speeded up, instead of playing the 'corresponding' video frames. I am guessing I either added the groove~ in the wrong place, or have to put a groove~ for the audio and a getlooppoints for the video that are synced?

Quote: Mattijs wrote on Sun, 04 May 2008 04:47
----------------------------------------------------
> Probably, you won't need the second copy of the playback subpatcher. It's merely there to demonstrate that you can have the same video playing back multiple times (at different rates) without loading it twice.

Yeah I noticed that, and it is a very nice demonstration.

Quote: Mattijs wrote on Sun, 04 May 2008 04:47
----------------------------------------------------
> If you change the speed of a playback subpatcher, both the audio and the video will speed up, which is expected, I assume?

Yeah that is expected.

Mattijs's icon

Quote: Little Bear wrote on Sun, 04 May 2008 23:09
----------------------------------------------------
> Quote: Mattijs wrote on Sun, 04 May 2008 04:47
> ----------------------------------------------------
>
> > In my patch it shouldn't be necessary to replace anything inside the subpatchers. Just load one video, enable dsp and then it starts a looped playback with the audio and video coming out of separate outlets.
>
>
>
> The question is how do I control the size of the looped playback? I want to be able to only loop certain sections of the audiovideo. I added a groove~ in the patch, and it looped the audio in places I wanted but the video rate speeded up, instead of playing the 'corresponding' video frames. I am guessing I either added the groove~ in the wrong place, or have to put a groove~ for the audio and a getlooppoints for the video that are synced?
>

This is really a matter of a bit of math. The phasor ramps from 0 to 1, which corresponds to the beginning and end of the sample. If you need it to ramp between different points, you'll have to multiply the output of the phasor with a value (between 0 and 1) and add an offset (between 0 and 1). I don't advise using groove since it has no high quality interpolation mode.

I'm sorry that I don't have time to explain this in more detail, maybe one day I'll make a patch that includes looping, time stretching, beat matching and everything ;) Until then I am afraid you'll need to figure this one out for yourself..

Best,
Mattijs

Little Bear's icon

If you did that then I would not have anything to do!

I finally figured it out, thank you for your help.

If you care:

I created an rslider between 0 and 100. I am having the [high value - low value] * .01 then I connected that to the phasor. Also having the [low value] * -.01 patching into an off set. All while having another function taking the delta and generating the correct playback rate so it plays at 'actual speed'.

Thank you all for the help! I am sure I will be back soon posting more annoying questions.

Adrian Grist's icon

Sorry to resurrect an old thread, but MATTIJS do you still have the template for this?

Thanks

phiol's icon

Hi Adrian

here is your patch in Max7.
It demonstrates how to use MSP's groove~ to drive your videoplayer position.

if you open max in 32bit mode, you'll be able to read the .mov file directly into buffer~.
If not , you'll have to export/extract the sound from your moviefile. I use quicktime 7 to do so.
(if you don't have , I suggest you download it it's free) if you get the pro version you can also use it to create hap codecs.

Max Patch
Copy patch and select New From Clipboard in Max.

here is the patch (edit, I had a little wiring mistake in the previous one I posted)

Doug MeatLoaf's icon

@PHIOL --> Thanks a lot for your patch! It really helped me.

I have a question though.
The way you have build your patch, when we move the Out point in the Waveform~ object with my mouse, the loop start from the beginning with each new values it receives. For my purpose, I need the playhead to continue it's course while I edit the End point. So to achieve this, I disconnected the Startloop message going from the Waveform~ to Groove~. Once this cord is unconnected, the player acts as I want to.

But then, something is annoying me and I cant understand how to get rid off : when again I'm moving the End point with my mouse while the video is playing, it creates some random images artifacts (I dont know how to exactly call it). I joined the patch I modified so you could see what I'm talking about.

Max Patch
Copy patch and select New From Clipboard in Max.

My question: Is there a way to being able to play with both In/Out point in the Wabeform~ object without affecting the way the video is being rendered? Hope my explantion are clear.
Thanks you very much for your help since this issue is a little bit over my comprehension.

phiol's icon

Hi Doug

does the orange change 0. solved your problem ?
Prevents it from retriggering when you move the end playhead position :-)

Help this helps

Max Patch
Copy patch and select New From Clipboard in Max.

phiol

Doug MeatLoaf's icon

Thanks again Phiol for your help.
It seems to make no difference.
If I move slowly the end playhead position, with or without the orange change 0., the video runs smoothly.
But if I move a bit too fast the end playhead position, the video starts acting a bit erratically.
Does the problem occur on your side?
Best, Doug.

phiol's icon

My pleasure !

All is good here

Mac late 2014
processor 2.8gHz Core i 7
16g ram
Graphics NVIDIA GeForce GT 750M 2048 MB

---
Have you tried with overdrive on and off ?
make sure you're running in 32 bit mode for qt time movie to load sound..

What file type are you running
Jitter runs best with proRes 422

If not Hap might be your best bet

Doug MeatLoaf's icon

I'm using Photo Jpeg as file type.
I was able to solve the problem by using OpenGl rendering.
Every thing runs smoothly since.
I haven't tried using proRes 422 codec yet.
Again, thanks for your support Phiol.