benfmiller / audalign

Package for aligning audio files through audio fingerprinting
MIT License
94 stars 2 forks source link

I know very little about coding. I never really used GitHub that much. #48

Closed Cowboyhebert6 closed 1 year ago

Cowboyhebert6 commented 1 year ago

Is there a way someone that can do this process of aligning two audio files I have, without me having to do it using this command program (audalign)?

EGA-SUPREMO commented 1 year ago

You mean you want a program with a graphic interface?

El vie., 31 de marzo de 2023 1:02, Cowboyhebert6 @.***> escribió:

Is there a way someone that can do this process of aligning two audio files I have, without me having to do it using this command program (audalign)?

— Reply to this email directly, view it on GitHub https://github.com/benfmiller/audalign/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGC5VZTAI6OLBG43LXILT4LW6ZQN7ANCNFSM6AAAAAAWOFB6P4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Cowboyhebert6 commented 1 year ago

You mean you want a program with a graphic interface? El vie., 31 de marzo de 2023 1:02, Cowboyhebert6 @.***> escribió:

Yeah something like that? because I know absolutely nothing on where to put the files within the code and what code is used for audalign in order to actually align the fils I have within adobe audition, that's my issue? I'm confused on how it all works and I need a little bit of guidance generally.

Cowboyhebert6 commented 1 year ago

Yeah I kind of am Are u able to help on where I should put the audio files within the Audalign command that’s what I’m confused on. @EGA-SUPREMO

EGA-SUPREMO commented 1 year ago

I think aligning audio can be done somewhere in Adobe Audition or Audacity, but either way if you want to use this program you would need to:

Install Python 3 Install FFmpeg

after that, you would need to open Powershell(can be done by pressing Win + R and then putting 'powershell' without quotes) and run: pip install audalign

EGA-SUPREMO commented 1 year ago

I can give you instructions on how to install Python and FFpmeg in case you don't have installed if you want

EGA-SUPREMO commented 1 year ago

then you need to create a file, for example name it corr.py and paste this code:

import audalign as ad

def align_folder():
    correlation_rec = ad.CorrelationRecognizer()

    results = ad.align_files(
        "target/file1",
        "target/file2",
        destination_path="write/alignments/to/folder",
        recognizer=correlation_rec
    )
    return results

if __name__ == "__main__":
    results = align_folder()

In summary, this code aligns two audio files using the specified algorithm and saves the aligned segments to a new folder. You would need to change "target/file1", "target/file2" and "write/alignments/to/folder" into the directory you have the audios.

But if you want to just align two files, I would recommend to just use Audacity or Adobe Audition, as it will take less time to set up and configure, this program is useful if you have a large amount of audios to the point it will be a pain to open, align and then save it each one of them

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO yes plz absolutely also, if your able to help on what to type can u demonstrate that too like physically what to type into the audalign program as well?

EGA-SUPREMO commented 1 year ago

Do you have python installed?

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO oops sorry I didn’t see your message until now yes I did install it yes

Cowboyhebert6 commented 1 year ago

How do I use it with audition though I never knew it was able to be compatible? @EGA-SUPREMO

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO also, how do u open the audalign in adobe audition? That’s what I’m mainly trying to figure out which I never have knew it was possible?

Cowboyhebert6 commented 1 year ago

Are u there still? @EGA-SUPREMO

EGA-SUPREMO commented 1 year ago

yes, I'm thinking what to reply

EGA-SUPREMO commented 1 year ago

@EGA-SUPREMO also, how do u open the audalign in adobe audition? That’s what I’m mainly trying to figure out which I never have knew it was possible?

I don't think that is possible, either way, did you manage to install audalign?

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO I got python installed, but now audalign because the code part “pip install audalign” seems to give me an error?

EGA-SUPREMO commented 1 year ago

what error?

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO Screenshot 2023-03-31 160449

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO That's the error?

EGA-SUPREMO commented 1 year ago

I really don't know, maybe PATH was not set up correctly or a Python installation issue

Cowboyhebert6 commented 1 year ago

Well how do I setup the path for this part in order to make it work?

Cowboyhebert6 commented 1 year ago

image what about this error?

EGA-SUPREMO commented 1 year ago

pip is meant to be run on the command line, not as a python code

Those steps may differ from environment from environment, but to add PATH to pip:

Open the Start menu and search for "Environment Variables". Click on "Edit the system environment variables" from the results.

In the System Properties window, click on the "Environment Variables" button.

In the Environment Variables window, find the "Path" variable in the "System variables" section and click on "Edit".

Click on "New" and add the path to the Python scripts folder. By default, the scripts folder is located in the following path: C:\PythonXX\Scripts, where XX is the version of Python you have installed (e.g., 37 for Python 3.7).

Click "OK" to close all windows and save the changes.

EGA-SUPREMO commented 1 year ago

https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command

EGA-SUPREMO commented 1 year ago

I don't know anything about your environment or how did you install Python, I think it may be more efficient that you look on how to run pip through the command line, I can help you with running audalign.

StackOverflow and ChatGPT can be of great help

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO Okay but, you said that the PowerShell was the main program that i should use correct?

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO Also, did you mean can help or can't help I know I've made so many comment? sorry.

Cowboyhebert6 commented 1 year ago

Mainly I'm curious if i need to type the file names manually into the program in order for it to perform? @EGA-SUPREMO

EGA-SUPREMO commented 1 year ago

@EGA-SUPREMO Okay but, you said that the PowerShell was the main program that i should use correct?

Yes

@EGA-SUPREMO Also, did you mean can help or can't help I know I've made so many comment? sorry.

Sorry, I don't understand

Mainly I'm curious if i need to type the file names manually into the program in order for it to perform?

With the script I passed, yes, but I can change it if you want to write only the folder

