Technical on music...
Sep. 7th, 2014 01:58 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I'm working on an interesting, but technically challenging idea.
Most stereo music with a single lead singer puts the singer very close to dead center, which means that you should, theoretically, be able to remove them by subtracting one audio channel from the other.
You may have to adjust the balance between the two, but if the vocals don't wander around any it should work.
It works best with loss-less audio files, as lossy files (such as MP3 and .OGG Vorbis) only record the loudest parts of the music, which generally gets cut away by the process of taking out the lead singer.
Some software music players have plugins you can enable to do this blindly for you, but most don't allow you to fine-tune the balance settings.
What I'd like to do is write an Android music player that can do this, but also while allowing the user to fine-tune both the side-to-side balance, but also how much of the singer is taken out, with possible support for leaving only the singer as well.
The math involved is actually pretty simple:
amount_of_removal*((balance * left) - ((1 - balance) * right)) - (1 - amount_of_removal)*(left + right)
Where balance varies from 0 (right channel only) to 1 (left channel only), with 0.5 being perfectly between the two.
amount_of_removal controls how much the selected balance gets removed, with 1 being totally, 0 being not at all, and -1 being have only the selected balance, also known as "only the singer".
That's the theory, anyway.
Unfortunately, I may need to do some additional work on the equation to ensure that things are working properly.
(I suspect there might be an issue with values "passing in the night". Not sure how to explain it any better, though)
The reason why I want to write an Android app is due to the inherent portability of Android phones (I say Android because that's the OS I'm writing for), which would allow almost on-the-fly converting of song files for possible audition material.
The real problem, however, is the sheer difficulty I'm currently facing with attempting to do this on such a streamlined platform.
Android has fixed, practically built-in audio effects that cannot be expanded upon without fitting into the half-dozen narrow "buckets", which means that I can't do what I want to do in the standard way.
Instead, I have to try doing it all myself, somehow.
Right now, I need to figure out how to read an audio file into memory, decode it into a stream of uncompressed samples, run my equations on it, and then pass it off to the sound device.
The very first step, as well as the last step, are the only parts I know how to do as yet.
That is, read the file into memory, and pass a stream of data off to the sound device.
I haven't yet figured out how to decode the file into an uncompressed stream of samples, and that's going to be one of the most important parts...
If I could only get GStreamer onto Android, it'd be almost easy!
Most stereo music with a single lead singer puts the singer very close to dead center, which means that you should, theoretically, be able to remove them by subtracting one audio channel from the other.
You may have to adjust the balance between the two, but if the vocals don't wander around any it should work.
It works best with loss-less audio files, as lossy files (such as MP3 and .OGG Vorbis) only record the loudest parts of the music, which generally gets cut away by the process of taking out the lead singer.
Some software music players have plugins you can enable to do this blindly for you, but most don't allow you to fine-tune the balance settings.
What I'd like to do is write an Android music player that can do this, but also while allowing the user to fine-tune both the side-to-side balance, but also how much of the singer is taken out, with possible support for leaving only the singer as well.
The math involved is actually pretty simple:
amount_of_removal*((balance * left) - ((1 - balance) * right)) - (1 - amount_of_removal)*(left + right)
Where balance varies from 0 (right channel only) to 1 (left channel only), with 0.5 being perfectly between the two.
amount_of_removal controls how much the selected balance gets removed, with 1 being totally, 0 being not at all, and -1 being have only the selected balance, also known as "only the singer".
That's the theory, anyway.
Unfortunately, I may need to do some additional work on the equation to ensure that things are working properly.
(I suspect there might be an issue with values "passing in the night". Not sure how to explain it any better, though)
The reason why I want to write an Android app is due to the inherent portability of Android phones (I say Android because that's the OS I'm writing for), which would allow almost on-the-fly converting of song files for possible audition material.
The real problem, however, is the sheer difficulty I'm currently facing with attempting to do this on such a streamlined platform.
Android has fixed, practically built-in audio effects that cannot be expanded upon without fitting into the half-dozen narrow "buckets", which means that I can't do what I want to do in the standard way.
Instead, I have to try doing it all myself, somehow.
Right now, I need to figure out how to read an audio file into memory, decode it into a stream of uncompressed samples, run my equations on it, and then pass it off to the sound device.
The very first step, as well as the last step, are the only parts I know how to do as yet.
That is, read the file into memory, and pass a stream of data off to the sound device.
I haven't yet figured out how to decode the file into an uncompressed stream of samples, and that's going to be one of the most important parts...
If I could only get GStreamer onto Android, it'd be almost easy!