Example #1
0
def identify():
    song = audio_record.record(10)
    spectro_i = audio_record.spectrogram(song)
    peaks_i = fingerprinting.find_peaks(spectro_i[0], spectro_i[1])
    features = fingerprinting.find_fingerprint(peaks_i, spectro_i[1],
                                               spectro_i[2])
    matches = fingerprinting.get_matches(features, database.database)
    best_match = fingerprinting.best_match(matches)
    if best_match is not None:
        print(best_match.name, "by", best_match.artist)
    return best_match
    def record_sample(cls, _typenames):
        (fs, sound) = audio_record.record()
        tns = _typenames if type(_typenames) == list else [_typenames]
        word_num = len(tns)

        create_voice_sample = lambda n, t, f, w: VoiceSample(
            "recording_{name}_{num:02d}_{tmstp}.wav".format(name=t, num=n, tmstp=timestamp()), t, fs=f, data=w
        )
        collection = zip(range(1, word_num + 1), tns, find_words(sound, fs, word_num, plot=True))

        return [create_voice_sample(n, t, fs, w) for n, t, w in collection]
Example #3
0
    def record_sample(cls, _typenames):
        (fs, sound) = audio_record.record()
        tns = _typenames if type(_typenames) == list else [_typenames]
        word_num = len(tns)
        
        create_voice_sample = lambda n,t,f,w: VoiceSample(
                "recording_{name}_{num:02d}_{tmstp}.wav".format(name=t,
                    num=n, tmstp=timestamp()),
                t,
                fs=f,
                data=w)
        collection = zip(
                range(1,word_num+1),
                tns,
                find_words(sound, fs, word_num, plot=True))

        return [ create_voice_sample(n,t,fs,w) for n,t,w in collection ]
Example #4
0
        print("\033[1m" + "\033[31m" +
              "Login failed... Please check email or password" + "\033[0m")
        LOGIN()


if __name__ == "__main__":
    f = Figlet(font='small')
    print(f.renderText('------------------'))
    print(f.renderText('           Hello-!  This is '))
    print(
        f.renderText(
            '               * Soundee *\n                * Recorder *'))
    print(f.renderText('------------------'))
    LOGIN()
    while True:
        audio_preprocess.audio_preprocessing(audio_record.record("test"),
                                             "test")

        with open(file_path, 'rb') as data:
            buckets.upload_file(data.name, key_name)

        # request
        response = requests.request("POST", url, headers=headers, data=payload)

        current_sound_class = response.text
        if current_sound_class == 'no_class':
            print("Not in class.")
        print("This is", current_sound_class, "sound~!")
        # insert DB
        curs = conn.cursor()
        sql = f"insert into sound(class,eventdate,sound_userIdx) values({current_sound_class},NOW(),{userIdx});"
Example #5
0
import audio_preprocess
import audio_record

# for j in range(3):
#     audio_record.record(j)
#     audio_preprocess.audio_preprocessing()

while True:
    for j in range(5):
        audio_preprocess.audio_preprocessing(audio_record.record(j), j)
Example #6
0
	model = Model()
	view = View(model)

	running = True
	view.drawPrompt()


	while running:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				running = False
			if event.type == pygame.KEYDOWN:
				if event.key == pygame.K_ESCAPE:
					running = False
			if event.type == pygame.MOUSEBUTTONDOWN and model.state == 'prompt':
				model.state = 'recording'
				counting = Process(target = view.drawRecording())
				counting.start()
				recording = Process(target = audio_record.record())
				recording.start()
				
			if event.type == pygame.MOUSEBUTTONDOWN and model.state == 'complete':
				(mousex,mousey) = pygame.mouse.get_pos()
				if mousex > model.width - 150  and mousex < model.width - 50 and mousey > model.height - 150 and mousey < model.height - 50:
					model.state = 'prompt'
					view.drawPrompt()
		if model.state == 'loading':
			view.drawLoading()
	pygame.quit()