Exemplo n.º 1
0
noises = [0]

# Music library
current_dir = os.path.dirname(os.path.abspath(__file__))
music_dir = current_dir + "/music_modif1"
music_list = []
for file in os.listdir(music_dir):
        if file.endswith(".mp3"):
                music_list.append(file)

apf = 10
duration = 2
Fe=44100
frame_size = duration*Fe//8192*8192
mdct = Mdct()
mp = MatchingPursuit(mdct,apf)
mp.buildMask(frame_size)

# pour chaque musique de la bdd on prend 3 extraits

extracts_k = [1./4,2./4,3./4]
counter = np.zeros(len(noises))
i = 0

for track in music_list:
        print(track)
        wavdata = sound.read(music_dir + "/" + track)
        lenght = wavdata.getnframes()
        fs = wavdata.getframerate()

        for coef in extracts_k:
Exemplo n.º 2
0
print("%d tracks in database" % len(music_list))

# Creating an empty database
if os.path.isfile(current_dir + "/database.sqlite"):
    os.remove(current_dir + "/database.sqlite")
database = Database()
database.create()
del database

# Processing each track

atoms_per_frame = 20
frame_duration = 5

mdct = Mdct()
mp = MatchingPursuit(mdct, atoms_per_frame)
biggest_atom_size = mdct.sizes[-1]
Fe = 44100
frame_size = int(frame_duration * Fe / biggest_atom_size) * biggest_atom_size
mp.buildMask(frame_size)

for track in music_list:
    query = []
    track_title = track[:-4]

    database = Database()
    track_id = database.addTrack(track_title)
    del database
    print("=> Processing %s, id: %d" % (track_title, track_id))

    wavdata = sound.read(track)
Exemplo n.º 3
0
print("%d tracks in database" % len(music_list))

# Creating an empty database
if os.path.isfile(current_dir + "/database.sqlite"):
        os.remove(current_dir + "/database.sqlite")
database = Database()
database.create()
del database

# Processing each track

atoms_per_frame = 20
frame_duration = 5

mdct = Mdct()
mp = MatchingPursuit(mdct, atoms_per_frame)
biggest_atom_size = mdct.sizes[-1]
Fe = 44100
frame_size = int(frame_duration*Fe/biggest_atom_size)*biggest_atom_size
mp.buildMask(frame_size)

for track in music_list:
    query = []
    track_title = track[:-4]

    database = Database()
    track_id = database.addTrack(track_title)
    del database
    print("=> Processing %s, id: %d" % (track_title, track_id))

    wavdata = sound.read(track)
Exemplo n.º 4
0
noises = [0]

# Music library
current_dir = os.path.dirname(os.path.abspath(__file__))
music_dir = current_dir + "/music_modif1"
music_list = []
for file in os.listdir(music_dir):
    if file.endswith(".mp3"):
        music_list.append(file)

apf = 10
duration = 2
Fe = 44100
frame_size = duration * Fe // 8192 * 8192
mdct = Mdct()
mp = MatchingPursuit(mdct, apf)
mp.buildMask(frame_size)

# pour chaque musique de la bdd on prend 3 extraits

extracts_k = [1. / 4, 2. / 4, 3. / 4]
counter = np.zeros(len(noises))
i = 0

for track in music_list:
    print(track)
    wavdata = sound.read(music_dir + "/" + track)
    lenght = wavdata.getnframes()
    fs = wavdata.getframerate()

    for coef in extracts_k: