question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Audio mixing function

See original GitHub issue

I was wondering if it would be useful to have a function to mix two audio samples with a given ratio. (e.g. Mix two audio with 0.5/0.5 or 0.2/0.8 ratio). Usually as far as I know, mixing audio is adding audio samples and clipping. Or it could be normalized by the number of audio being mixed.

I have been naively mixing audio with ratio, r by : mixed_audio = r * audio_A + (1-r) * audio_B but the result normally doesn’t quite match my expectation as you can easily imagine. So some time ago I came across this paper and code about using A-weighting that takes into consideration the human perception to improve the naive method for real auditory experience, and I am still referring to this paper/code till now.

Mixing function that allows both basic and a-weighted method would be helpful in various situations like data augmentation and creation. Any thoughts on implementing a simple mixing function in librosa? 😃 Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
justinsalamoncommented, Nov 30, 2018

@kyungyunlee great, glad to hear it, and cheers @lostanlen for the shout out 😃

2reactions
lostanlencommented, Nov 26, 2018

Hi @kyungyunlee!

  1. At NYU MARL we are already maintaining a library for musical data augmentation named muda (MUsical Data Augmentation). I you haven’t already done so, please see ISMIR 2015 paper by @bmcfee and Bello: http://bmcfee.github.io/papers/ismir2015_augmentation.pdf It features a BackgroundNoise object-oriented interface for mixing two signals with random weights, one belonging to a pool of “foreground” sounds and the other belonging to a pool of “background” sounds: https://muda.readthedocs.io/en/latest/deformers.html#muda.deformers.BackgroundNoise

  2. If you have more than one foreground sound to mix over the background, I would recommend using @justinsalamon’s soundscape generator library scaper: https://github.com/justinsalamon/scaper See his paper from WASPAA 2017

  3. From a deterministic standpoint, this can be achieved with a Combiner from @rabitt’s pysox: https://pysox.readthedocs.io/en/latest/api.html#module-sox.combine See her paper from ISMIR-LBD 2016

I personally am a user (and occasional contributor) to each of these three libraries so unless there is a compelling use case for it that is not covered by any of them, I would tend to prefer avoiding porting it to librosa.

Does that make sense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Audio Mixer: Key Features & Functions - Produce Like A Pro
At the most basic level, an audio mixer combines multiple signals and routes them to a common output for recording or amplification through...
Read more >
What Does an Audio Mixer Do? | Beginner Overview
Quick Answer: An audio mixer allows you to take audio from multiple sources and balance their volumes to produce pleasing audio for your...
Read more >
How Does A Sound Mixer Work? - MixButton
The mixer is the central hub where sound signals from different sources are combined and mixed. Effects and ambience can also be added,...
Read more >
Audio mixing - Wikipedia
Audio mixing is the process by which multiple sounds are combined into one or more channels. In the process, a source's volume level,...
Read more >
What is an Audio Mixer? (with pictures) - EasyTechJunkie
An audio mixer is an electronic device that channels incoming audio signals while maintaining control over such effects as volume level, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found