How to use Clip Effects?


#1

The following is not working, I just get silent audio :

if (clip->canHaveEffects())
			{
				clip->enableEffects(true, false);
				te::ClipEffect::createEffectAndAddToValueTree(edit, clip->state, te::ClipEffect::EffectType::reverse, 0);
				
				
			}
			else
				Logger::writeToLog("Can't have clip effect");

#2

Note: Clip effects work with Audio clips, but not MIDI clips or Step clips.

From the manual, how do you have your clip setup?

Edit; NM I see you are trying to use audio.


#3

It’s a clip playing an audio file.


#4

Let me know if you get it, I will do the same.


#5

I think the effect needs to be added to the EFFECTS node which is a child of the AUDIOCLIP called and added by the enableEffects call (see AudioClipBase::enableEffects) then do:

clip->enableEffects (true, false);
ClipEffect::createEffectAndAddToValueTree (clip->edit, clip->state.getChildWithName (IDs::EFFECTS),
                                           te::ClipEffect::EffectType::reverse, -1);

#6

OK, it worked for the reverse effect but for example the stepVolume processing isn’t working. Maybe I need to set some parameters for it, but the edit’s XML seems to have sensible looking default things anyway…?

<EFFECTS>

<EFFECT type=“stepVolume” noteLength=“0.25” crossfadeLength="0.01000000000000000021"

pattern=“1010101010101”/>

</EFFECTS>


#7

Looks ok to me.
I’d have to see the use case to know more.

Maybe step in to the rendering to see if the file is being created correctly? Maybe it’s getting a zero length from somewhere?


#8

I am still doing this with the PitchAndTimeDemo code.


#9

I just tried this out and it seems to render correctly. The audio is correctly gated (sounds like a very low frequency tremolo).


#10

OK, very odd. It is now working here too…I did manually clean up the temporary files folder before retesting, though…


#11

It looks like this call in the destructor of the demo component is maybe not working, then?

edit.getTempDirectory (false).deleteRecursively();

#12

Works for me on the Mac.

Are you on Windows? It might be that if the Edit is still playing it has open file handles and Windows doesn’t seem to like that. If you clear the thumbnail and call transport.freePlaybackContext(); before deleting the files does it work?

Also, maybe try checking the return value of edit.getTempDirectory (false).deleteRecursively();?


#13

thumbnail.setFile({});
transport.freePlaybackContext();

Is not enough to allow the temp files deleting to succeed. And yes, this is on Windows.


#14

Try engine.getAudioFileFormatManager().releaseAllFiles();?


#15

This seems to work :

engine.getAudioFileManager().releaseAllFiles();

No releaseAllFiles method in AudioFileFormatManager. :wink:


#16

Ah that’s what I meant. Glad that works.
I’ll try and update that and add some assertions.


#17

@dave96 How can I ensure the thumbnail image gets updated when using the Clip Effects? Calling

thumbnail.setFile(EngineHelpers::loopAroundClip(*clip)->getPlaybackFile());

immediately, or even with a slight delay, after enabling and setting the Clip Effects does not work. Is there some kind of a notification system, or should I set some render progress variable somewhere or …?

I am implementing my own Clip Effect type, so I’ve probably made some mistake somewhere but the Tracktion Engine provided Clip Effects fail to update the thumbnail sometimes too…This is still in the context of the PitchAndTimeDemo.

edit : actually, setting the thumbnail file after a long enough delay with a timer seems to work. But shouldn’t this work a bit more automatically, after all, the Clip Effect renders can take quite a variable amount of time to finish?


#18

I think if you register as a SelectableListener, you’ll get a void selectableObjectChanged (Selectable*) callback when the source file changes. In here you can get the playbackFile and set the thumbnail to it?


#19

OK, that kind of works but I get a bit too many calls into the selectableObjectChanged method. I get glitchy playback because setting the thumbnail file also seeks the playback or something…


#20

I don’t think it should do any seeking if you’re just using the demo code.
Are you doing just

thumbnail.setFile (clip->getPlaybackFile());

without the loopAroundClip bit?