Skip to main content

Fast and simple DJ and audio effects in Python with Librosa

Project description

GitHub license PRs Welcome

Your image description

Mix50

Mix50 is an audio effect and DSP library that runs effects on music files. You can retrieve audio features like key, bpm, beatgrid, transition cues. You can apply audio effects like filters, fades, and time warping. You can also attempt to mix and create transitions between two songs autonomously by using the crossfade method in the transitions module.

Installation

Tested on Python 3.11 and later

$ pip install Mix50

Audio Effects

Analyze a WAV audio file -

import Mix50

#Create mixfifty instance
Mixfifty = Mix50.MixFifty()

#Load Audio(s)
MixFifty.load_audio('your_mp3_file.mp3')

#Use the effects module to fade audio in at 15s for 10s
MixFifty.effects.fade_in(start_time=15,fade_duration=10)

#Use the effects module to utilize filter highpass
MixFifty.effects.highpass_control(start_time=15, end_time=30, cutoff_freq=1000)

#Use the effects module to control speed of audio
MixFifty.effects.speed_control(start_time=15, end_time=30, original_bpm=126, new_bpm=120)

Audio Features

import Mix50

#Create mixfifty instance
Mixfifty = Mix50.MixFifty()

#Load Audio(s)
MixFifty.load_audio('your_mp3_file.mp3')

#Get BPM of Audio
MixFifty.features.bpm()

#Get Key of Audio
MixFifty.features.key()

#Get a dataframe of a beatgrid to mix audio files and understand transition cues
MixFifty.features.beats()

==> beats    downbeat    loop_cues    transitions
    9.102    9.102       9.102        9.102
    9.590    NaN         NaN          NaN
    10.054   NaN         NaN          NaN
    10.542   NaN         NaN          NaN
    11.006   11.006      NaN          NaN
... ... ... ... ...
    317.486  NaN         NaN          NaN
    317.974  NaN         NaN          NaN
    318.438 318.438      NaN          NaN
    318.903 NaN          NaN          NaN
    319.390 NaN          NaN          NaN

#Visualize transition cues
MixFifty.features.show_transition_points()

Audio Transitions

Mix50 generates transitions based on the beatgrid derived from the audio.

Parameters

  • cue_num1: Specifies the transition cue for the start of song #1. Typically, songs have up to 10 transition points, but this parameter allows for experimentation.

  • cue_num2: Specifies the transition cue for the start of song #2. As with cue_num1, songs generally have up to 10 transition points, but this parameter is designed for experimentation.

  • filter_type: Specifies the filter you want to apply to transition the audios. Choices are 'highpass', 'lowpass', or 'none.'

#Create mixfifty instance
Mixfifty = Mix50.MixFifty()

#Load Two Audio files
MixFifty.load_audio('your_mp3_file1.mp3', 'your_mp3_file2.mp3')

#Create crossfade transition
MixFifty.transitions.crossfade(cue_num1=8,cue_num2=6,fade_duration=10,filter_type='none')

Save & Export Audio

Save, play, and return audio with this module. Saving .MP3 files is not supported; please use .WAV

#Save affected audio to a variable 
affected_audio = MixFifty.effects.fade_out(start_time=15,fade_duration=15)

# Play audio in an interactive environment
affected_audio.play()

# Output:
# ==> IPython.lib.display.Audio

# Return raw audio as a numpy array
affected_audio.raw_audio()

# Output:
# ==> array([ 9.06439368e-11,  1.45156775e-10, -1.51146651e-10, ..., 0.00000000e+00,  0.00000000e+00,  0.00000000e+00])

# Save as an audio file: must use .wav; .mp3 not supported
affected_audio.save("path/to/save.wav")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mix50-0.5.tar.gz (13.3 kB view hashes)

Uploaded Source

Built Distribution

Mix50-0.5-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page