Changeset 8fb567c


Ignore:
Timestamp:
May 10, 2016, 9:53:01 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

python/demos: remove unused import and variables

Location:
python/demos
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_filterbank.py

    r143682b r8fb567c  
    22
    33from aubio import filterbank, fvec
    4 from pylab import loglog, show, subplot, xlim, ylim, xlabel, ylabel, title
     4from pylab import loglog, show, xlim, ylim, xlabel, ylabel, title
    55from numpy import vstack, arange
    66
  • python/demos/demo_filterbank_slaney.py

    r143682b r8fb567c  
    22
    33from aubio import filterbank
    4 from numpy import array, arange, vstack
     4from numpy import arange, vstack
    55
    66win_s = 8192
  • python/demos/demo_keyboard.py

    r143682b r8fb567c  
    2626
    2727def create_keyboard_patches(firstnote, lastnote, ax = None):
    28     import numpy as np
    2928    import matplotlib.pyplot as plt
    3029    from matplotlib.path import Path
  • python/demos/demo_mel-energy.py

    r143682b r8fb567c  
    22
    33import sys
    4 from aubio import fvec, source, pvoc, filterbank
     4from aubio import source, pvoc, filterbank
    55from numpy import vstack, zeros
    66
  • python/demos/demo_mfcc.py

    r143682b r8fb567c  
    33import sys
    44from aubio import source, pvoc, mfcc
    5 from numpy import array, vstack, zeros
     5from numpy import vstack, zeros
    66
    77win_s = 512                 # fft size
  • python/demos/demo_onset_plot.py

    r143682b r8fb567c  
    33import sys
    44from aubio import onset, source
    5 from numpy import array, hstack, zeros
     5from numpy import hstack, zeros
    66
    77win_s = 512                 # fft size
  • python/demos/demo_pitch.py

    r143682b r8fb567c  
    22
    33import sys
    4 from aubio import source, pitch, freqtomidi
     4from aubio import source, pitch
    55
    66if len(sys.argv) < 2:
  • python/demos/demo_pitch_sinusoid.py

    r143682b r8fb567c  
    11#! /usr/bin/env python
    22
    3 from numpy import random, sin, arange, ones, zeros
     3from numpy import random, sin, arange, zeros
    44from math import pi
    55from aubio import fvec, pitch
     
    1111  f = fvec (p.hop_size)
    1212  cands = []
    13   count = 0
    1413  for vec_slice in input_vec.reshape((-1, p.hop_size)):
    1514    f[:] = vec_slice
  • python/demos/demo_pysoundcard_record.py

    r143682b r8fb567c  
    2222            g(mono_vec, hop_size)
    2323            total_frames += hop_size
    24     except KeyboardInterrupt, e:
     24    except KeyboardInterrupt:
    2525        print "stopped after", "%.2f seconds" % (total_frames / s.samplerate)
    26         pass
    2726    s.stop()
    2827
  • python/demos/demo_reading_speed.py

    • Property mode changed from 100644 to 100755
    r143682b r8fb567c  
    66Compare the speed of several methods for reading and loading a sound file.
    77
    8 This file depends on audioread and librosa:
    9     https://github.com/beetbox/audioread
    10     https://github.com/bmcfee/librosa
     8This 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
    1113
    1214"""
     
    1416import numpy as np
    1517import aubio
     18"""
    1619import audioread
    1720import librosa
     21import scipy.io.wavfile
     22from pydub import AudioSegment
     23"""
    1824
    1925def read_file_audioread(filename):
     
    2632        # Rescale and format the data buffer
    2733        out = scale * np.frombuffer(buf, fmt).astype(dtype)
    28         out = out.reshape(2, -1)
    2934        return out
    3035
     
    3338        for buf in f:
    3439            samples = convert_buffer_to_float(buf)
     40            samples = samples.reshape(f.channels, -1)
    3541            total_frames += samples.shape[1]
    3642        return total_frames, f.samplerate
     
    3844def load_file_librosa(filename):
    3945    y, sr = librosa.load(filename, sr = None)
     46    #print y.mean(), y.shape
    4047    return len(y), sr
     48
     49def 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
     55def 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
     60def 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
     65def 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
    4170
    4271def read_file_aubio(filename):
     
    5988        if read < f.hop_size: break
    6089    assert len(y) == total_frames
     90    #print y.mean(), y.shape
    6191    return total_frames, f.samplerate
    6292
     
    82112    filename = sys.argv[1]
    83113
    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
    85125    for f in functions:
    86126        test_speed(f, filename)
  • python/demos/demo_sink_create_woodblock.py

    r143682b r8fb567c  
    44from math import pi, e
    55from aubio import sink
    6 from numpy import arange, resize, sin, exp, zeros
     6from numpy import arange, sin, exp, zeros
    77
    88if len(sys.argv) < 2:
  • python/demos/demo_tempo_plot.py

    r143682b r8fb567c  
    4040if len(beats) > 1:
    4141    # do plotting
    42     from numpy import array, arange, mean, median, diff
     42    from numpy import mean, median, diff
    4343    import matplotlib.pyplot as plt
    4444    bpms = 60./ diff(beats)
  • python/demos/demo_tss.py

    r143682b r8fb567c  
    4545    subplot(313)
    4646    get_spectrogram(sys.argv[3])
     47    show()
  • python/demos/demo_waveform_plot.py

    r143682b r8fb567c  
    22
    33import sys
    4 from aubio import pvoc, source
     4from aubio import source
    55from numpy import zeros, hstack
    66
Note: See TracChangeset for help on using the changeset viewer.