Audio animation bug (fcurves) #43853

Closed
opened 2015-03-02 00:23:36 +01:00 by Campbell Barton · 12 comments

FCurves fail on mixdown sequencer audio.

The attached file has 2 sequencer channels alternating

[noise/tone/noise/tone/noise] - each ~40 frames.
Where the tone is a single strip using an fcurve to fade out during the second noise strip.

Currently there is a bug. Open this file and play the sound, it works as expected.

But when the audio is mixed down, frames (41 -> 78) contain silence (out.wav in attached file)
Strangely however the second half of TONE strip does play.

This bug happens even when the accuracy value is set to 1.

Note that the first NOISE strip also has an FCurve, and this works correctly (without initial silence).

mixdown_bug.zip

FCurves fail on mixdown sequencer audio. The attached file has 2 sequencer channels alternating `[noise/tone/noise/tone/noise]` - each ~40 frames. Where the **tone** is a single strip using an fcurve to fade out during the second noise strip. Currently there is a bug. Open this file and play the sound, it works as expected. But when the audio is mixed down, frames (41 -> 78) contain silence (`out.wav` in attached file) Strangely however the second half of `TONE` strip does play. This bug happens even when the *accuracy* value is set to `1`. Note that the first `NOISE` strip also has an FCurve, and this works correctly (without initial silence). [mixdown_bug.zip](https://archive.blender.org/developer/F146615/mixdown_bug.zip)
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Joerg Mueller was assigned by Campbell Barton 2015-03-02 00:23:36 +01:00
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

#44902 was marked as duplicate of this issue

#44902 was marked as duplicate of this issue
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Joerg Mueller changed title from Audio mixdown bug (fcurves) to Audio animation bug (fcurves) 2015-03-08 06:04:11 +01:00
Member

Hi,

I had a look at the file and started debugging. The bug is not related to mixdown. When you open the test file and playback playback sounds fine the very first time, but if you keep it running it will have the same bug in following runs.

Debugging I found the problem is specific to this case in the way that in anim_sys.c:1551 properties are updated only when the value changes. The audio system has a cache of the animation values that is empty at the beginning. As it is empty, the sound has a default volume of 1.0 in the beginning, so during first playback it is fine.

Now when the animation is played back the first time it never sets the volume property of the animated sound until it reaches the frame where it jumps to 0. Here the if in anim_sys.c:1551 passes and as a result the audio animation system cache gets the info that on frame 80, the volume is now 0. As the buffer was empty before it creates a new one with 81 frames (starting at 0), filling all of them with 0, as it didn't know the value before, but marks the first 80 as unknown, so it looks like this:

000...0000
UUU...UUUK

(U is unkown, K is known)

Now it stays 0 until frame 111 when it jumps back to 1 and the anim_sys.c:1551 line triggers a write to the cache again. The frames 81 to 110 are unkown again and as the previous value has been 0, this 0 gets copied up to 110.

000...0000000...0001
UUU...UUUKUUU...UUUK

Until frame 181 it stays at 1 and thus the cache never gets updated again. Now when it jumps back to frame 1, there is again no difference according to anim_sys.c:1551 and we get only the same two updates we had during the first playback. As the buffer exists now and has been initialized with 0, the strip doesn't play in the beginning though.

Now if the playback is between frame 80 and 110, so while the value is 0 and you now seek to X, which is somewhere between the 0 and 79, you get an update through anim_sys.c:1551 as 0 and 1 are different and it writes a 1 to X and updates the unknown values behind that, making it look like this:

000...0001111...1110000...0001
UUU...UUUKUUU...UUUKUUU...UUUK

If you play back then, you'll hear that from that frame X you seeked to on it will be correct.

It all comes from the policy how unknown animation cache is initialized. The attached patch.diff changes the policy to use the default value for the beginning of the buffer instead of the first written value and thus fixes the bug. I hope that it doesn't introduce any other bug though.

Can you test this Campbell and maybe add your comments. If it's ok I'll commit the bug fix after release or if you think it's ok during bcon 4 still.

Hi, I had a look at the file and started debugging. The bug is not related to mixdown. When you open the test file and playback playback sounds fine the very first time, but if you keep it running it will have the same bug in following runs. Debugging I found the problem is specific to this case in the way that in anim_sys.c:1551 properties are updated only when the value changes. The audio system has a cache of the animation values that is empty at the beginning. As it is empty, the sound has a default volume of 1.0 in the beginning, so during first playback it is fine. Now when the animation is played back the first time it never sets the volume property of the animated sound until it reaches the frame where it jumps to 0. Here the if in anim_sys.c:1551 passes and as a result the audio animation system cache gets the info that on frame 80, the volume is now 0. As the buffer was empty before it creates a new one with 81 frames (starting at 0), filling all of them with 0, as it didn't know the value before, but marks the first 80 as unknown, so it looks like this: ``` 000...0000 UUU...UUUK ``` (U is unkown, K is known) Now it stays 0 until frame 111 when it jumps back to 1 and the anim_sys.c:1551 line triggers a write to the cache again. The frames 81 to 110 are unkown again and as the previous value has been 0, this 0 gets copied up to 110. ``` 000...0000000...0001 UUU...UUUKUUU...UUUK ``` Until frame 181 it stays at 1 and thus the cache never gets updated again. Now when it jumps back to frame 1, there is again no difference according to anim_sys.c:1551 and we get only the same two updates we had during the first playback. As the buffer exists now and has been initialized with 0, the strip doesn't play in the beginning though. Now if the playback is between frame 80 and 110, so while the value is 0 and you now seek to X, which is somewhere between the 0 and 79, you get an update through anim_sys.c:1551 as 0 and 1 are different and it writes a 1 to X and updates the unknown values behind that, making it look like this: ``` 000...0001111...1110000...0001 UUU...UUUKUUU...UUUKUUU...UUUK ``` If you play back then, you'll hear that from that frame X you seeked to on it will be correct. It all comes from the policy how unknown animation cache is initialized. The attached [patch.diff](https://archive.blender.org/developer/F147979/patch.diff) changes the policy to use the default value for the beginning of the buffer instead of the first written value and thus fixes the bug. I hope that it doesn't introduce any other bug though. Can you test this Campbell and maybe add your comments. If it's ok I'll commit the bug fix after release or if you think it's ok during bcon 4 still.

This issue was referenced by 2fa593a6f7

This issue was referenced by 2fa593a6f7d0dcf4a638180da1afd6d10afc3ac5
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit 2fa593a6f7.

Closed by commit 2fa593a6f7.

This issue was referenced by 1ad57f287b

This issue was referenced by 1ad57f287b13f60c22b621179f9e6f22d0b191e5
Member

Added subscriber: @pocock

Added subscriber: @pocock

I tried applying the patch to the Debian package 2.72.b+dfsg0-3 and it didn't resolve the issue. It still has all of the symptoms, e.g. mixdown generates a file without respecting the curves, playback in the Blender UI sometimes has no audio and sometimes ignores the curves for audio and just plays all the audio at full volume.

Then I tried the newer code, 2.74+dfsg0-2 from the Debian Git repository, I was able to use the mixdown successfully and save the audio to an Ogg Vorbis file.

I tried applying the patch to the Debian package 2.72.b+dfsg0-3 and it didn't resolve the issue. It still has all of the symptoms, e.g. mixdown generates a file without respecting the curves, playback in the Blender UI sometimes has no audio and sometimes ignores the curves for audio and just plays all the audio at full volume. Then I tried the newer code, 2.74+dfsg0-2 from the Debian Git repository, I was able to use the mixdown successfully and save the audio to an Ogg Vorbis file.

I think there was something wrong with my build of 2.72.b+dfsg0-3, after making a fresh build with the patch it does also appear to be resolved for that version so hopefully the patch can be backported for the stable Debian package. Thanks for fixing this and providing prompt feedback about the issue.

I think there was something wrong with my build of 2.72.b+dfsg0-3, after making a fresh build with the patch it does also appear to be resolved for that version so hopefully the patch can be backported for the stable Debian package. Thanks for fixing this and providing prompt feedback about the issue.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#43853
No description provided.