Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
fix volume normalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
sarisia committed Nov 12, 2019
1 parent 7935626 commit 4af83bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aria/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create(self, entry):
'-ar', '48000',
'-ac', '2',
'-vn',
'-af', f'volume={-entry.volume}dB, volume=0.10',
'-af', f'volume={-entry.volume}dB, volume=0.05',
'-loglevel', 'quiet',
'pipe:1'
],
Expand Down
6 changes: 3 additions & 3 deletions aria/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
KEY_LENGTH = 40

log = getLogger(__name__)
volume_match = re.compile(r"max_volume: (-?\d+\.\d+) dB")
volume_match = re.compile(r"mean_volume: (-?\d+\.\d+) dB")


def generate_key(length:int=KEY_LENGTH):
Expand Down Expand Up @@ -83,8 +83,8 @@ async def get_volume(filename:str):
_, stderr = await ffmpeg.communicate()
log.debug(stderr)
ret = float(volume_match.findall(stderr.decode('utf-8'))[0])
log.info(f'Got max_volume: {ret}')
log.info(f'Got mean_volume: {ret}')
except:
log.error('Failed to get max_volume:', exc_info=True)
log.error('Failed to get mean_volume:', exc_info=True)

return ret or 0

0 comments on commit 4af83bd

Please sign in to comment.