- Timestamp:
- May 10, 2016, 9:53:01 PM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 1e4d90f
- Parents:
- 143682b
- Location:
- python/demos
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_filterbank.py
r143682b r8fb567c 2 2 3 3 from aubio import filterbank, fvec 4 from pylab import loglog, show, subplot,xlim, ylim, xlabel, ylabel, title4 from pylab import loglog, show, xlim, ylim, xlabel, ylabel, title 5 5 from numpy import vstack, arange 6 6 -
python/demos/demo_filterbank_slaney.py
r143682b r8fb567c 2 2 3 3 from aubio import filterbank 4 from numpy import ar ray, arange, vstack4 from numpy import arange, vstack 5 5 6 6 win_s = 8192 -
python/demos/demo_keyboard.py
r143682b r8fb567c 26 26 27 27 def create_keyboard_patches(firstnote, lastnote, ax = None): 28 import numpy as np29 28 import matplotlib.pyplot as plt 30 29 from matplotlib.path import Path -
python/demos/demo_mel-energy.py
r143682b r8fb567c 2 2 3 3 import sys 4 from aubio import fvec,source, pvoc, filterbank4 from aubio import source, pvoc, filterbank 5 5 from numpy import vstack, zeros 6 6 -
python/demos/demo_mfcc.py
r143682b r8fb567c 3 3 import sys 4 4 from aubio import source, pvoc, mfcc 5 from numpy import array,vstack, zeros5 from numpy import vstack, zeros 6 6 7 7 win_s = 512 # fft size -
python/demos/demo_onset_plot.py
r143682b r8fb567c 3 3 import sys 4 4 from aubio import onset, source 5 from numpy import array,hstack, zeros5 from numpy import hstack, zeros 6 6 7 7 win_s = 512 # fft size -
python/demos/demo_pitch.py
r143682b r8fb567c 2 2 3 3 import sys 4 from aubio import source, pitch , freqtomidi4 from aubio import source, pitch 5 5 6 6 if len(sys.argv) < 2: -
python/demos/demo_pitch_sinusoid.py
r143682b r8fb567c 1 1 #! /usr/bin/env python 2 2 3 from numpy import random, sin, arange, ones,zeros3 from numpy import random, sin, arange, zeros 4 4 from math import pi 5 5 from aubio import fvec, pitch … … 11 11 f = fvec (p.hop_size) 12 12 cands = [] 13 count = 014 13 for vec_slice in input_vec.reshape((-1, p.hop_size)): 15 14 f[:] = vec_slice -
python/demos/demo_pysoundcard_record.py
r143682b r8fb567c 22 22 g(mono_vec, hop_size) 23 23 total_frames += hop_size 24 except KeyboardInterrupt , e:24 except KeyboardInterrupt: 25 25 print "stopped after", "%.2f seconds" % (total_frames / s.samplerate) 26 pass27 26 s.stop() 28 27 -
python/demos/demo_reading_speed.py
-
Property
mode
changed from
100644
to100755
r143682b r8fb567c 6 6 Compare the speed of several methods for reading and loading a sound file. 7 7 8 This file depends on audioread and librosa: 9 https://github.com/beetbox/audioread 10 https://github.com/bmcfee/librosa 8 This file depends on the following packages: 9 10 - audioread https://github.com/beetbox/audioread 11 - librosa https://github.com/bmcfee/librosa 12 - pydub https://github.com/jiaaro/pydub 11 13 12 14 """ … … 14 16 import numpy as np 15 17 import aubio 18 """ 16 19 import audioread 17 20 import librosa 21 import scipy.io.wavfile 22 from pydub import AudioSegment 23 """ 18 24 19 25 def read_file_audioread(filename): … … 26 32 # Rescale and format the data buffer 27 33 out = scale * np.frombuffer(buf, fmt).astype(dtype) 28 out = out.reshape(2, -1)29 34 return out 30 35 … … 33 38 for buf in f: 34 39 samples = convert_buffer_to_float(buf) 40 samples = samples.reshape(f.channels, -1) 35 41 total_frames += samples.shape[1] 36 42 return total_frames, f.samplerate … … 38 44 def load_file_librosa(filename): 39 45 y, sr = librosa.load(filename, sr = None) 46 #print y.mean(), y.shape 40 47 return len(y), sr 48 49 def load_file_scipy(filename): 50 sr, y = scipy.io.wavfile.read(filename) 51 y = y.astype('float32') / 32767 52 #print y.mean(), y.shape 53 return len(y), sr 54 55 def load_file_scipy_mmap(filename): 56 sr, y = scipy.io.wavfile.read(filename, mmap = True) 57 #print y.mean(), y.shape 58 return len(y), sr 59 60 def read_file_pydub(filename): 61 song = AudioSegment.from_file(filename) 62 song.get_array_of_samples() 63 return song.frame_count(), song.frame_rate 64 65 def load_file_pydub(filename): 66 song = AudioSegment.from_file(filename) 67 y = np.asarray(song.get_array_of_samples(), dtype = 'float32') 68 y = y.reshape(song.channels, -1) / 32767. 69 return song.frame_count(), song.frame_rate 41 70 42 71 def read_file_aubio(filename): … … 59 88 if read < f.hop_size: break 60 89 assert len(y) == total_frames 90 #print y.mean(), y.shape 61 91 return total_frames, f.samplerate 62 92 … … 82 112 filename = sys.argv[1] 83 113 84 functions = [read_file_aubio, load_file_aubio, read_file_audioread, load_file_librosa] 114 functions = [ 115 read_file_aubio, 116 load_file_aubio, 117 #load_file_scipy, 118 #load_file_scipy_mmap, 119 #read_file_audioread, 120 #load_file_librosa, 121 #read_file_pydub, 122 #load_file_pydub, 123 ] 124 85 125 for f in functions: 86 126 test_speed(f, filename) -
Property
mode
changed from
-
python/demos/demo_sink_create_woodblock.py
r143682b r8fb567c 4 4 from math import pi, e 5 5 from aubio import sink 6 from numpy import arange, resize,sin, exp, zeros6 from numpy import arange, sin, exp, zeros 7 7 8 8 if len(sys.argv) < 2: -
python/demos/demo_tempo_plot.py
r143682b r8fb567c 40 40 if len(beats) > 1: 41 41 # do plotting 42 from numpy import array, arange,mean, median, diff42 from numpy import mean, median, diff 43 43 import matplotlib.pyplot as plt 44 44 bpms = 60./ diff(beats) -
python/demos/demo_tss.py
r143682b r8fb567c 45 45 subplot(313) 46 46 get_spectrogram(sys.argv[3]) 47 show() -
python/demos/demo_waveform_plot.py
r143682b r8fb567c 2 2 3 3 import sys 4 from aubio import pvoc,source4 from aubio import source 5 5 from numpy import zeros, hstack 6 6
Note: See TracChangeset
for help on using the changeset viewer.