Esempio n. 1
0
        class Document(rs):
            windowed = ArrayWithUnitsFeature(SlidingWindow,
                                             wscheme=wscheme,
                                             needs=rs.resampled,
                                             store=False)

            dct = ArrayWithUnitsFeature(DCTIV, needs=windowed, store=True)
Esempio n. 2
0
    class ShortTimeFourierTransform(BaseModel):
        meta = JSONFeature(MetaData, store=True, encoder=AudioMetaDataEncoder)

        raw = ByteStreamFeature(ByteStream,
                                chunksize=chunksize_bytes,
                                needs=meta,
                                store=False)

        ogg = OggVorbisFeature(OggVorbis, needs=raw, store=True)

        pcm = AudioSamplesFeature(AudioStream, needs=raw, store=False)

        resampled = AudioSamplesFeature(Resampler,
                                        needs=pcm,
                                        samplerate=resample_to,
                                        store=store_resampled)

        windowed = ArrayWithUnitsFeature(SlidingWindow,
                                         needs=resampled,
                                         wscheme=wscheme,
                                         wfunc=OggVorbisWindowingFunc(),
                                         store=store_windowed)

        fft = ArrayWithUnitsFeature(FFT,
                                    padding_samples=fft_padding_samples,
                                    needs=windowed,
                                    store=store_fft)
Esempio n. 3
0
        class Sound(rs):
            short_windowed = ArrayWithUnitsFeature(SlidingWindow,
                                                   wscheme=short_window,
                                                   needs=rs.resampled)

            long_windowed = ArrayWithUnitsFeature(SlidingWindow,
                                                  wscheme=long_window,
                                                  needs=short_windowed)
Esempio n. 4
0
 class Document(BaseModel, PersistenceSettings):
     source1 = ArrayWithUnitsFeature(MergeTester,
                                     total_frames=200,
                                     store=True)
     source2 = ArrayWithUnitsFeature(MergeTester,
                                     total_frames=200,
                                     store=True)
     merged = ArrayWithUnitsFeature(Merge,
                                    needs=[source1, source2],
                                    store=True)
Esempio n. 5
0
        class Document(rs):
            long_windowed = ArrayWithUnitsFeature(
                SlidingWindow,
                wscheme=SampleRate(Milliseconds(500), Seconds(1)),
                wfunc=OggVorbisWindowingFunc(),
                needs=rs.resampled,
                store=True)

            long_fft = ArrayWithUnitsFeature(FFT,
                                             needs=long_windowed,
                                             store=True)
Esempio n. 6
0
        class Document(rs):
            windowed = ArrayWithUnitsFeature(SlidingWindow,
                                             wscheme=wscheme,
                                             wfunc=OggVorbisWindowingFunc(),
                                             needs=rs.resampled,
                                             store=False)

            fft = ArrayWithUnitsFeature(FFT, needs=windowed, store=False)

            centroid = ArrayWithUnitsFeature(SpectralCentroid,
                                             needs=fft,
                                             store=True)
Esempio n. 7
0
        class Model(STFT, settings):
            binary = ArrayWithUnitsFeature(Binarize,
                                           predicate=lambda data: data >= 0,
                                           needs=STFT.fft,
                                           store=False)

            sliced = ArrayWithUnitsFeature(Slice,
                                           sl=slice(0, slice_size),
                                           needs=binary,
                                           store=True)

            packed = ArrayWithUnitsFeature(pack, needs=sliced, store=True)
Esempio n. 8
0
        class WithOnsets(self.STFT):
            transience = ArrayWithUnitsFeature(MeasureOfTransience,
                                               needs=self.STFT.fft,
                                               store=True)

            sliding_detection = ArrayWithUnitsFeature(
                SlidingWindow,
                needs=transience,
                wscheme=self.wscheme * Stride(frequency=1, duration=10),
                padwith=5,
                store=False)

            slices = TimeSliceFeature(MovingAveragePeakPicker,
                                      needs=sliding_detection,
                                      aggregate=np.median,
                                      store=True)
Esempio n. 9
0
 class Document(BaseModel, PersistenceSettings):
     source1 = ArrayWithUnitsFeature(MergeTester,
                                     total_frames=200,
                                     increments_of=12,
                                     store=True)
     source2 = ArrayWithUnitsFeature(MergeTester,
                                     total_frames=200,
                                     increments_of=17,
                                     store=True)
     source3 = ArrayWithUnitsFeature(MergeTester,
                                     total_frames=200,
                                     increments_of=32,
                                     store=True)
     merged = ArrayWithUnitsFeature(Merge,
                                    needs=(source1, source2, source3),
                                    store=True)
Esempio n. 10
0
    class FrequencyAdaptive(BaseModel):
        long_windowed = ArrayWithUnitsFeature(SlidingWindow,
                                              wscheme=long_window_sample_rate,
                                              wfunc=OggVorbisWindowingFunc(),
                                              needs=BaseModel.resampled,
                                              store=False)

        long_fft = ArrayWithUnitsFeature(FFT, needs=long_windowed, store=False)

        freq_adaptive = FrequencyAdaptiveFeature(
            FrequencyAdaptiveTransform,
            transform=np.fft.irfft,
            scale=scale,
            check_scale_overlap_ratio=check_scale_overlap_ratio,
            window_func=np.hanning,
            needs=long_fft,
            store=store_freq_adaptive)
Esempio n. 11
0
        class Document(BaseModel):
            long_windowed = ArrayWithUnitsFeature(
                SlidingWindow,
                wscheme=SampleRate(frequency=Milliseconds(500),
                                   duration=Seconds(1)),
                wfunc=windowing_func,
                needs=BaseModel.resampled,
                store=True)

            dct = ArrayWithUnitsFeature(DCT,
                                        scale_always_even=True,
                                        needs=long_windowed,
                                        store=True)

            mdct = FrequencyAdaptiveFeature(FrequencyAdaptiveTransform,
                                            transform=scipy.fftpack.idct,
                                            scale=scale,
                                            needs=dct,
                                            store=True)
Esempio n. 12
0
        class WithOnsets(self.STFT, Settings):
            onset_prep = ArrayWithUnitsFeature(SlidingWindow,
                                               needs=self.STFT.fft,
                                               wscheme=self.wscheme * (1, 3),
                                               store=False)

            complex_domain = ArrayWithUnitsFeature(ComplexDomain,
                                                   needs=onset_prep,
                                                   store=False)

            sliding_detection = ArrayWithUnitsFeature(SlidingWindow,
                                                      needs=complex_domain,
                                                      wscheme=self.wscheme *
                                                      (1, 11),
                                                      padwith=5,
                                                      store=False)

            slices = TimeSliceFeature(MovingAveragePeakPicker,
                                      needs=sliding_detection,
                                      aggregate=np.median,
                                      store=True)
Esempio n. 13
0
    class Onsets(BaseModel):
        onset_prep = ArrayWithUnitsFeature(SlidingWindow,
                                           needs=fft_feature,
                                           wscheme=HalfLapped() *
                                           Stride(frequency=1, duration=3),
                                           store=False)

        complex_domain = ArrayWithUnitsFeature(ComplexDomain,
                                               needs=onset_prep,
                                               store=False)

        sliding_detection = ArrayWithUnitsFeature(
            SlidingWindow,
            needs=complex_domain,
            wscheme=HalfLapped() * Stride(frequency=1, duration=11),
            padwith=5,
            store=False)

        slices = TimeSliceFeature(MovingAveragePeakPicker,
                                  needs=sliding_detection,
                                  aggregate=np.median,
                                  store=True)
Esempio n. 14
0
class Document(BaseModel):
    raw = ByteStreamFeature(ByteStream,
                            chunksize=2 * 44100 * 30 * 2,
                            store=True)

    ogg = OggVorbisFeature(OggVorbis, needs=raw, store=True)

    pcm = AudioSamplesFeature(AudioStream, needs=raw, store=True)

    resampled = AudioSamplesFeature(Resampler,
                                    needs=pcm,
                                    samplerate=samplerate,
                                    store=True)

    windowed = ArrayWithUnitsFeature(SlidingWindow,
                                     needs=resampled,
                                     wscheme=windowing_scheme,
                                     wfunc=OggVorbisWindowingFunc(),
                                     store=False)

    fft = ArrayWithUnitsFeature(FFT, needs=windowed, store=True)

    chroma = ArrayWithUnitsFeature(Chroma,
                                   needs=fft,
                                   frequency_band=band,
                                   store=True)

    bark = ArrayWithUnitsFeature(BarkBands,
                                 needs=fft,
                                 frequency_band=band,
                                 store=True)

    bfcc = ArrayWithUnitsFeature(BFCC, needs=bark, store=True)

    bfcc_sliding_window = ArrayWithUnitsFeature(
        SlidingWindow,
        needs=bfcc,
        wscheme=windowing_scheme * Stride(frequency=2, duration=4),
        store=True)

    bfcc_pooled = ArrayWithUnitsFeature(Max,
                                        needs=bfcc_sliding_window,
                                        axis=1,
                                        store=True)
Esempio n. 15
0
    class AudioGraph(BaseModel):
        meta = JSONFeature(MetaData, store=True, encoder=AudioMetaDataEncoder)

        raw = ByteStreamFeature(ByteStream,
                                chunksize=chunksize_bytes,
                                needs=meta,
                                store=False)

        ogg = OggVorbisFeature(OggVorbis, needs=raw, store=True)

        pcm = AudioSamplesFeature(AudioStream, needs=raw, store=False)

        resampled = AudioSamplesFeature(Resampler,
                                        needs=pcm,
                                        samplerate=resample_to,
                                        store=False)

        windowed = ArrayWithUnitsFeature(SlidingWindow,
                                         needs=resampled,
                                         wscheme=HalfLapped(),
                                         wfunc=OggVorbisWindowingFunc(),
                                         store=False)

        dct = ArrayWithUnitsFeature(DCT, needs=windowed, store=True)

        fft = ArrayWithUnitsFeature(FFT, needs=windowed, store=store_fft)

        bark = ArrayWithUnitsFeature(BarkBands,
                                     needs=fft,
                                     frequency_band=band,
                                     store=True)

        centroid = ArrayWithUnitsFeature(SpectralCentroid,
                                         needs=bark,
                                         store=True)

        chroma = ArrayWithUnitsFeature(Chroma,
                                       needs=fft,
                                       frequency_band=band,
                                       store=True)

        bfcc = ArrayWithUnitsFeature(BFCC, needs=fft, store=True)
Esempio n. 16
0
 class Document(fa):
     rasterized = ArrayWithUnitsFeature(
         lambda fa: fa.rasterize(64).astype(np.float32),
         needs=fa.freq_adaptive,
         store=True)
Esempio n. 17
0
 class Sound(rs):
     windowed = ArrayWithUnitsFeature(SlidingWindow,
                                      wscheme=wscheme,
                                      wfunc=wfunc,
                                      needs=rs.resampled,
                                      store=store_windowed)
Esempio n. 18
0
 class Document(BaseModel, PersistenceSettings):
     source = ArrayWithUnitsFeature(MergeTester, store=True)
     merged = ArrayWithUnitsFeature(Merge, needs=[source], store=True)
Esempio n. 19
0
 class Document(BaseModel):
     windowed = ArrayWithUnitsFeature(SlidingWindow,
                                      wscheme=sw,
                                      store=True)
Esempio n. 20
0
 class Document(rs):
     windowed = ArrayWithUnitsFeature(SlidingWindow,
                                      wscheme=HalfLapped(),
                                      needs=rs.resampled,
                                      store=True)