-
Notifications
You must be signed in to change notification settings - Fork 179
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
Collect audio property values #28
Labels
enhancement
New feature or request
Comments
Concept inspired by https://audiofingerprint.openwpm.com: const hashMini = str => {
const json = `${JSON.stringify(str)}`
let i, len, hash = 0x811c9dc5
for (i = 0, len = json.length; i < len; i++) {
hash = Math.imul(31, hash) + json.charCodeAt(i) | 0
}
return ('0000000' + (hash >>> 0).toString(16)).substr(-8)
}
const getAudioProps = () => {
const contextOffline = OfflineAudioContext || webkitOfflineAudioContext
const audioOffline = new contextOffline(1, 44100, 44100)
const oscillator = audioOffline.createOscillator()
const dynamicsCompressor = audioOffline.createDynamicsCompressor()
const analyser = audioOffline.createAnalyser()
const biquadFilter = audioOffline.createBiquadFilter()
const audioData = {
analyserChannelCount: analyser.channelCount,
analyserChannelCountMode: analyser.channelCountMode,
analyserChannelInterpretation: analyser.channelInterpretation,
analyserSampleRate: analyser.context.sampleRate,
analyserFftSize: analyser.fftSize,
analyserFrequencyBinCount: analyser.frequencyBinCount,
analyserMaxDecibels: analyser.maxDecibels,
analyserMinDecibels: analyser.minDecibels,
analyserNumberOfInputs: analyser.numberOfInputs,
analyserNumberOfOutputs: analyser.numberOfOutputs,
analyserSmoothingTimeConstant: analyser.smoothingTimeConstant,
analyserContextListenerForwardXMax: analyser.context.listener.forwardX.maxValue,
dynamicsCompressorAttackDefault: dynamicsCompressor.attack.defaultValue,
dynamicsCompressorKneeDefault: dynamicsCompressor.knee.defaultValue,
dynamicsCompressorKneeMax: dynamicsCompressor.knee.maxValue,
dynamicsCompressorRatioDefault: dynamicsCompressor.ratio.defaultValue,
dynamicsCompressorRatioMax: dynamicsCompressor.ratio.maxValue,
dynamicsCompressorReleaseDefault: dynamicsCompressor.release.defaultValue,
dynamicsCompressorReleaseMax: dynamicsCompressor.release.maxValue,
dynamicsCompressorThresholdDefault: dynamicsCompressor.threshold.defaultValue,
dynamicsCompressorThresholdMin: dynamicsCompressor.threshold.minValue,
oscillatorDetuneMax: oscillator.detune.maxValue,
oscillatorDetuneMin: oscillator.detune.minValue,
oscillatorFrequencyDefault: oscillator.frequency.defaultValue,
oscillatorFrequencyMax: oscillator.frequency.maxValue,
oscillatorFrequencyMin: oscillator.frequency.minValue,
biquadFilterGainMax: biquadFilter.gain.maxValue,
biquadFilterFrequencyMax: biquadFilter.frequency.maxValue,
biquadFilterFrequencyMin: biquadFilter.frequency.minValue
}
//console.log(biquadFilter)
return audioData
}
a = getAudioProps()
console.log(a) |
abrahamjuliot
added a commit
that referenced
this issue
Jul 19, 2020
abrahamjuliot
added a commit
that referenced
this issue
Jul 31, 2020
abrahamjuliot
added a commit
that referenced
this issue
Jul 31, 2020
abrahamjuliot
added a commit
that referenced
this issue
Aug 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: