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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file mix50-0.5.tar.gz.

File metadata

  • Download URL: mix50-0.5.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for mix50-0.5.tar.gz
Algorithm Hash digest
SHA256 ac73bf5442502c550864ea3e0c058fc00a32ab855966512f524d0b3a60b9bd7f
MD5 f1f5151ead1dbef714c2d480e8812c5a
BLAKE2b-256 3a69d44dc906e20674600a5ca3ba3afacfea763b653362f1b4adf9b74e54ee41

See more details on using hashes here.

File details

Details for the file Mix50-0.5-py3-none-any.whl.

File metadata

  • Download URL: Mix50-0.5-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for Mix50-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 61af4f4a469708045794f56609c24c836e564a9073e0d8ce7e8d6bb3ea65ce00
MD5 bac6110ea414d1733691a13a15b142ac
BLAKE2b-256 8b13dec241797d366a3be08e94af42edc1cb4f411e4ea50175bc34ce7113aa9f

See more details on using hashes here.

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