Module Import alias identifier Import alias Import alias identifier Import alias identifier ImportFrom alias Import alias identifier ImportFrom alias alias alias alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults TupleLoad Num Num TupleLoad Num Num Call AttributeLoad NameLoad attr keyword Num NameLoad body Assign TupleStore NameStore NameStore NameLoad Assign TupleStore NameStore NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpMult NameLoad Num Num NameLoad Assign NameStore Call NameLoad NameLoad keyword Str keyword AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Print BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Import alias alias FunctionDef arguments args defaults body Print Str Expr Call NameLoad decorator_list TryExcept body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num Str handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Print NameLoad Expr Call NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call NameLoad Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Print BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Str Assign NameStore Num Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Num For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Assert CompareIn NameLoad TupleLoad Str Str Str Str Str Str Str Str Str Str orelse If CompareEq NameLoad Str body Assign NameStore NameLoad If BoolOpOr CompareIs NameLoad NameLoad CompareGt NameLoad AttributeLoad NameLoad attr body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore NameLoad If CompareEq NameLoad Str body Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad Assign NameStore ListLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Num Assign TupleStore NameStore NameStore TupleLoad Num Num Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign TupleStore NameStore NameStore ListComp Call NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore ListLoad ListLoad Assign NameStore Call NameLoad NameLoad For NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr orelse If CompareEq NameLoad Str body Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad Assign NameStore ListLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Str Call NameLoad BinOpDiv BinOpSub NameLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad keyword Num keyword Num keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad body If CompareEq BinOpMod NameLoad Num Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Num Assign NameStore Num Assign NameStore NameLoad For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Assign NameStore ListLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Str Call NameLoad BinOpDiv BinOpSub NameLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad keyword Num keyword Num keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad body If CompareEq BinOpMod NameLoad Num Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Print Str orelse If CompareEq NameLoad Str body Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore ListLoad Num Num Assign NameStore NameLoad For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore ListComp Call NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Str Num orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Assign NameStore ListLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Str Call NameLoad BinOpDiv BinOpSub NameLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad keyword SubscriptLoad NameLoad Index Num keyword SubscriptLoad NameLoad Index Num keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad body If CompareEq BinOpMod NameLoad Num Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Print Str orelse If CompareIn NameLoad TupleLoad Str Str Str Str Str body Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore ListLoad Num Num Assign NameStore NameLoad For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore ListComp Call NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Str Num orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Assign NameStore ListLoad ListLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Print Str Call NameLoad BinOpDiv BinOpSub NameLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad keyword SubscriptLoad NameLoad Index Num keyword SubscriptLoad NameLoad Index Num keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad body If CompareEq BinOpMod NameLoad Num Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Print Str Assign TupleStore NameStore NameStore TupleLoad Num Num If CompareIn NameLoad TupleLoad Str Str Str body Assign NameStore BinOpPow Num BinOpDiv NameLoad Num For NameStore NameLoad body For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpDiv NameLoad Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad orelse If CompareIn NameLoad TupleLoad Str Str Str Str Str Str body Assign NameStore BinOpPow Num BinOpDiv NameLoad Num For NameStore NameLoad body For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad TupleLoad Num Call NameLoad SubscriptLoad NameLoad Index Num TupleLoad Num Call NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num keyword NameLoad keyword NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr
N/A N/A numpy np N/A matplotlib N/A matplotlib.pyplot plt N/A matplotlib.cm cm matplotlib.image NonUniformImage N/A matplotlib.colors colo dear.spectrum cqt dft auditory SpectrogramFile dear.analysis MFCCs plot_spectrogram N/A N/A spec Xd Yd norm figname N/A N/A 0 1 N/A 0 1 N/A N/A colo LogNorm vmin 1e-06 None N/A N/A N/A x_min x_max Xd N/A N/A y_min y_max Yd N/A fig N/A N/A plt figure num figname N/A nf N/A len spec N/A N/A ch data N/A enumerate spec N/A N/A x N/A N/A np linspace x_min x_max N/A N/A data shape N/A 0 N/A y N/A N/A np linspace y_min y_max N/A N/A data shape N/A 1 N/A ax N/A N/A fig add_subplot N/A N/A N/A nf 100 11 ch N/A im N/A NonUniformImage ax interpolation bilinear cmap N/A cm gray_r norm norm N/A N/A N/A im set_data x y N/A data T N/A N/A N/A N/A ax images append im N/A N/A N/A ax set_xlim x_min x_max N/A N/A N/A ax set_ylim y_min y_max N/A N/A N/A ax set_title N/A Channel %d ch N/A N/A N/A ax set_ylabel frequency N/A N/A Statistics: max<%.3f> min<%.3f> mean<%.3f> median<%.3f> N/A N/A N/A data max N/A N/A data min N/A N/A data mean N/A N/A np median data N/A N/A N/A plt show N/A N/A N/A __name__ __main__ N/A N/A getopt sys exit_with_usage N/A N/A N/A N/A N/A Usage: $ python -m dear.spectrogram <options> /path/to/song

