Skip to content

Commit

Permalink
v2.0.1 – See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonbase59 committed Jun 4, 2024
1 parent 780758c commit 9d08d96
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 27 deletions.
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,68 @@
# autocue changelog

### 2024-06-04 - v2.0.1

- Fix small bug when reading already stored `liq_true_peak` that contained
a ` dBFS` value from v1.2.3.

### 2024-06-04 – v2.0.0

Version 2.0.0 is out! It offers the chance to write ReplayGain data to
audio files, in addition to the Liquidsoap/Autocue tags.

This is useful for station owners that can’t or don’t want to use audio tracks
that have been pre-replaygained. You can now add ReplayGain data to songs and
thus ensure the analysis won’t be done over and over again.

This is an _additional_ option to the existing
write_tags feature and will only work when `write_tags` is enabled. Based on
our file analysis, it will save (and overwrite) ReplayGain Track data, such as
the gain value, the reference loudness, integrated loudness and true peak info.

The logic is inside `cue_file`, so it can as well be used for pre-processing
your files without the need of other tools. Autocue & ReplayGain—all in one!

The `cue_file` help now shows the file formats it supports, and the tags it
knows about. `cue_file` will automatically detect if Mutagen is installed and
offer you a whopping **20 more filetypes** to work with!

#### Breaking Changes:

- `liq_true_peak` (in dBFS) has been renamed to `liq_true_peak_db`.
- A new `liq_true_peak` has been added that stores the peak value as expected
and needed by ReplayGain.
- Both `cue_file` and `autocue.cue_file.liq` must be updated to v2.0.0 for
everything to work correctly.
- It is advisable to install Mutagen on the system running Liquidsoap, or in
the AzuraCast Docker container. Doing this gets you more file and tag types
you can work with, and safer/more compatible tagging.
Mutagen can usually be installed with `pip3 install mutagen` (preferred), or
`sudo apt install python3-mutagen` (often older versions, distros don’t
update that often).


### 2024-06-04 – v1.2.3

First public version with a numbering scheme. We use SemVer:

- MAJOR.MINOR.PATCH
- MAJOR increments when API-breaking changes are released.
- MINOR increments with new functionality compatible with the existing API.
- PATCH increments when API-compatible bugfixes and minor changes are done.

The version numbers of `autocue.cue_file` and the external `cue_file` binary
should usually be the same.

Introducing:

- Mutagen (Pyhon tagging library) should be installed and allows writing tags
to _many_ file and tagging formats.
- ffmpeg is now only used for tagging where we know it’s safe.
- Much better error checking:
- Writing tags only to "known good" file types.
- Gracefully skip writing to write-protected files/folders/drives.
- `cue_file` has got better CLI params checking and much improved help.

### 2024-04-19

In preparation for later merge with `master` branch:
Expand Down
49 changes: 41 additions & 8 deletions autocue.cue_file.liq
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# replaygain_reference_loudness
# 2024-05-02 - Moonbase59 - add clipping prevention logic (cue_file -k)
# 2024-05-04 - Moonbase59 - Add (informational) liq_loudness_range
# 2024-06-04 - Moonbase59 - v2.0.0 Breaking: Add -r/--replaygain overwrite
# - Changed `liq_true_peak` to `liq_true_peak_db`,
# add new `liq_true_peak` (linear, like RG)

# Lots of debugging output for AzuraCast in this, will be removed eventually.

Expand All @@ -21,6 +24,14 @@
# Initialize settings for cue_file autocue implementation
let settings.autocue.cue_file = ()

# Internal only! Not a user setting.
let settings.autocue.cue_file.version =
settings.make(
description=
"Software version of autocue.cue_file. Should coincide with `cue_file`.",
"2.0.1"
)

