Well, it’s been about another week since my last update, and I’ve surprisingly made decent progress since then.

  1. I was able to create a “music player” of sorts that allows the user to open an audio file from their computer and then play it. This was thanks to the NuGet package NAudio as well as the Windows class OpenFileDialog. Thankfully there was a lot of documentation online for both of them, so I was able to figure that step out fairly quickly.
  2. I found a decent algorithm on StackOverflow that counts the syllables in a word and was able to adapt it to my needs. There are some errors in accuracy, however, that I will eventually need to work out, but for right now it does the job. The original algorithm can be found here.

Now this is where things got fun (that was sarcasm, it was actually really frustrating for a while).

My next, theoretical, step was to get the lyrics for the song that the user wanted to sing along to. A previous iteration of this project had the user open a text file that contained the lyrics, but I didn’t want to do that. I wanted to limit the amount of work that the user had to do before using the application. So, I thought I would try to generate the lyrics based on the song that the user chose.

The original plan was to use the Windows Speech Recognition class, feed it the audio file (that had been converted to a .wav file) and have the speech recognition engine generate the lyrics for me using a diction grammar. This did not work. Not only were the results very inaccurate, but the entire audio file never got read and it took too much time to process. I even tried using a voice memo of just me talking to see if it would work, and it did not. That was my first loss.

So, I came up with a plan B. I would use the power of the internet to do all of the work for me. I decided to use an Application Programming Interface (API) that would take the name and artist of a song as input and would return the lyrics. There were a lot of APIs out there that would seemingly do what I needed, but a lot of them instead took lyrics as an input and returned potential song names and artists.

I did, however, find a few that actually did what I needed them to, so I got to work. I had done a little work with APIs at my internship last summer, but I couldn’t remember where to begin. Thankfully there is this wonderful resource called the internet where I was able to find a tutorial on how to get started with using an API. Once I knew how to utilize an API in C#, I started testing the few that I had found.

The first was called ChartLyrics. It was very easy to use and gave the results I wanted. But it had a very limited library of lyrics and so it often could not return anything.

The second was Musixmatch. Not only was it super easy to use, but it also had a larger library and was able to give me the lyrics to all of the songs I tested it with. This was immediately better than ChartLyrics. It wasn’t however, without its own downfall. The free version of the API would only return 30% of the lyrics. Bummer.

But, it was better than nothing, and it was a start. So, I’m going to continue looking into either different APIs that will return all of the lyrics, or an entirely different way to retrieve them. But, that is a later problem.

For now, I’m going to just use a text file of lyrics to begin working on creating the actual karaoke machine piece. I’ll likely be looking into how the BPM of a song relates to the number of syllables that can be spoken in a single beat, as well as how to determine where a beat is in a song.

This was a long update, but thanks for reading it. Although there were a few roadblocks, I’m very happy with the progress that I was able to make.

Categories:

Tags:

No responses yet

Leave a Reply

Your email address will not be published.

css.php