Skip to content

Commit

Permalink
Added type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ilman01 committed Apr 16, 2024
1 parent 340d95b commit 98716ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ycls/ycls.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import r128gain
import typer

def calculate_loudness_lufs(input_file):
def calculate_loudness_lufs(input_file: str) -> float:
'''Calculates the loudness level of the input audio (or video) file in LUFS (Loudness Units Full Scale) using the r128gain library.'''
return r128gain.get_r128_loudness([input_file])[0]

def calculate_youtube_content_loudness(input_file):
def calculate_youtube_content_loudness(input_file: str) -> float:
'''Calculates the adjusted loudness suitable for YouTube content based on the input audio (or video) file. It adds 14 dB to the loudness level calculated by calculate_loudness_lufs.'''
return round(calculate_loudness_lufs(input_file) + 14, 1)

def calculate_peak_dbfs(input_file):
def calculate_peak_dbfs(input_file: str) -> float:
'''Calculates the peak loudness in dBFS (decibels relative to full scale) of the input audio (or video) file using the r128gain library.'''
return round(r128gain.scale_to_gain(r128gain.get_r128_loudness([input_file])[1]), 1)

Expand Down

0 comments on commit 98716ec

Please sign in to comment.