let settings.autocue.cue_file.path =
settings.make(
description=
Expand Down Expand Up @@ -114,12 +125,19 @@ let settings.autocue.cue_file.unify_loudness_correction =
let settings.autocue.cue_file.write_tags =
settings.make(
description=
"Write back `liq_*` tags to original audio file. Use with care, as \
ffmpeg can't write all tags to all file types! Ensure you have enough \
"Write back `liq_*` tags to original audio file. Ensure you have enough \
free space to hold a copy of the original file.",
false
)

let settings.autocue.cue_file.write_replaygain =
settings.make(
description=
"Write ReplayGain tags to file (track only, no album). Useful if your \
files have no previous RG tags. Only valid if `write_tags` is also true.",
false
)

let settings.autocue.cue_file.force_analysis =
settings.make(
description=
Expand Down Expand Up @@ -147,6 +165,7 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
overlay_longtail = settings.autocue.cue_file.overlay_longtail()
blankskip = settings.autocue.cue_file.blankskip()
write_tags = settings.autocue.cue_file.write_tags()
write_replaygain = settings.autocue.cue_file.write_replaygain()
force_analysis = settings.autocue.cue_file.force_analysis()
nice = settings.autocue.cue_file.nice()
noclip = settings.autocue.cue_file.noclip()
Expand Down Expand Up @@ -235,6 +254,12 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
"Clipping prevention active: #{noclip}"
)

log(
level=3,
label=label,
"Writing tags: #{write_tags}, including ReplayGain: #{write_replaygain}"
)

# set up CLI arguments
args =
ref(
Expand All @@ -255,6 +280,7 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
if noclip then args := list.add('-k', args()) end
if blankskip() then args := list.add('-b', args()) end
if write_tags then args := list.add('-w', args()) end
if write_replaygain then args := list.add('-r', args()) end
if force_analysis then args := list.add('-f', args()) end
if nice then args := list.add('-n', args()) end

Expand Down Expand Up @@ -302,7 +328,8 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
liq_reference_loudness,
liq_blankskip,
liq_blank_skipped,
liq_true_peak
liq_true_peak,
liq_true_peak_db
}
:
{
Expand All @@ -320,7 +347,8 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
liq_reference_loudness: string,
liq_blankskip: bool,
liq_blank_skipped: bool,
liq_true_peak: string
liq_true_peak: float,
liq_true_peak_db: string
}
) = res()

Expand All @@ -341,7 +369,8 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
("liq_reference_loudness", liq_reference_loudness),
("liq_blankskip", string(liq_blankskip)),
("liq_blank_skipped", string(liq_blank_skipped)),
("liq_true_peak", liq_true_peak)
("liq_true_peak", string(liq_true_peak)),
("liq_true_peak_db", liq_true_peak_db)
]
)

Expand Down Expand Up @@ -384,12 +413,12 @@ def cue_file(~request_metadata, ~file_metadata, filename) =

# Override liq_amplify, liq_amplify_adjustment & liq_reference_loudness,
# using clipping prevention as requested
# liq_loudness & liq_true_peak are always in the cue_file result
# liq_loudness & liq_true_peak_db are always in the cue_file result
let (amp, amp_correction) =
amplify_correct(
target,
list.assoc("liq_loudness", result()),
list.assoc("liq_true_peak", result()),
list.assoc("liq_true_peak_db", result()),
noclip
)
result := list.assoc.remove("liq_amplify", result())
Expand Down Expand Up @@ -463,7 +492,7 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
level=3,
label=label,
'Clipping prevention: Adjusted liq_amplify by #{amp_correction_dB} \
because track’s true peak is #{list.assoc("liq_true_peak", result())}.'
because track’s true peak is #{list.assoc("liq_true_peak_db", result())}.'
)
end

Expand Down Expand Up @@ -618,7 +647,10 @@ def cue_file(~request_metadata, ~file_metadata, filename) =
("liq_reference_loudness", list.assoc("liq_reference_loudness", result())),
("liq_blank_skipped", list.assoc("liq_blank_skipped", result())),
("liq_true_peak", list.assoc("liq_true_peak", result())),
("liq_true_peak_db", list.assoc("liq_true_peak_db", result())),
...optional_meta("replaygain_track_gain", result()),
...optional_meta("replaygain_track_peak", result()),
...optional_meta("replaygain_track_range", result()),
...optional_meta("replaygain_reference_loudness", result())
]

Expand Down Expand Up @@ -667,6 +699,7 @@ settings.autocue.target_cross_duration := settings.autocue.cue_file.fade_out()
# settings.autocue.cue_file.blankskip := false # skip silence in tracks
# settings.autocue.cue_file.unify_loudness_correction := true # unify `replaygain_track_gain` & `liq_amplify`
# settings.autocue.cue_file.write_tags := false # write liq_* tags back to file
# settings.autocue.cue_file.write_replaygain := false # write ReplayGain tags back to file
# settings.autocue.cue_file.force_analysis := false # force re-analysis even if tags found
# settings.autocue.cue_file.nice := false # Linux/MacOS only: Use NI=18 for analysis

Expand Down
Loading

0 comments on commit 9d08d96

Please sign in to comment.