peruse
Explore a waveform with slang
To install: pip install peruse
Example
from numpy import *
from hum import disp_wf, plot_wf
import soundfile as sf
from peruse.single_wf_snip_analysis import TaggedWaveformAnalysisExtended
import os
import pickle
try:
from slang.util_data import displayable_unichr
unichr_code_of_snip = array(displayable_unichr
+ list(unique(list(set(range(33, 20000)).difference(displayable_unichr)))))
snip_of_unichr_code = (nan * empty(unichr_code_of_snip.max() + 1)).astype(int)
snip_of_unichr_code[unichr_code_of_snip] = arange(len(unichr_code_of_snip))
def snip_to_str(snip):
return chr(unichr_code_of_snip[snip])
except ImportError as e:
def snip_to_str(snip):
return chr(33 + snip)
def string_of_snips(snips):
return "".join(map(snip_to_str, snips))
filepath = "Enter audio filepath here"
wf, sr = sf.read(filepath)
disp_wf(wf, sr)
Unsupervised
Perhaps you just want to get a perspective on your sound, without specifying annotations.
Perhaps you don't know what to annotate and you want snips to help you find patterns to annotate.
Fit the snipper
from peruse.single_wf_snip_analysis import TaggedWaveformAnalysisExtended
tw = TaggedWaveformAnalysisExtended(sr=sr,
tile_size_frm=2048,
chk_size_frm=43008,
prior_count=1)
tw.fit(wf)
Get the snips of a waveform (here the same as fit with, but could be another)
snips = tw.snips_of_wf(wf)
len(snips), len(unique(snips))
View them as characters
print(string_of_snips(snips))
annkncckkobbjhihjacjcjeneijaeofgibiecikjjkdnhajekachbobchoadkjjjjknkkkjofglmijaiinieajdccnkjnollil
hjhkokejkeacdkcofgaldikljnekdijekkjieoboocinchjadannadnnjofgiiielaekheiccnkkeejlbbllichckkinojaeoa
aofgllllnadkdkcneian
Plot (inverse of) snip probabilities (says how rare they are (outliers) from the perspective of the wf that was used to fit, and gives SOME view of the sound)
tw.plot_tiles(1 / array(list(map(tw.prob_of_snip.get, snips))));
tw.plot_tiles(log(1 / array(list(map(tw.prob_of_snip.get, snips)))));
Metadata
Release files for peruse 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| peruse-0.0.8.tar.gz | 12.8 kB | Without provenance | Details for peruse-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| peruse-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for peruse-0.0.8-py3-none-any.whl |
Total release size: 31.4 kB
Release files / peruse-0.0.8.tar.gz
| Download URL | peruse-0.0.8.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df1aaa98b97f695dfbe6155a3cbc19aaeda969ee57d9b39fe9086fbd4dffc8ba
|
|
BLAKE2b-256 checksum How to use checksums |
e56afb18c032e32c201da0020ee7f36541a44edda505b059fa026c072e305830
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / peruse-0.0.8-py3-none-any.whl
| Download URL | peruse-0.0.8-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
775f516a914743c673d0a321add5417bb1d8aeabd8d094642dd8ac3887d50737
|
|
BLAKE2b-256 checksum How to use checksums |
4cfd4d992e18c12102a6070a45691157e5f5dd1bb41dce10ee00832ad6e95276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Security for peruse 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.