[flocking-users] Newbie

Colin Clark colin at colinclark.org
Tue Nov 12 12:17:39 EST 2013


Hi Roger,

It looks like you've stumbled across a bug in the Flocking grunt scripts. Sorry about that. The audio decoding module of Flocking uses Web Workers to decode audio files without blocking the browser's main thread. This requires a couple of standalone JavaScript files to be available for dynamic loading whenever an audio file is parsed. They weren't being copied correctly to the "dist" directory during the build process. I fixed the issue.

Another thing: if you are working with audio files, you'll need to run your page from a web server, not the local file system (i.e. not using file:// URLs). This is due to browser security restrictions for local files. I've updated the Flocking build system to include a simple command line web server in Node.js in case you don't have Apache or something else installed on your machine.

The synthDef you've pasted below is close, but not quite right. You're using the "selector" attribute, which is intended to bind the playBuffer unit generator to an HTML file input element. If you want to refer to a sound file directly by URL, you can just use a "url" parameter, like this:

{
  ugen: "flock.ugen.playBuffer",
  buffer: {
      id: "piano", 
      url: "audio/fsharp-piano-44100.wav"
  },
  loop: 1.0
}

In case it helps, I've created a new repository with instructions on how to run Flocking and with a series of super-simple web page examples. Hopefully it will help to compare your code with them:

https://github.com/colinbdclark/flocking-getting-started-example

Let me know how it goes,

Colin

On 2013-11-12, at 8:21 AM, roger pibernat <rogerpibernat at gmail.com> wrote:

> If I wanted to play a file, would this be the code?
> 
> var synth = flock.synth({
>   synthDef: {
>       ugen: "flock.ugen.scope",
> 
>       source: {
>           id: "player",
>           ugen: "flock.ugen.playBuffer",
>           buffer: {
>               id: "selectedSound", 
>               selector: "piano-C3.wav"
>           }, 
>           speed: 1.0,
>           loop: 1.0
>       }
>   }
> });
> 
> 
> Roger
> 
> (+34) 639 81 26 71
> http://www.rogerpibernat.com
> http://www.wucollective.com
> 
> 
> On Tue, Nov 12, 2013 at 2:07 PM, roger pibernat <rogerpibernat at gmail.com> wrote:
> Hi again,
> 
> I tried the Audio File Decoding Demo but it doesn't work for me.  I tried uploading a 4-second file both in wav and mp3 and none seem to be working.  The console throws this error:
> Uncaught ReferenceError: window is not defined polydataview.js:25
> 
> 
> Roger
> 
> (+34) 639 81 26 71
> http://www.rogerpibernat.com
> http://www.wucollective.com
> 
> 
> On Tue, Nov 12, 2013 at 11:29 AM, roger pibernat <rogerpibernat at gmail.com> wrote:
> Hey, thanks!
> 
> That worked.  I couldn't make it play any sound yet but at least I don't get any errors.
> 
> In order to make it work, though, I had to install dependencies before running grunt.  I did so with 
> npm install
> 
> then I ran the grunt command.
> 
> Maybe it would be a good idea to add that to the documentation in the README file?
> 
> Thanks again for your help!
> 
> 
> 
> Roger
> 
> (+34) 639 81 26 71
> http://www.rogerpibernat.com
> http://www.wucollective.com
> 
> 
> On Mon, Nov 11, 2013 at 4:54 PM, Colin Clark <colin at colinclark.org> wrote:
> Hi Roger,
> 
> I'm glad to hear that you're experimenting with Flocking. From the error you're receiving, it looks like perhaps you have omitted the Fluid Infusion dependencies required by Flocking. Probably the easiest way to link to Flocking is to make a build, which will create a single file containing all required dependencies.
> 
> I've updated the Flocking README file to include instructions on how to make a build:
> 
> https://github.com/colinbdclark/Flocking#getting-started
> 
> And also, if you want, how to link to the individual files:
> 
> https://github.com/colinbdclark/Flocking#using-individual-flocking-files-for-development
> 
> Let me know if this works for you, and if there's any other documentation I can add to help make the process of getting started with Flocking easier.
> 
> Colin
> 
> On 2013-11-11, at 1:48 AM, roger pibernat <rogerpibernat at gmail.com> wrote:
> 
>> Hi,
>> 
>> I'm completely new to Flockingjs.  I'm trying to use it for the first time.  I included all the .js files in my index.html code, but I get the following error:
>> 
>>     • Uncaught ReferenceError: require is not defined flocking-core.js:15
>> 
>> What library am I missing?
>> 
>> Cheers!
>> 
>> Roger
>> 
>> (+34) 639 81 26 71
>> http://www.rogerpibernat.com
>> http://www.wucollective.com
>> _______________________________________________
>> users mailing list
>> users at lists.flockingjs.org
>> http://lists.flockingjs.org/listinfo.cgi/users-flockingjs.org
> 
> 
> 
> 
> _______________________________________________
> users mailing list
> users at lists.flockingjs.org
> http://lists.flockingjs.org/listinfo.cgi/users-flockingjs.org




More information about the flocking mailing list