Cowboyhebert6 commented 1 year ago

Yes plz you can write the folder? Also, Be aware though my main situation is I'm trying to align 2 music files for an old guitar solo song (free bird by lynyrd skynyrd) along with the a vocal track that has not music from the song in order to do that i thought this command would help so that way i can invert just the vocal track since's it will already be in time with other file which is the full song?

Cowboyhebert6 commented 1 year ago

That would be sooooo much easier thank you. I'm actually still learning how to use github so this is my first time using it, thanks so much for your help and your hard work man. @EGA-SUPREMO

Cowboyhebert6 commented 1 year ago

If you don't mind which I reeeeally would prefer, but are you able to do the file aligning process for me instead of me having to do it by myself? Since I don't know too much on how to use it still with all errors I've came across? I'm aligning 2 audio files for a song free bird by Lynyrd Skynyrd using this command line program, one is just the vocals ( in Stereo) all by themselves and the other is the entire song (in Stereo). @EGA-SUPREMO

EGA-SUPREMO commented 1 year ago

sure give me the link to download the audios

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO Okay great thanks buddy here they are. Keep in mind there they are waaaaay out of sync. let me know when your finsihed and send the folder of the aligned files to me through a zip to my email, “amcqueen2004@gmail.com” Thanks man

Vocals.zip Free Bird (Extended Music Version).zip

EGA-SUPREMO commented 1 year ago

Turn out, this program doesn't work for those kind of files. It only works if the audios are nearly identical, like for example, a concert recorded by two different microphones, but not to align music with vocals

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO Okay, I have similar that's actually a little bit easier I'm going to send you another batch of the same song but they will both be similar but will sound identical but it will be and instrumental version of the other song exact same song will you try that instead? is that okay?

Cowboyhebert6 commented 1 year ago

@EGA-SUPREMO I'll send them both tomorrow so you can try this process again but with different files?

EGA-SUPREMO commented 1 year ago

Yeah, I can try and as long as the sound is nearly identical it will work.

benfmiller commented 1 year ago

Thanks for helping @EGA-SUPREMO!

I don't think adobe audition has any support for that kind of plugin. I only used adobe audition as a way to illustrate the alignment of the files after they were aligned by audalign, sorry for the confusion.

If python is installed but pip isn't on windows, this command might work to install pip?

 py -m ensurepip --upgrade

Audalign is a python library, so you can use pip to install audalign and create a python file like the one provided by @EGA-SUPREMO above, which can then be run from powershell with python python-file.py.

The recordings to align would ideally be of the exact same event, but could work if the sounds in the recordings are similar enough. The two main recognizers in audalign use either correlation or fingerprinting. Correlation works by multiplying the number values of the audio files together with all possible alignments and finding the offset that has the highest sum, or similarity. Fingerprinting works by matching exact "fingerprints", or combinations of two or three peak frequencies from the spectrogram of each file. Correlation works better with longer segments that can be less similar, and fingerprinting works better with shorter segments that have the same frequency peaks and are more similar. There is some more information on how the recognizers work in the wiki.

Cowboyhebert6 commented 1 year ago

@benfmiller Hi Ben how u doing it’s so good to hear from you I just now saw your message, I know kind of to a certain extent of understand what your talking about, but mainly all what I want is if u possibly could as a favor for me to just simply use this command or code whatever it is because to be honest “I know nothing about coding at all really”, but I was wondering as a favor if u could just use audalign “unless if it wasn’t made for vocals to be aligned with the full song” if u could do is just align it for me without me having to use it and do it by myself?

Cowboyhebert6 commented 1 year ago

@benfmiller i don’t know if u still remember how to use audalign in case is why I was asking. Thanks for your help too man if u can try to use audalign for those too file I sent to @EGA-SUPREMO within these comments since I don’t know what to physically put and where it should be.

thanks for helping me guys.

Cowboyhebert6 commented 1 year ago

@benfmiller @EGA-SUPREMO I’ve gotta head to work tonight, but I’ll respond and reach out tomorrow to y’all in this chat thanks guys

Sincerely, Cowboyhebert6

benfmiller commented 1 year ago

For sure! It probably would have been easier to visually do it in Adobe Audition, but audalign worked just fine with those two files.

import audalign as ad

fingerprint_recognizer = ad.FingerprintRecognizer()
fingerprint_recognizer.config.set_accuracy(4)
result = ad.align("audio_files/cowboyhebert6-issue48")
correlation_recognizer = ad.CorrelationRecognizer()
result = ad.fine_align(
    result,
    recognizer=correlation_recognizer,
)
ad.pretty_print_results(result)
ad.write_shifts_from_results(result, "audio_files/shifts", unprocessed=True)

Free Bird (extended Music Version).zip (shifted) output.txt

Cowboyhebert6 commented 1 year ago

Where's the Vocal file? @benfmiller

Cowboyhebert6 commented 1 year ago

Can you get the vocal file sent to me too? Since it was included? @benfmiller

Cowboyhebert6 commented 1 year ago

You got the Vocals.mp3 File that's aligned already? @benfmiller

Cowboyhebert6 commented 1 year ago

@benfmiller You forgot to send me the shifted Vocals file?

benfmiller commented 1 year ago

The vocals file wasn't changed, so I didn't resend it @Cowboyhebert6

Cowboyhebert6 commented 1 year ago

But its says in the code the shift was made can you send back it just in case al least? because I saw I thought said was shifted and edited in the the output text file? @benfmiller

Cowboyhebert6 commented 1 year ago

it says it written the file right here is why I was asking? @benfmiller

Screen Shot 2023-04-05 at 8 56 38 PM
Cowboyhebert6 commented 1 year ago

@benfmiller I was curious to find out since that part of the code made multiple files from the aligning process?