From ec49a7189dc0583a40630bb18b4e52a8323239fd Mon Sep 17 00:00:00 2001 From: Ronan Harrington Date: Tue, 15 Mar 2022 22:07:38 +0000 Subject: [PATCH] Added bass boost effect --- README.md | 10 ++++++---- vaporiser.py | 38 +++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 297fff0..380c4b0 100644 --- a/README.md +++ b/README.md @@ -95,8 +95,8 @@ $ python vaporiser.py --help ``` usage: vaporiser.py [-h] [-o OUTPUT_NAME] -a AUDIO_INPUT [-s SPEED_RATIO] - [-p PITCH_SHIFT] [-l LOWPASS_CUTOFF] [-tr] [-ph] - [-ga GAIN_DB] [-co] [-g GIF_FILE] [-sb] + [-p PITCH_SHIFT] [-l LOWPASS_CUTOFF] [-b BASS] + [-ga GAIN_DB] [-tr] [-ph] [-co] [-g GIF_FILE] [-sb] Creates a vaporwave (slowed, with reverb) remix of a given MP3 file, with the option of playing over a looped GIF as a video. @@ -125,10 +125,12 @@ audio arguments: extra audio arguments: these arguments control extra, optional audio effects - -tr, --tremolo Enable tremolo effect. (default: False) - -ph, --phaser Enable phaser effect. (default: False) + -b BASS, --bass BASS Add a bass boost effect (e.g. --bass 3). (default: + None) -ga GAIN_DB, --gain GAIN_DB Applies gain (dB). (default: None) + -tr, --tremolo Enable tremolo effect. (default: False) + -ph, --phaser Enable phaser effect. (default: False) -co, --compand Enable compand, which compresses the dynamic range of the audio. (default: False) diff --git a/vaporiser.py b/vaporiser.py index 40d3ce1..4dfdd9a 100644 --- a/vaporiser.py +++ b/vaporiser.py @@ -78,6 +78,24 @@ def main(): "extra audio arguments", "these arguments control extra, optional audio effects" ) + audio_arguments_optional.add_argument( + "-b", + "--bass", + dest="bass", + help="Add a bass boost effect (e.g. --bass 3).", + type=int, + default=None, + ) + + audio_arguments_optional.add_argument( + "-ga", + "--gain", + dest="gain_db", + help="Applies gain (dB).", + type=int, + default=None, + ) + audio_arguments_optional.add_argument( "-tr", "--tremolo", @@ -94,15 +112,6 @@ def main(): action="store_true", ) - audio_arguments_optional.add_argument( - "-ga", - "--gain", - dest="gain_db", - help="Applies gain (dB).", - type=int, - default=None, - ) - audio_arguments_optional.add_argument( "-co", "--compand", @@ -154,8 +163,15 @@ def main(): print("ERROR: Input and output name are identical") sys.exit() - # Creating audio effects chain function - fx = AudioEffectsChain().pitch(args.pitch_shift) + # Creating an audio effects chain, beginning with... + if args.bass: + # ...bass boost effect + bass_boost = f'{"bass "}{args.bass}' + fx = AudioEffectsChain().custom(bass_boost) + fx = fx.pitch(args.pitch_shift) + else: + # ...pitch shift + fx = AudioEffectsChain().pitch(args.pitch_shift) # Adds tremolo effect to the audio effects chain if args.tremolo: