class Sound(BaseModel): """ An audio processing pipeline that computes a frequency domain representation of the sound that follows a geometric scale """ bark = zounds.ArrayWithUnitsFeature(zounds.BarkBands, samplerate=samplerate, stop_freq_hz=samplerate.nyquist, needs=BaseModel.fft, store=True) long_windowed = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=zounds.SampleRate(frequency=zounds.Milliseconds(358), duration=zounds.Milliseconds(716)), wfunc=zounds.OggVorbisWindowingFunc(), needs=BaseModel.resampled, store=True) long_fft = zounds.ArrayWithUnitsFeature(zounds.FFT, needs=long_windowed, store=True) freq_adaptive = zounds.FrequencyAdaptiveFeature( zounds.FrequencyAdaptiveTransform, transform=np.fft.irfft, scale=scale, window_func=np.hanning, needs=long_fft, store=False) rasterized = zounds.ArrayWithUnitsFeature(lambda fa: fa.rasterize(64), needs=freq_adaptive, store=False)
class SoundWithNoSettings(BaseModel): short_windowed = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=windowing_scheme, wfunc=zounds.OggVorbisWindowingFunc(), needs=BaseModel.resampled) fft = zounds.ArrayWithUnitsFeature( zounds.FFT, needs=short_windowed) geom = zounds.ArrayWithUnitsFeature( spectrogram, needs=fft, store=True) log_spectrogram = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=zounds.SampleRate( frequency=windowing_scheme.frequency * (spectrogram_duration // 2), duration=windowing_scheme.frequency * spectrogram_duration * 3), needs=geom) ls = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=spectrogram_sample_rate, needs=geom)
class Document(BaseModel): bark = zounds.ArrayWithUnitsFeature(zounds.BarkBands, samplerate=samplerate, stop_freq_hz=samplerate.nyquist, needs=BaseModel.fft, store=True) long_windowed = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=zounds.SampleRate(frequency=zounds.Milliseconds(500), duration=zounds.Seconds(1)), wfunc=windowing_func, needs=BaseModel.resampled, store=True) dct = zounds.ArrayWithUnitsFeature(zounds.DCT, scale_always_even=True, needs=long_windowed, store=True) mdct = zounds.FrequencyAdaptiveFeature(zounds.FrequencyAdaptiveTransform, transform=scipy.fftpack.idct, scale=scale, needs=dct, store=True)
class Sound(BaseModel): bark = zounds.ArrayWithUnitsFeature(zounds.BarkBands, needs=BaseModel.fft, store=True) chroma = zounds.ArrayWithUnitsFeature(zounds.Chroma, needs=BaseModel.fft, store=True)
class Sound(BaseModel): windowed = zounds.ArrayWithUnitsFeature(zounds.SlidingWindow, wscheme=wscheme, needs=BaseModel.resampled) mu_law = zounds.ArrayWithUnitsFeature(zounds.mu_law, needs=windowed) categorical = zounds.ArrayWithUnitsFeature(categorical, needs=windowed)
class WithTimbre(STFT, Settings): bark = zounds.ArrayWithUnitsFeature( zounds.BarkBands, needs=STFT.fft, store=True) bfcc = zounds.ArrayWithUnitsFeature( zounds.BFCC, needs=bark, store=True)
class Snd(Sound): embedding = zounds.ArrayWithUnitsFeature( zounds.Learned, learned=learned, pipeline_func=lambda x: x.pipeline[:-1], needs=Sound.ls) hashed = zounds.ArrayWithUnitsFeature(zounds.Learned, learned=learned, needs=Sound.ls, store=True)
class Sound(BaseModel): windowed = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, wscheme=zounds.SampleRate(frequency=samplerate.frequency * (SAMPLE_SIZE // 2), duration=samplerate.frequency * SAMPLE_SIZE), needs=BaseModel.resampled, store=False) perceptual = zounds.ArrayWithUnitsFeature(perceptual, needs=windowed) decomposed = zounds.ArrayWithUnitsFeature( lambda x: FrequencyDecomposition(x, bands).as_frequency_adaptive(), needs=windowed)
class Sound(Resampled): """ A simple pipeline that computes a perceptually weighted modified discrete cosine transform, and "persists" feature data in an in-memory store. """ windowed = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, needs=Resampled.resampled, wscheme=zounds.HalfLapped(), wfunc=zounds.OggVorbisWindowingFunc(), store=True) mdct = zounds.ArrayWithUnitsFeature(zounds.MDCT, needs=windowed) weighted = zounds.ArrayWithUnitsFeature(lambda x: x * zounds.AWeighting(), needs=mdct)
class Document(STFT, Settings): """ Inherit from a basic processing graph, and add a Modified Discrete Cosine Transform feature """ mdct = zounds.ArrayWithUnitsFeature( zounds.MDCT, needs=STFT.windowed, store=True)
class WithCodes(WithTimbre): bfcc_kmeans = zounds.ArrayWithUnitsFeature( zounds.Learned, learned=BfccKmeans(), needs=WithTimbre.bfcc, store=True) sliding_bfcc_kmeans = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, needs=bfcc_kmeans, wscheme=windowing * zounds.Stride(frequency=30, duration=30), store=False) bfcc_kmeans_pooled = zounds.ArrayWithUnitsFeature( zounds.Max, needs=sliding_bfcc_kmeans, axis=1, store=True)
class WithCodes(WithOnsets): bark_kmeans = zounds.ArrayWithUnitsFeature( zounds.Learned, # this feature will be computed using the learned K-Means clusters learned=BarkKmeans(), needs=WithOnsets.bark, store=True) pooled = zounds.VariableRateTimeSeriesFeature( zounds.Pooled, needs=(bark_kmeans, WithOnsets.slices), op=np.max, axis=0, store=True)
class WithOnsets(STFT, Settings): bark = zounds.ArrayWithUnitsFeature( zounds.BarkBands, needs=STFT.fft, store=True) transience = zounds.ArrayWithUnitsFeature( zounds.MeasureOfTransience, needs=STFT.fft, store=True) sliding_detection = zounds.ArrayWithUnitsFeature( zounds.SlidingWindow, needs=transience, wscheme=windowing * zounds.Stride(frequency=1, duration=11), padwith=5, store=False) slices = zounds.TimeSliceFeature( zounds.MovingAveragePeakPicker, needs=sliding_detection, aggregate=np.median, store=True)
class Sound(SoundWithNoSettings, ModelSettings): hashed = zounds.ArrayWithUnitsFeature(IdentityNode, needs=SoundWithNoSettings.ls, store=True)
class Sound(BaseModel): fake_hash = zounds.ArrayWithUnitsFeature(produce_fake_hash, needs=BaseModel.fft, store=True)
class Sound(BaseModel): chroma = zounds.ArrayWithUnitsFeature( zounds.Chroma, frequency_band=band, window=window, needs=BaseModel.fft)