Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two features in WebAudio gets values out of range #1197

Open
Oortone opened this issue Feb 20, 2022 · 1 comment
Open

Two features in WebAudio gets values out of range #1197

Oortone opened this issue Feb 20, 2022 · 1 comment
Labels

Comments

@Oortone
Copy link

Oortone commented Feb 20, 2022

Describe the bug
SpectralSlope and spectralKurtosis gets values out of range (as stated in documentation) when used in WebAudio in Chrome.

To Reproduce
I initialize Meyda at 48 kHz like this (a bit simplified but in general):

audioCtx = new AudioContext({sampleRate: 48000})
stream = await navigator.mediaDevices.getUserMedia({ audio : {echoCancellation: false, noiseReduction: false, autoGainControl: false}, video: false })
 inputStream = audioCtx.createMediaStreamSource(stream)

  volumeOut = audioCtx.createGain()  
  volumeOut.connect(audioCtx.destination)
  inputStream.connect(volumeOut)
  volumeOut.gain.value = 0.1
  analysisGain = audioCtx.createGain() 
  inputStream.connect(analysisGain)
  analysisGain.gain.value = 2

  analyzer = Meyda.createMeydaAnalyzer({
    'audioContext': audioCtx,
    'source': analysisGain,
    'sampleRate': 48000,
    'bufferSize': 2048,
    'hopSize': 2048,
    'numberOfMFCCCoefficients': 0,
    'windowingFunction': 'hanning', 
    'featureExtractors': ["spectralSlope"],
    'callback': onNewFeatures     //this prints values and calculates max and min
  })

These are examples of erraneous ranges (presented as [min, max]) I got when playing some audio to the browser input:

spectralSlope: I got - [-1.1e-9, 7.8e-8] - documentation range: 0.0 - 1.0
spectralKurtosis: I got - [-354, 299] - documentation range: 0.0 - 1.0

Also tried 44100 sampling frequency but same thing.

Expected behavior
The two features being in the documented range. spectralSlope in general have extremely small values so even when they are all positive the are never anyway near 1.0, seldom above 10e-7.

Environment configuration
Meyda in Chrome Version 98.0.4758.102 on macOS 10.14.6
Audio in via USB-Class compliant Mackie Onyx @ 48kHz (and @ 44.1)

@Oortone Oortone added the bug label Feb 20, 2022
@hughrawlinson
Copy link
Member

Hmm, that does sound like either a bug or a documentation issue - I'll look into this when I can, thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants