[flocking] sonogram

Colin Clark colin at colinclark.org
Fri Nov 20 20:28:54 UTC 2015


Hi Alfredo,

Sorry for the delay in responding. Flocking 0.2.0 hasn't yet been released, so you'll need to download the code from the "core-refactoring" branch or check it out manually using Git. The final, packaged 0.2.0 release will probably not happen until the new year (unfortunately).

Here's the link to download a zip file of the current latest working branch of 0.2.0:

https://github.com/colinbdclark/Flocking/archive/core-refactoring.zip <https://github.com/colinbdclark/Flocking/archive/core-refactoring.zip>

Your sample code, however, won't quite work as-is. You need to connect your analyser using something like the example I provided in a previous email. For example, by creating the analyser node using the Flocking Native Node Manager's createOutputNode() method or by creating it yourself manually and then using the insertOutput() method to insert it into Flocking's native node chain. Here's an example of the latter:

var enviro = flock.init();

var analyser; // Assume this exists (because you created it already)

enviro.audioSystem.nativeNodeManager.insertOutput(analyser);

Good luck with it and let me know how it goes!


Colin

> On Nov 16, 2015, at 7:02 PM, Alfredo Ardia <alfredoardia at gmail.com> wrote:
> 
> Hi,
> I managed to follow the voice-change-o-matic example which was in the second of Adam links and I wrote a simpler version with just an oscillator and a spectrum analizer... to wire those I used this syntax which works fine:
> 
> oscillator.connect(analyser);
> analyser.connect(audioCtx.destination);
> 
> now I'm trying to use a flocking script instead the oscillator. So I have myFlock.js and the visualizer.js scripts. 
> I though to connect those as before so in visualizer.js I wrote:
> 
> var source = myFlock.play();
> 
> source.connect(analyser);
> analyser.connect(audioCtx.destination);
> 
> as I expected it doesn't works...myFlock.js script plays but it is not routed into the visualizer..
> 
> @Colin: I haven't found Flocking 0.2.0..the latest release I found is the 0.1.4 here:
> https://github.com/colinbdclark/Flocking/releases <https://github.com/colinbdclark/Flocking/releases>
> 
> 
> 2015-11-10 17:34 GMT+01:00 Alfredo Ardia <alfredoardia at gmail.com <mailto:alfredoardia at gmail.com>>:
> Hi Colin, thanks! 
> These references look really helpful, sure I will spend my weekends on it. I'll let you know how it goes..
> Bests
> 
> 2015-11-10 16:05 GMT+01:00 Colin Clark <colin at colinclark.org <mailto:colin at colinclark.org>>:
> Hi Alfredo,
> 
> You'll probably want to so know some JavaScript to use Flocking, yes. The Mozilla Developer Network link that Adam provided has a lot of really good information about how to learn JavaScript:
> 
> https://developer.mozilla.org/en-US/Learn/JavaScript <https://developer.mozilla.org/en-US/Learn/JavaScript>
> 
> Also, Marijn Haverbeke's Eloquent JavaScript is free to read online and a very good book:
> 
> http://eloquentjavascript.net/ <http://eloquentjavascript.net/>
> 
> I hope this helps!
> 
> Colin
> 
> 
>> On Nov 10, 2015, at 4:09 AM, Alfredo Ardia <alfredoardia at gmail.com <mailto:alfredoardia at gmail.com>> wrote:
>> 
>> Hey guy thanks, your answers are really helpful. I'm a Supercollider user and I found Floacking really friendly but I don't really know Java or the Web Audio API...I guess I should begin from the basics of Java so that I can understand the example right? 
>> 
>> 2015-11-09 16:29 GMT+01:00 Colin Clark <colin at colinclark.org <mailto:colin at colinclark.org>>:
>> Thanks, Adam!
>> 
>> Alfredo, there are a couple of caveats with using native Web Audio Nodes in Flocking right now. At the moment, they're restricted to being located at either the beginning or the end of the node graph. So in the case of the AnalyserNode, you're restricted to visualizing all Flocking synths that are currently sounding; you can't visualize only an individual synth or unit generator.
>> 
>> The alternative, if you need to be able to visualize individual ugens or synths, is to write your own sonogram unit generator using the ArrayMath FFT library that ships with Flocking. I could coach you through it if you're interested.
>> 
>> This isn't, of course, ideal. I am working on a new architecture for Flocking 0.4.0 that will allow you to easily interleave Flocking unit generators with Web Audio native nodes. In the interim, there is a basic API for managing input and output nodes. I recommend using the unreleased 0.2.0 version (the master branch in Github, available for testing here: http://flockingjs.org/next/ <http://flockingjs.org/next/>) if you're doing any work with native nodes; I've substantially improved support there.
>> 
>> Here's how you can insert a node into the output chain after the Flocking Script Processor Node using Flocking 0.2.0:
>> 
>> var enviro = flock.init(),
>>       context = enviro.audioSystem.context;
>> 
>> var analyser = flock.environment.audioSystem.nativeNodeManager.createOutputNode({
>>     node: "Analyser",
>>     props: {
>>         fftSize: 2048
>>     },
>> });
>> 
>> I hope this helps, and I'm looking forward to seeing what you make with Flocking!
>> 
>> Colin
>> 
>>> On Nov 9, 2015, at 8:30 AM, Adam Tindale <adamrtindale at gmail.com <mailto:adamrtindale at gmail.com>> wrote:
>>> 
>>> Hi, 
>>> 
>>> There isn't a sonogram builtin but there are a few examples of sonograms across the web. 
>>> 
>>> Google has a very nice WebGL demo here: 
>>> 
>>> https://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-gl.html <https://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-gl.html>
>>> 
>>> Flocking.js runs in a ScriptProcessorNode of WebAudio. What you would have to do to wire these two examples together is to get Flocking.js to be in the audio chain before their analyserNode. 
>>> 
>>> There is a simple and clear example on MDN about this, though the demo shows a frequency histogram instead of a sonogram:
>>> 
>>> https://developer.mozilla.org/en/docs/Web/API/AnalyserNode <https://developer.mozilla.org/en/docs/Web/API/AnalyserNode>
>>> 
>>> a
>>> 
>>> On Sun, 8 Nov 2015 at 16:31 Alfredo Ardia <alfredoardia at gmail.com <mailto:alfredoardia at gmail.com>> wrote:
>>> Hi all,
>>> I just started to use flocking, it's great!
>>> I am looking for a way to visualize sounds with a real time sonogram/spectrogram instead of the scope.. is there any sonogram ugen?
>>> 
>>> _______________________________________________
>>> flocking mailing list
>>> flocking at lists.idrc.ocad.ca <mailto:flocking at lists.idrc.ocad.ca>
>>> http://lists.idrc.ocad.ca/mailman/listinfo/flocking <http://lists.idrc.ocad.ca/mailman/listinfo/flocking>
>>> _______________________________________________
>>> flocking mailing list
>>> flocking at lists.idrc.ocad.ca <mailto:flocking at lists.idrc.ocad.ca>
>>> http://lists.idrc.ocad.ca/mailman/listinfo/flocking <http://lists.idrc.ocad.ca/mailman/listinfo/flocking>
>> 
>> 
>> 
>> 
>> -- 
>> Alfredo Ardia
>> 
>> http://alfredoardia.altervista.org/ <http://alfredoardia.altervista.org/>
>> 
> 
> 
> 
> 
> -- 
> Alfredo Ardia
> 
> http://alfredoardia.altervista.org/ <http://alfredoardia.altervista.org/>
> 
> 
> 
> 
> -- 
> Alfredo Ardia
> 
> http://alfredoardia.altervista.org/ <http://alfredoardia.altervista.org/>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idrc.ocad.ca/pipermail/flocking/attachments/20151120/9ae00090/attachment.html>


More information about the flocking mailing list