Skip to content

Commit

Permalink
moved all C headers to same headers/ dir
Browse files Browse the repository at this point in the history
moved all c headers to same headers/ dir and specified the install dependencies and process.
  • Loading branch information
suchinton committed Jul 5, 2022
1 parent 531685c commit 8fbfe65
Show file tree
Hide file tree
Showing 39 changed files with 71 additions and 36 deletions.
7 changes: 7 additions & 0 deletions MusicID.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ def run(self):

# init the app
if __name__ == '__main__':

if os.path.exists("./lib/musicID"):
print("no need to make file again")
else:
os.system("cd lib && make")
os.system("bash install_dependencies.sh")

app = QApplication(sys.argv)
Main_pg = MainWindow()
sys.exit(app.exec())
13 changes: 13 additions & 0 deletions install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh env

sudo pacman -S python-pip
yay -Syu chromium-widevine
pip3 install -r requirements.txt

#pip3 install PyQt5
#pip3 install PyQt5-tools
#pip3 insatll QWebEngineView
#pip3 install pyaudio
#pip3 insatll wave
#pip3 insatll spotipy
#pip3 install PyQt5-stubs
2 changes: 1 addition & 1 deletion lib/audionormalizer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <math.h>
#include "audionormalizer.h"
#include "headers/audionormalizer.h"


void normalize(float* samples, unsigned int size) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
#include "ffmpeg.h"
#include "headers/ffmpeg.h"


static void parse_metadata(char* metadata, char* *artist, char* *track_title, char* *album_title) {
Expand Down
2 changes: 1 addition & 1 deletion lib/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "fft.h"
#include "headers/fft.h"

static uint16_t reversed[2048] = { 0xFFFF };

Expand Down
18 changes: 9 additions & 9 deletions lib/fingerprinting.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include "fingerprinting.h"
#include "haar.h"
#include "minhash.h"
#include "rawfingerprints.h"
#include "spectralimages.h"
#include "wav.h"
#include "headers/fingerprinting.h"
#include "headers/haar.h"
#include "headers/minhash.h"
#include "headers/rawfingerprints.h"
#include "headers/spectralimages.h"
#include "headers/wav.h"

int generate_fingerprint(const char* wav, struct signatures* *fingerprint,
char* *artist, char* *track_title, char* *album_title) {
// Let's make sure we have a wave file we can read
// making sure we have a wave file we can read
struct wav_reader* reader;
int res = new_wav_reader(wav, &reader);
if (res != SUCCESS) {
Expand All @@ -26,15 +26,15 @@ int generate_fingerprint(const char* wav, struct signatures* *fingerprint,
fprintf(stderr, "Album title: %s\n", reader->album_title);
}

// Let's steal the metadata from the wav reader
// extracting the metadata from the wav reader
if (artist != NULL) *artist = reader->artist;
if (track_title != NULL) *track_title = reader->track_title;
if (album_title != NULL) *album_title = reader->album_title;
reader->artist = NULL;
reader->track_title = NULL;
reader->album_title = NULL;

// Let's downsample the file into 5512Hz mono float samples between -1.0 and 1.0
// downsampling the file into 5512Hz mono float samples between -1.0 and 1.0
float* samples;
int n = read_samples(reader, &samples);
free_wav_reader(reader);
Expand Down
2 changes: 1 addition & 1 deletion lib/fingerprintio.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fingerprintio.h"
#include "headers/fingerprintio.h"


static void free_index_entry(struct index_entry* entry);
Expand Down
2 changes: 1 addition & 1 deletion lib/generatepermutations.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "permutations.h"
#include "headers/permutations.h"

// A very important part of the audiofingerprinting process is the MinHash algorithm
// used to shorten the many signatures generated for each audio input. This process
Expand Down
2 changes: 1 addition & 1 deletion lib/haar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include "haar.h"
#include "headers/haar.h"

#define N_THREADS 8

Expand Down
2 changes: 1 addition & 1 deletion lib/hannwindow.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <math.h>
#include "hannwindow.h"
#include "headers/hannwindow.h"


static float window[SAMPLES_PER_FRAME] = { 666 };
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/logbins.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include "logbins.h"
#include "headers/logbins.h"

#define MINIMUM_FREQUENCY 318
#define MAXIMUM_FREQUENCY 2000
Expand Down
2 changes: 1 addition & 1 deletion lib/lsh.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdlib.h>
#include "lsh.h"
#include "headers/lsh.h"


void free_signature_list(struct signature_list* list) {
Expand Down
10 changes: 5 additions & 5 deletions lib/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include <string.h>
#include <sys/time.h>

#include "ffmpeg.h"
#include "fingerprinting.h"
#include "fingerprintio.h"
#include "lsh.h"
#include "search.h"
#include "headers/ffmpeg.h"
#include "headers/fingerprinting.h"
#include "headers/fingerprintio.h"
#include "headers/lsh.h"
#include "headers/search.h"

static long time_in_milliseconds() {
struct timeval tv;
Expand Down
4 changes: 2 additions & 2 deletions lib/minhash.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include "minhash.h"
#include "permutations.h"
#include "headers/minhash.h"
#include "headers/permutations.h"


/**
Expand Down
2 changes: 1 addition & 1 deletion lib/permutations.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file was generated by compiling and running generatepermutations.c
*/

#include "permutations.h"
#include "headers/permutations.h"

static uint16_t permutations[N_PERMUTATIONS][PERMUTATION_LENGTH] = {
{
Expand Down
2 changes: 1 addition & 1 deletion lib/rawfingerprints.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include "rawfingerprints.h"
#include "headers/rawfingerprints.h"


#define N_THREADS 8
Expand Down
2 changes: 1 addition & 1 deletion lib/resample.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "resample.h"
#include "headers/resample.h"


#define FILTER_SIZE 31
Expand Down
4 changes: 2 additions & 2 deletions lib/search.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include "lsh.h"
#include "search.h"
#include "headers/lsh.h"
#include "headers/search.h"


// Checking hashes by buckets of 4 bytes is meant to
Expand Down
6 changes: 3 additions & 3 deletions lib/spectralimages.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fft.h"
#include "hannwindow.h"
#include "spectralimages.h"
#include "headers/fft.h"
#include "headers/hannwindow.h"
#include "headers/spectralimages.h"


#define N_THREADS 8
Expand Down
6 changes: 3 additions & 3 deletions lib/wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "audionormalizer.h"
#include "resample.h"
#include "wav.h"
#include "headers/audionormalizer.h"
#include "headers/resample.h"
#include "headers/wav.h"


// Uncompressed integer PCM
Expand Down
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PyQt5 >= 5.15.7
PyQt5-sip >= 12.11.0
PyQt5-stubs >= 5.15.6.0
PyQtWebEngine >= 5.15.6
PyQtWebEngine-Qt5 >= 5.15.2
PyAudio >= 0.2.11
Wave >= 0.0.2
spotipy >= 2.20.0
7 changes: 7 additions & 0 deletions spotiFind.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
from spotipy.oauth2 import SpotifyClientCredentials
from SPT_C import SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET

#get client id and secret from the link given below
#https://developer.spotify.com/dashboard/login
# and save them in SPT_C.py in the main directory i.e. ./MusicID/
#
#SPOTIPY_CLIENT_ID=''
#SPOTIPY_CLIENT_SECRET=''

def Spoti_Find(string):
auth_manager = SpotifyClientCredentials(client_id=SPOTIPY_CLIENT_ID, client_secret=SPOTIPY_CLIENT_SECRET)
sp = spotipy.Spotify(auth_manager=auth_manager)
Expand Down

0 comments on commit 8fbfe65

Please sign in to comment.