# "Resize to content length" not working properly

**URL:** <https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014>\
**Category:** FMOD Studio\
**Created:** [April 9, 2021, 5:03pm UTC](https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014 "2021-04-09T17:03:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![osome](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@osome](https://qa.fmod.com/u/osome)\
**Post date:** [April 9, 2021, 5:03pm UTC](https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014/1 "2021-04-09T17:03:15Z")

</div>

Hi, I use FMod Studio 2.01.06

I have a lot of very simple events, only containing voices.  
Thousand of voice events.

As voices are placeholder, they are recorded again and again, because of text changes.  
And in this case, event size do not fit to the WAV containing the voice. There is a blank at the end, or sound is trimmed.

Moreover, even if it’s not a good solution (because I have to select evey sing event to do so), I tried to use “Resize to content lenth”, but this does not do anything.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/6/6fc0cf3e0ed031db275709676574b56aae17221d.png)

So the only solution I see is to open each event and try to reajust event size to the WAV size, thousands of times…  
Best would be to multi-select them in the events view \> right click \> adjust content…

note : I cannot delete and recreate all events because I need their GUID unchanged in the engine.

Any idea ?  
Thanks !

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [April 9, 2021, 6:17pm UTC](https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014/2 "2021-04-09T18:17:29Z")

</div>

Hi!  
I’m not sure to fully understand. You have to deal with already created events but have to change the source audio files afterwards, which don’t fit the length of the original files, isn’t it? Why didn’t you think of using async instruments in the first place, if it was planned that the source files could be changed?  
Anyway, for this kind of things, implementing a script could help…

---

<div class="post-metadata">

**Author:** ![osome](https://avatars.discourse-cdn.com/v4/letter/o/ee59a6/32.png) [@osome](https://qa.fmod.com/u/osome)\
**Post date:** [April 9, 2021, 7:45pm UTC](https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014/3 "2021-04-09T19:45:38Z")

</div>

Yes, you got it.  
I need to have the event length in the engine afterwards, so simple event is the best.

I found solution using script 🙂

```
studio.menu.addMenuItem({
    name: "FMOD Examples\\Match Content Length",
    isEnabled: function() { return studio.window.browserSelection().length; },
    execute: function() {
		
		previewStr = "";
		studio.window.browserSelection().forEach(function(item) {
			if(item.isOfExactType("Event"))
			{
				var event = item;
				if(event.timeline.modules.length == 1)
				{
					//event.timeline.modules[0].dump();
					if(event.timeline.modules[0].length != event.timeline.modules[0].audioFile.length)
					{
						previewStr += "FIX " + item.name + ":" + event.timeline.modules[0].length + ">>" + event.timeline.modules[0].audioFile.length + "\n";
						event.timeline.modules[0].length = event.timeline.modules[0].audioFile.length;
					}
				}
			}
		});
		
		if(previewStr != "")
		{
			alert(previewStr);
		}
	}
});
```

---

<div class="post-metadata">

**Author:** ![CalumRobb](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@CalumRobb](https://qa.fmod.com/u/CalumRobb)\
**Post date:** [July 10, 2024, 11:51am UTC](https://qa.fmod.com/t/resize-to-content-length-not-working-properly/17014/4 "2024-07-10T11:51:27Z")

</div>

Amazing, this has just saved me hours! X
