Skip to content

Commit

Permalink
fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Jul 10, 2016
1 parent 7d4cac2 commit de9c5b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pumpp/feature/mel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@


class Mel(FeatureExtractor):
'''Mel spectra feature extraction
Attributes
----------
name : str or None
naming scope for this feature extractor
sr : number > 0
Sampling rate of the audio (in Hz)
hop_length : int > 0
Number of samples to advance between frames
n_fft : int > 0
Number of samples per frame
n_mels : int > 0
Number of Mel frequency bins
fmax : number > 0
The maximum frequency bin.
Defaults to `0.5 * sr`
'''
def __init__(self, name, sr, hop_length, n_fft, n_mels, fmax=None):

super(Mel, self).__init__(name, sr, hop_length)
Expand All @@ -22,7 +44,6 @@ def __init__(self, name, sr, hop_length, n_fft, n_mels, fmax=None):
self.register('mag', [None, n_mels], np.float32)

def transform_audio(self, y):

mel = np.sqrt(librosa.feature.melspectrogram(y=y, sr=self.sr, n_fft=self.n_fft,
hop_length=self.hop_length,
n_mels=self.n_mels,
Expand Down
3 changes: 3 additions & 0 deletions pumpp/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class BaseTaskTransformer(Scope):
def __init__(self, name, namespace, sr, hop_length):
super(BaseTaskTransformer, self).__init__(name)

# This will trigger an exception if the namespace is not found
jams.schema.is_dense(namespace)

self.namespace = namespace
self.sr = sr
self.hop_length = hop_length
Expand Down

0 comments on commit de9c5b3

Please sign in to comment.