Skip to content

Commit

Permalink
Update 2024-02-07-liquidsoap-v2.2.4.md
Browse files Browse the repository at this point in the history
  • Loading branch information
toots authored Feb 8, 2024
1 parent b402b4b commit d373cd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion _posts/2024-02-07-liquidsoap-v2.2.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ flexibility to those. But, first, let's have a look at how crossfade work:
* When detecting that the track has ended, liquidsoap has a certain amount of data buffered from the ending track. This is usually close to `cross_duration`. Let's call this value `buffered_before`.
* Next, liquidsoap buffers some data from the starting track. This will be as close as possible to `buffered_before` but can be slightly different. It can also be much less if the track is too short. Let's call this value `buffered_after`.
* ⚠️ **Note** ⚠️ : A new track that is shorter than `cross_duration` should be considered a programming error. In particular, all its data will be consumed when computing its `fade.in` transition and no data will be available to compute its `fade.out` transition!
* Temporary sources are then created using `buffered_before` and `buffered_after` data. These sources are passed to the transition function and its result is injected between the ending and starting track, becoming the actual crossfade transition.
* If `buffered_before` and `buffered_after` differ, the extra data is stashed. Let's call the common section `common_buffer`.
* Temporary sources are then created using `common_buffer` of data from the ending and starting track. These sources are passed to the transition function. The remaining extra data is added at the begiginning or end (depending on the situation) of the result of this function and the whole source is injected between the ending and starting track, becoming the actual crossfade transition.

<img width="1002" alt="Screenshot 2024-02-07 at 10 28 48 PM" src="https://github.com/savonet/blog/assets/871060/4f983fef-d8dc-4670-bdad-f27f26b4c318">

It is important to keep this in mind when considering the right crossfade parameters to use. In particular, as seen above, `cross_duration` should never
exceed the next track's duration. This is a little tricky to enforce since `cross_duration` is set at the beginning of the ending track when it might not yet been known which
Expand Down

0 comments on commit d373cd0

Please sign in to comment.