Audio Data

Audio DataBlocks and show_batch

source

Spectrogram

 Spectrogram (n_fft:Listified[int]=1024,
              win_length:Listified[int]|None=None,
              hop_length:Listified[int]|None=None, pad:Listified[int]=0,
              window_fn:Listified[Callable[...,Tensor]]=<built-in method
              hann_window of type object at 0x7f95e7c335c0>,
              power:Listified[float]=2.0,
              normalized:Listified[bool]=False,
              wkwargs:Listified[dict]|None=None,
              center:Listified[bool]=True,
              pad_mode:Listified[str]='reflect',
              onesided:Listified[bool]=True,
              norm:Listified[str]|None=None)

Convert a TensorAudio into one or more TensorSpec


source

MelSpectrogram

 MelSpectrogram (sample_rate:Listified[int]=16000,
                 n_fft:Listified[int]=1024,
                 win_length:Listified[int]|None=None,
                 hop_length:Listified[int]|None=None,
                 f_min:Listified[float]=0.0,
                 f_max:Listified[float]|None=None, pad:Listified[int]=0,
                 n_mels:Listified[int]=128,
                 window_fn:Listified[Callable[...,Tensor]]=<built-in
                 method hann_window of type object at 0x7f95e7c335c0>,
                 power:Listified[float]=2.0,
                 normalized:Listified[bool]=False,
                 wkwargs:Listified[dict]|None=None,
                 center:Listified[bool]=True,
                 pad_mode:Listified[str]='reflect',
                 norm:Listified[str]|None=None,
                 mel_scale:Listified[str]='htk')

Convert a TensorAudio into one or more TensorMelSpec

TransformBlocks for audio

Audio data blocks for using with the fastai data block API.


source

AudioBlock

 AudioBlock (cls=<class 'fastxtend.audio.core.TensorAudio'>)

A TransformBlock for audio of cls


source

SpecBlock

 SpecBlock (cls=<class 'fastxtend.audio.core.TensorAudio'>, n_fft:Union[in
            t,Iterable[int],MutableSequence[int],fastcore.foundation.L,fas
            tcore.basics.fastuple]=1024, win_length:Union[int,Iterable[int
            ],MutableSequence[int],fastcore.foundation.L,fastcore.basics.f
            astuple,NoneType]=None, hop_length:Union[int,Iterable[int],Mut
            ableSequence[int],fastcore.foundation.L,fastcore.basics.fastup
            le,NoneType]=None, pad:Union[int,Iterable[int],MutableSequence
            [int],fastcore.foundation.L,fastcore.basics.fastuple]=0, windo
            w_fn:Union[Callable[...,torch.Tensor],Iterable[Callable[...,to
            rch.Tensor]],MutableSequence[Callable[...,torch.Tensor]],fastc
            ore.foundation.L,fastcore.basics.fastuple]=<built-in method
            hann_window of type object at 0x7f95e7c335c0>, power:Union[flo
            at,Iterable[float],MutableSequence[float],fastcore.foundation.
            L,fastcore.basics.fastuple]=2.0, normalized:Union[bool,Iterabl
            e[bool],MutableSequence[bool],fastcore.foundation.L,fastcore.b
            asics.fastuple]=False, wkwargs:Union[dict,Iterable[dict],Mutab
            leSequence[dict],fastcore.foundation.L,fastcore.basics.fastupl
            e,NoneType]=None, center:Union[bool,Iterable[bool],MutableSequ
            ence[bool],fastcore.foundation.L,fastcore.basics.fastuple]=Tru
            e, pad_mode:Union[str,Iterable[str],MutableSequence[str],fastc
            ore.foundation.L,fastcore.basics.fastuple]='reflect', norm:Uni
            on[str,Iterable[str],MutableSequence[str],fastcore.foundation.
            L,fastcore.basics.fastuple,NoneType]=None)

A TransformBlock to read TensorAudio and then use the GPU to turn audio into one or more Spectrograms

Type Default Details
cls _TensorMeta TensorAudio
n_fft Listified[int] 1024 Spectrogram args
win_length Listified[int] | None None
hop_length Listified[int] | None None
pad Listified[int] 0
window_fn Listified[Callable[…, Tensor]] hann_window
power Listified[float] 2.0
normalized Listified[bool] False
wkwargs Listified[dict] | None None
center Listified[bool] True
pad_mode Listified[str] reflect
norm Listified[str] | None None

source

MelSpecBlock

 MelSpecBlock (cls=<class 'fastxtend.audio.core.TensorAudio'>, sr:Union[in
               t,Iterable[int],MutableSequence[int],fastcore.foundation.L,
               fastcore.basics.fastuple]=16000, n_fft:Union[int,Iterable[i
               nt],MutableSequence[int],fastcore.foundation.L,fastcore.bas
               ics.fastuple]=1024, win_length:Union[int,Iterable[int],Muta
               bleSequence[int],fastcore.foundation.L,fastcore.basics.fast
               uple,NoneType]=None, hop_length:Union[int,Iterable[int],Mut
               ableSequence[int],fastcore.foundation.L,fastcore.basics.fas
               tuple,NoneType]=None, f_min:Union[float,Iterable[float],Mut
               ableSequence[float],fastcore.foundation.L,fastcore.basics.f
               astuple]=0.0, f_max:Union[float,Iterable[float],MutableSequ
               ence[float],fastcore.foundation.L,fastcore.basics.fastuple,
               NoneType]=None, pad:Union[int,Iterable[int],MutableSequence
               [int],fastcore.foundation.L,fastcore.basics.fastuple]=0, n_
               mels:Union[int,Iterable[int],MutableSequence[int],fastcore.
               foundation.L,fastcore.basics.fastuple]=128, window_fn:Union
               [Callable[...,torch.Tensor],Iterable[Callable[...,torch.Ten
               sor]],MutableSequence[Callable[...,torch.Tensor]],fastcore.
               foundation.L,fastcore.basics.fastuple]=<built-in method
               hann_window of type object at 0x7f95e7c335c0>, power:Union[
               float,Iterable[float],MutableSequence[float],fastcore.found
               ation.L,fastcore.basics.fastuple]=2.0, normalized:Union[boo
               l,Iterable[bool],MutableSequence[bool],fastcore.foundation.
               L,fastcore.basics.fastuple]=False, wkwargs:Union[dict,Itera
               ble[dict],MutableSequence[dict],fastcore.foundation.L,fastc
               ore.basics.fastuple,NoneType]=None, center:Union[bool,Itera
               ble[bool],MutableSequence[bool],fastcore.foundation.L,fastc
               ore.basics.fastuple]=True, pad_mode:Union[str,Iterable[str]
               ,MutableSequence[str],fastcore.foundation.L,fastcore.basics
               .fastuple]='reflect', norm:Union[str,Iterable[str],MutableS
               equence[str],fastcore.foundation.L,fastcore.basics.fastuple
               ,NoneType]=None, mel_scale:Union[str,Iterable[str],MutableS
               equence[str],fastcore.foundation.L,fastcore.basics.fastuple
               ]='htk')

A TransformBlock to read TensorAudio and then use the GPU to turn audio into one or more MelSpectrograms

Type Default Details
cls _TensorMeta TensorAudio
sr Listified[int] 16000 MelSpectrogram args
n_fft Listified[int] 1024
win_length Listified[int] | None None
hop_length Listified[int] | None None
f_min Listified[float] 0.0
f_max Listified[float] | None None
pad Listified[int] 0
n_mels Listified[int] 128
window_fn Listified[Callable[…, Tensor]] hann_window
power Listified[float] 2.0
normalized Listified[bool] False
wkwargs Listified[dict] | None None
center Listified[bool] True
pad_mode Listified[str] reflect
norm Listified[str] | None None
mel_scale Listified[str] htk