Proxy Information
Original URL
gemini://lierre.smol.pub/nachtigall-dev-log-1
Status Code
Success (20)
Meta
text/gemini ``` | . ___ __ __ ___ . __ __ __ __ __ __ | | |__ |__) |__) |__ ' /__` /__` / \ /\ |__) |__) / \ \_/ |___ | |___ | \ | \ |___ .__/ .__/ \__/ /~~\ | |__) \__/ / \ ⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∽⋅∼⋅∽⋅∽⋅∽⋅∽⋅ ``` # Nachtigall: dev log 1 ## Introduction We're creating a little program that takes in a soundfile, estimates the pitch and returns it as human readable notation. See previously: => /nachtigall-motivation-and-technical-specification specification and motivation => /nachtigall-implementation-plan implementation planning => /nachtigall-dev-log-0 dev log 0 So far we have: ``` # see license at the end of the post import numpy as np import librosa import soundfile as sf y, sr = librosa.load("recording_test.wav") f0, voiced_flag, voiced_probs = librosa.pyin(y, sr=sr, fmin=librosa.note_to_hz('C0'), fmax=librosa.note_to_hz('C7'), fill_na=None) # Compute the onset strength envelope, using a max filter of 5 frequency bins # to cut down on false positives onset_env = librosa.onset.onset_strength(y=y, sr=sr, max_size=5) # Detect onset times from the strength envelope onset_times = librosa.onset.onset_detect(onset_envelope=onset_env, sr=sr, units='time') # Create timestamps to match against the onset_times times = librosa.times_like(f0) # Store the start and end indices of the notes f0_indices_note_starts=-1*np.ones_like(onset_times[1:],int) f0_indices_note_ends =-1*np.ones_like(onset_times[1:],int) for i in range(len(onset_times)-1): onset_start=onset_times[i] onset_end =onset_times[i+1] for j in range(len(times-1)): is_start_found = f0_indices_note_starts[i] != -1 is_end_found = f0_indices_note_ends[i] != -1 if is_start_found and is_end_found: break if onset_start<=times[j+1] and times[j] https://librosa.org/doc/latest/generated/librosa.onset.onset_detect.html#librosa.onset.onset_detect librosa onset detection documentation => https://librosa.org/doc/latest/generated/librosa.effects.trim.html#librosa-effects-trim librosa.effects.trim => /nachtigall-dev-log-2 next dev log ## Licence Given that I technically have done a derivative of the existing software by remixing a librosa example file, here is the applicable license. Many thanks to Brian McFee as well as all the other contributors for making my life easier, I appreciate it. => https://github.com/librosa/librosa/blob/main/LICENSE.md#isc-license ISC License ``` Copyright (c) 2013--2023, librosa development team. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ``` ``` ⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∼⋅∽⋅∽⋅∼⋅∽⋅∽⋅ ``` => / home => /posts posts => /about about
Capsule Response Time
258.423498 milliseconds
Gemini-to-HTML Time
0.010454 milliseconds

This content has been proxied by September (ba2dc).