Jump to content

Loop Audio Sample And Affect Pitch In Chops


mark

Recommended Posts

this is a chops question but let me outline the situation.. im trying to animate a motorbike idling. i have a slider in the motorbike HDA lets call it $engine_revs which controls 2 things: the amount the bike shakes, and the emissions from the exhaust (particles). by multiplying the particle emissions and bike shaking amounts by the $engine_revs it affects their output. if $engine_revs is high then the shaking and exhaust emissions are high. most importantly if the revs are 0 then the exhaust and shaking are therefore also zero (because they get multiplied).

i dont know if this is well rigged (its using expressions outside chops) but it look like it will do the job.

im trying to now do the same thing with a loopable sound sample - about 1 second of an engine idling. as the $engine_revs increase i want the speed/pitch of the sound to also change.. and again if $engine_revs is zero then no sound.

ive imported the sound sample into chops with a file chop and imported the $engine_rev channel with a fetch chop.

and now ive hit the wall...... :wacko:

ive been trying the cycle chop like the help says but i just get the screwed up result like below - i cant replicate the results of the tutorial in the help either (below is using the same settings)

... any ideas pls, am i on the right track?

chops.png

Link to comment
Share on other sites

hey mark,

seems like you're on the right track.. don't know what problems you might be having with the cycle chop, but it should work fine... i wouldn't worry about any cycles before, since i'm assuming the audio file begins at frame 1.. just continue the cycle afterwards for how ever long you want the thing to play out..default settings should work..

now as far as pitch changing.. you can change the pitch or adjust sound properties with the parametric eq chop (there are others, but you will get most level of control in there).. there's even a pitch tab with a very easy octave parameter if you want to keep it simple.. however, whether you export another chop to it, reference another channel, or simply animate it, you won't hear the sound reacting in realtime. it seems that it can only playback a single unanimated value.. but the generated channels should still be good and useful..

but i don't think that's gonna work for you since the whole point of this is to get some audio feedback while things are doing what they do.. so my suggestion is to use a warp chop. append it after your cycle and put your fetched rev channel in to the second input. since this is effectively compressing and stretching the audio wave, you will get pitch alteration as well.

here's a quick example i whipped up:

chop_pitch_ramp.zip

couple things to make sure of:

-turn on the audio in your audio panel and set it to time line.

-if this is being tried out on linux, you will prob need to convert the .wav file to .aif first.. atleast that's the way it was back in H6 (last time i did audio driven works in houdini..)

sounds like a fun project, would love to see some results after you're done.. B)

Link to comment
Share on other sites

The first thing you'll want to do is make your sound clip smoothly loop if it isn't already (if it is, skip ahead to step 4).

1) Make sure any silence is trimmed out first - you'll want a sample with fairly constant pitch and volume (even if it's short, the cycle will fix that). Use a Trim CHOP to clip out a good sample.

2) Use a Cycle CHOP to make the sample loop smoothly. 'Blend Start to End' is enabled by default, which is what you'll want to remove the 'click' you'd get when cycling it. On the Blend page, adjust the 'Region' parameter to specify how much of a blend overlap to use (by default it's 1 second, which is a tad too long for your purpose - try 0.1). Leave the both Cycle parms at zero.

3) Next, append an Extend CHOP to set the start and end extend behaviour. Set the Left and Right Behaviours to 'Cycle'. This will allow you to sample the sound at any time, regardless of the frame range of the sample.

4) Now, to alter the pitch, use an Oscillator CHOP. The curve that determines the pitch goes into input #1 (your engine revs), and your looped sound sample goes into input #3. The curve is interpreted as follows: 0 doesn't affect the pitch - normal playback. For every 1 unit above zero, the pitch is increased by an octave by playing the sample back faster. For every 1 unit below zero, the pitch is reduced in the same manner. You will likely need to use math CHOP(s) to scale and shift your curve so that it works with the oscillator. For example, you might want to have idle be a low rumble, so you would map engine_revs = 0 to -2.

5) You can alter the volume of the output of the oscillator in a similar manner, by using a Math CHOP to multiply the control curve by the sound output of the oscillator (two inputs, the control channel & the sound channel, Combine CHOPs = multiply). This will attenuate the volume based on your engine revs. Again, you'll need to massage the control curve into a range that sounds good (maybe 0.3 for idle, and 1 for max revs). Don't go too much ouside -0.9 to 0.9, otherwise your audio will clip and you'll get distortion.

That should give you the basics. You can use a noise CHOP to give your engine a bit of variation (especially on the volume part), and add some lower harmonics into the sound by using another oscillator, but with a scaled down control channel, and adding it into the mix (another Math CHOP, your 2 sound channels as inputs, Combine CHOPs = add).

You can also use the Parametric EQ to add echoes to the sound and make it sound a little more 'spatial' (Echo Tab, disable the 'Filter Channels' parm on the Filter page first and enable 'Add Echoes'). Play around with the echo parms to get some neat effects.

Hope that helps!

Link to comment
Share on other sites

heya dave and malexander

ive got the effect i wanted - so thanks a lot you two - great answers.

clearly i need to work on it to refine the sound but it sounds at least something like an engine revving!! i may even need to source a better initial sample. either way ill probably have some followup questions as i explore this further :)

so once you are happy with your audio channel i imagine you export the audio from chops (to .wav - how?) and then just mix it into your final animation?

imagine having to do this in a completey seperate app... uggh ! i think im going to like chops.

the problem with the cycle chop was that some clown left 4 seconds of silence on the end of the sample :whistling: dunno who that could have been! the trim chop helped there.

oh and i noticed from older posts there was a problem with .wav on linux... seems to be ok now (suse 10).

hopefully ill be posting the results soon :)

cheers

mark

:)

Link to comment
Share on other sites

For a little more sound realism in your animation, if your camera and/or motorcycle is moving, you could use the Spatial Audio system to do 3D positional audio. This will give you volume attentuation, doppler effect, stereo bi-aural difference (with 2 mics), echoes and sound occlusions. After all, you're working in a 3D app, right? To set it up:

1) Add a Sound object to your motorcycle, around where the engine is. Make it omni-directional. In the Sound folder, select the CHOP to use as your sound source (the finished sound from above).

2) Add two microphone objects, and parent each to the Camera you're shooting out of. Make them directional, and point them out of the sides of the camera like ears (aimed slightly forward, but otherwise pointed left and right).

3) In CHOPs, add a Spatial Audio CHOP. Select 'sound1' as your Sound Source (you can have more than one), and 'microphone1' and 'microphone2' as your Microphones (one channel is rendered for each mic).

The result automatically gives you directional stereo, the doppler effect, realistic lag due to distance and distance-based volume attenuation. You can also add echo objects (objects which reflect the sound) and occlusion objects (objects which block the sound). Each of these objects requires a sound material (Shading tab, Sound page), which is a reference to an Acoustic CHOP which defines the spectral absorbtion, reflection and transmission of sound (see Acoustic CHOP help). You can also apply filters to Microphones, that run the audio through a curve-based band filter before recording (using an Acoustic CHOP).

For more detailed information, search for 'Spatial Audio' in the H8 docs.

Link to comment
Share on other sites

thanks malexander, it gets pretty detailed. ive been experimenting some more and am keen to try these ideas.

something i am stuck on again -- what should i do to get the audio out of chops? do you export to a sound file then 'composite' the anim and sound in virtualdub or something similar?

thanks :)

Link to comment
Share on other sites

you export the audio out of chops just like you would export any animation channel: right click on chop->save data channels.. choose .wav or .aif as the format and that should be it..

as far as putting it back to your video, i would assume any video editing prog will take care of that..

Link to comment
Share on other sites

thanks deecue. dunno how i missed that.

im realising i have a lot to learn with animation. mostly because my computers have always been too slow to even bother, and a lack of projects ready for animation hasnt helped ;)

cheers!

mark

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...