Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Add a requirements.txt file for new comers #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ build/Release
.node_repl_history

static/build/

.idea/
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy
librosa
pydub
11 changes: 7 additions & 4 deletions scripts/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ def analyse(file):
return numpy.asarray([centroid, bandwidth])


kick_values = analyse("./ref_sounds/Kick.mp3")
snare_values = analyse("./ref_sounds/Snare.mp3")
hihat_values = analyse("./ref_sounds/Hihat.mp3")
open_values = analyse("./ref_sounds/Open.mp3")
kick_values = analyse("./ref_sounds/kick.wav")
snare_values = analyse("./ref_sounds/snare.wav")
hihat_values = analyse("./ref_sounds/hihat.wav")
open_values = analyse("./ref_sounds/open.wav")


def get_distance(test_values):
test_values = numpy.asarray(test_values)
Expand All @@ -49,9 +50,11 @@ def get_distance(test_values):

# print get_distance(snare_values)


def process(file_name):
return get_distance(analyse(file_name))


if __name__ == "__main__":
with open("./data/filenames.txt") as file_names:
files = file_names.read().splitlines()
Expand Down
Binary file added scripts/ref_sounds/hihat.wav
Binary file not shown.
Binary file added scripts/ref_sounds/kick.wav
Binary file not shown.
Binary file added scripts/ref_sounds/open.wav
Binary file not shown.
Binary file added scripts/ref_sounds/snare.wav
Binary file not shown.
12 changes: 4 additions & 8 deletions scripts/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@

from pydub import AudioSegment
import json
import os
import numpy
import math
import re
from AudioNotebooks import config


sounds = AudioSegment.from_wav("data/spritesheet.wav")

with open('data/filenames.txt') as file_name_file:
file_names = file_name_file.read().split("\n")[:-1]

seg_time = config.chunk_ms

seg_time = 250
num_samples = len(file_names)
num_of_top_tags = 50


num_chunks = config.chunks
num_chunks = 4
min_split_size = 150

print(num_samples)
Expand Down Expand Up @@ -109,7 +105,7 @@ def combine_json(data_file_names, data_tags, data_coords, data_colors, data_anal
seg_start = 0

for s in range(0, len(distribution)):
# for s in range(0, 2):

print('\nchunk : ', s)

file_name = file_names[seg_start : (seg_start + distribution[s])]
Expand Down