2

I have made an audioCtx in JavaScript using the AudioContext() class. I have an analyser made with audioCtx.createAnalyser(). If my audio is an audio tag and I make a source with audioCtx.createMediaElementSource(audio) then pass that to the analyser: source.connect(analyser); this works - I receive data. I can also connect a mic using audioCtx.createMediaStreamSource(stream); etc.

BUT, if my source is a CreateJS AbstractSoundInstance object (called input) which has a playbackResource property (the sound is playing) that returns an AudioBuffer object:

AudioBuffer { sampleRate: 44100, length: 5961072, duration: 135.1717006802721, numberOfChannels: 2 }

I can't seem to connect this. I have tried

var source = audioCtx.createBufferSource(input.playbackResource);

and then tried connecting the destination with analyser.connect(audioCtx.destination); but I cannot get any data. The only hook I seem to have into the CreateJS sound is the playbackResource - the SoundJS docs say: "For example, WebAudioPlugin will set an array buffer."

Any recommendations on how to pass that AudioBuffer to the Analyser (Lanny? Grant?) Thanks!

Dan Zen
  • 480
  • 3
  • 10
  • Name-dropped in an SO post? I can take a look. – Lanny Jun 20 '17 at 02:30
  • Thanks - sorry for the name drop. Here is some example code with attempts and comments. http://zimjs.com/code/lights/wave3.html. In general, I don't seem to get any data from this: var source = audioCtx.createBufferSource(soundInstance.playbackResource); when using the WebAudio plugin but I do get data from this: var source = audioCtx.createMediaElementSource(soundInstance.playbackResource); when I use the HTMLAudio plugin. – Dan Zen Jun 21 '17 at 05:47
  • 1
    anybody have any thoughts? – Dan Zen Jul 14 '17 at 01:44

0 Answers0