Options:
    [-s]    start time in second, default 0
    [-t]    end time, default is duration of song
    [-o]    output file
    [-g]    type of spectrogram, default dft:

        dft --- Discrete Fourier Transform
            [-w]    window size, default 2048
            [-h]    step size, default 512

        cqt --- Constant-Q Transform
            [-q]    Q, default 34
            [-h]    hop in second, default 0.02

        cnt --- Constant-N Transform
            [-n]    N, default 24
            [-h]    hop in second, default 0.02
            [-r]    resize window size of each of the bands if specified.

        gmt --- Gammatone Wavelet Transform
            [-n]    N, default 64
            [-w]    combine length in second, default 0.025
            [-h]    hop in second, default 0.01
            [-f]    frequency boundary, default (110, 4200)

        Y1...Y5 --- Auditory Spectrograms
            [-n]    N, default 64
            [-f]    frequency boundary, default (110, 4200)
            [-c]    Combine frames by -w and -h.
            [-w]    combine length in second, default 0.025
            [-h]    hop in second, default 0.01

        mfcc --- MFCCs Spectrogram
            [-n]    number of bands, default 20
            [-w]    window size, default 2048
            [-h]    step size, default 1024
            [-f]    frequency boundary, default (0, 7040)
 N/A N/A exit N/A N/A N/A N/A N/A opts args N/A N/A getopt getopt N/A N/A sys argv N/A 1 g:s:t:o:h:w:q:n:f:b:rc N/A N/A N/A N/A getopt GetoptError N/A ex N/A N/A ex N/A N/A exit_with_usage N/A N/A N/A len args 1 N/A N/A N/A exit_with_usage N/A dear.io io N/A decoder N/A N/A io get_decoder name audioread N/A audio N/A N/A decoder Audio N/A args N/A 0 N/A N/A SampleRate: %d Hz
Channel(s): %d
Duration: %d sec N/A N/A audio samplerate N/A audio channels N/A audio duration N/A graph dft N/A st 0 N/A to None N/A outfile None N/A norm N/A N/A colo LogNorm vmin 1e-06 N/A N/A o a opts N/A N/A N/A o -s N/A N/A st N/A float a N/A N/A N/A o -t N/A N/A to N/A float a N/A N/A N/A o -g N/A N/A graph a N/A N/A graph N/A dft cqt cnt gmt Y1 Y2 Y3 Y4 Y5 mfcc N/A N/A N/A o -o N/A N/A outfile a N/A N/A N/A to None N/A to N/A audio duration N/A N/A r_to N/A audio duration N/A N/A r_to to N/A N/A graph dft N/A N/A win 2048 N/A hop 512 N/A N/A o a opts N/A N/A N/A o -w N/A N/A win N/A int a N/A N/A N/A o -h N/A N/A hop N/A int a N/A spec N/A N/A N/A gram N/A N/A dft PowerSpectrum audio N/A freqs N/A N/A gram walk win hop start st end to join_channels True N/A N/A N/A N/A N/A spec N/A 0 append freqs N/A N/A N/A graph mfcc N/A N/A N 20 N/A N/A fmin fmax N/A 0.0 7040.0 N/A win 2048 N/A hop 1024 N/A N/A o a opts N/A N/A N/A o -w N/A N/A win N/A int a N/A N/A N/A o -h N/A N/A hop N/A int a N/A N/A N/A o -n N/A N/A N N/A int a N/A N/A N/A o -f N/A N/A N/A fmin fmax N/A N/A float f N/A f N/A N/A a split , 1 N/A spec N/A N/A N/A gram N/A MFCCs audio N/A freqs N/A N/A gram walk N fmin fmax win hop st to N/A N/A N/A N/A N/A spec N/A 0 append freqs N/A norm N/A N/A colo Normalize N/A N/A N/A graph cqt N/A N/A Q 34 N/A hop 0.02 N/A N/A o a opts N/A N/A N/A o -q N/A N/A Q N/A int a N/A N/A N/A o -h N/A N/A hop N/A float a N/A spec N/A N/A N/A gram N/A N/A cqt CQTPowerSpectrum audio N/A total: N/A int N/A N/A r_to st hop N/A N/A t freqs N/A enumerate N/A N/A gram walk Q Q freq_base 55.0 freq_max 7040 hop hop start st end to join_channels True N/A N/A N/A N/A t 100 0 N/A N/A N/A N/A N/A sys stdout write N/A %d... t N/A N/A N/A N/A sys stdout flush N/A N/A N/A N/A spec N/A 0 append freqs N/A N/A N/A graph cnt N/A N/A N 24 N/A hop 0.02 N/A rw False N/A N/A o a opts N/A N/A N/A o -n N/A N/A N N/A int a N/A N/A N/A o -h N/A N/A hop N/A float a N/A N/A N/A o -r N/A N/A rw True N/A spec N/A N/A N/A gram N/A N/A cqt CNTPowerSpectrum audio N/A total: N/A int N/A N/A r_to st hop N/A N/A t freqs N/A enumerate N/A N/A gram walk N N freq_base 55.0 freq_max 7040 hop hop start st end to resize_win rw N/A N/A N/A N/A t 100 0 N/A N/A N/A N/A N/A sys stdout write N/A %d... t N/A N/A N/A N/A sys stdout flush N/A N/A N/A N/A spec N/A 0 append freqs N/A N/A N/A N/A graph gmt N/A N/A N 64 N/A win 0.025 N/A hop 0.01 N/A freqs N/A 110.0 4435.0 N/A combine False N/A N/A o a opts N/A N/A N/A o -n N/A N/A N N/A int a N/A N/A N/A o -h N/A N/A hop N/A float a N/A N/A N/A o -w N/A N/A win N/A float a N/A N/A N/A o -f N/A N/A freqs N/A N/A float f N/A f N/A N/A a split , 1 N/A N/A N/A o -c N/A N/A combine True N/A spec N/A N/A N/A gram N/A N/A auditory GammatoneSpectrum audio N/A total: N/A int N/A N/A r_to st hop N/A N/A t freqs N/A enumerate N/A N/A gram walk N N freq_base N/A freqs N/A 0 freq_max N/A freqs N/A 1 start st end to combine combine twin win thop hop N/A N/A N/A N/A t 100 0 N/A N/A N/A N/A N/A sys stdout write N/A %d... t N/A N/A N/A N/A sys stdout flush N/A N/A N/A N/A spec N/A 0 append freqs N/A N/A N/A N/A graph N/A Y1 Y2 Y3 Y4 Y5 N/A N/A N 64 N/A win 0.025 N/A hop 0.01 N/A freqs N/A 110.0 4435.0 N/A combine False N/A N/A o a opts N/A N/A N/A o -n N/A N/A N N/A int a N/A N/A N/A o -h N/A N/A hop N/A float a N/A N/A N/A o -w N/A N/A win N/A float a N/A N/A N/A o -f N/A N/A freqs N/A N/A float f N/A f N/A N/A a split , 1 N/A N/A N/A o -c N/A N/A combine True N/A spec N/A N/A N/A gram N/A getattr auditory graph N/A gram N/A gram audio N/A total: N/A int N/A N/A r_to st hop N/A N/A t freqs N/A enumerate N/A N/A gram walk N N freq_base N/A freqs N/A 0 freq_max N/A freqs N/A 1 start st end to combine combine twin win thop hop N/A N/A N/A N/A t 100 0 N/A N/A N/A N/A N/A sys stdout write N/A %d... t N/A N/A N/A N/A sys stdout flush N/A N/A N/A N/A spec N/A 0 append freqs N/A N/A N/A dBmax dBmin N/A -15.0 -70.0 N/A N/A graph N/A dft cqt cnt N/A N/A magmin N/A 10 N/A dBmin 20 N/A g spec N/A N/A N/A i frame N/A enumerate g N/A N/A N/A g N/A i N/A 20 N/A N/A np log10 N/A N/A np maximum N/A frame 20.0 magmin N/A norm N/A N/A colo Normalize vmin dBmin vmax dBmax N/A N/A N/A graph N/A gmt Y1 Y2 Y3 Y4 Y5 N/A N/A magmin N/A 10 N/A dBmin 20 N/A g spec N/A N/A N/A i frame N/A enumerate g N/A N/A N/A g N/A i N/A 20 N/A N/A np log10 N/A N/A np maximum frame magmin N/A norm N/A N/A colo Normalize vmin dBmin vmax dBmax N/A figname N/A %s - %s N/A graph N/A audio path N/A N/A plot_spectrogram N/A N/A np array spec N/A 0 N/A len N/A spec N/A 0 N/A 0 N/A len N/A N/A spec N/A 0 N/A 0 norm norm figname figname N/A outfile N/A N/A out N/A SpectrogramFile outfile w N/A N/A N/A out dump N/A spec N/A 0 N/A N/A N/A out close