aAVis
Processing Based Visualsation Tool
Navigate/Search

Wednesday Night Progress Update

Current Lines of Code : 1049
[Not Including Particle/Motion Blur System which is aprox : 323 lines]
Days til Pre-Crit : 4

Oh our presentation is getting VERY close. We’ve got a Pre-Critique on Monday, then the final presentation a week after that. Am I ready to present ? far from it. I’ve still got a fair amount to do, but I should manage to get it all done ( I hope ).

This is my plan for the next few days :

WED : Audio
THURS : Audio + Integration
FRI : Movement
SAT : Adding Elements
SUN : Adding Elements
FINAL WEEK : Adding more Elements and Graphic Effects, Tweaking Audio Integration

I’m actually ahead of this schedule. I’ve finished the audio, and integrated it into the whole project. It’s not that sophisticated, and the beat detection is still off, but it will do what it is told, which is what’s important. This means I can push EVERYTHING forward, and focus on Adding Elements and Movement. What are elements you ask ? Elements are things that can be displayed. Currently they are a Sphere, and a Cube. But they will include a particle array, stereogram, and whatever else I feel like coding and adding. As the framework GUI is complete, it’s relatively easy to add new elements as they should slot right in to the existing framework! ( Hopefully! hah ! )

What can go wrong from here ? *EVERYTHING*.  But I’ve dedicated the rest of the week to this, so fingers crossed it all goes according to my wonderfully planned plan.

Presets, and Array Questions

A quick status update for all of you listening out there.

I’ve now created a simple load/save preset system. It’s not pretty, but it works perfectly! ( wish I could say the same for that bloody remove option…More on that later )

I’m using simple .txt file exporting and importing to do the preset saving/loading. When the ’save’ button is pressed, all the current elements are saved into a ‘.aav’ file, Which is simply a sneaky .txt file in disguise. for example :

0*default sphere*72.0*300.0*0.0*100.0
1*default cube*400.0*300.0*0.0*100.0
0*default sphere*720.0*300.0*0.0*100.0

This preset file will created 3 objects. Two Spheres, and a Cube ( oh yeah, I added cubes ). It’s fairly simple, each value is separated by a *, and each new line is a new element. The object “type” is dictated by the number at the front of the line. 0 for sphere, 1 for cube, etc. This text file is imported back into the program, the current element list is cleared ( though, in the final version I hope for a fadeout, but for now, it just vanishes like my social life while completing this assignment ), and is replaced by our new friends there.

So that’s rad.
Now I need some help.

I’ve been puzzling over this stupid remove function all day, and just when I think I’ve got it working again, I manage to break it. It wouldn’t be so complicated, however the GUI library I’m using is still in the early stages of development ( especially with the MultiList system I’m using ) and so it’s still missing some things ( such as items that remove properly … ). This is how my remove system works :

REMOVE BUTTON IS SELECTED.
REMOVE BUTTON TEXT IS CHANGED TO -REMOVED-
ELEMENT CORRESPONDING TO REMOVE BUTTON IS REMOVED

Seems simple enough. And it is for the *first* item. However I’m storing the elements in an ArrayList, which means if I remove one, the rest cascade through the list and fill in the spots, which means I have to keep an array which holds the relative button positions for the elements place in the elements ArrayList.

Confused yet ? So Am I.
SO

ArrayList elements = new ArrayList();
int[] currentElementPos;

and the remove code :

// set "edit" label to "-removed-"
gui.controller(Integer.toString(theEvent.controller().id()+1000)).setLabel("-removed-");


// set "removed" label to "-removed-"
gui.controller(Integer.toString(theEvent.controller().id())).setLabel("-removed-");


// remove item
elements.remove(currentElementPos[theEvent.controller().id()-1000]);


for (int i=theEvent.controller().id()-1000;i<=elements.size();i++){
currentElementPos[i]=currentElementPos[i]-1;
}

Yes, there are some magic numbers there, and that’s where the GUI Issues come in to play. Each button is assigned an ID number. the ‘remove’ buttons I’ve assigned incremental ID’s from 1000 upwards. ( to 2000, so don’t add more than 1000 elements :P ). so “theEvent.controller().id()” is the ID of the button that was pressed. so, 1000 would be the first element created, hence 1000-1000 = 0. Which means it is element 0. However, once I delete element 0, element 1 should now be element 0, element 2 should be element 1 etc. That’s what the for loop *should* do. But it’s … not. Maybe with a fresh mind in the morning I can work this out, but right now - I’ve tried 4 different solutions, each one works for a bit, then falls apart.

Any Ideas ? Even if it’s not in java, psuedocode is fine.

Thanks
- Anthony

GUI version 8

You can tell you’ve been working on something for a while when you *finally* figure it out, it’s like the world is a happier and more amazing place with furry little animals singing songs to eachother about mountain streams and … pez.

I *finally* figured out the annoying parts of my GUI today ( woo yeah! go me ! ). No, it’s not perfect, but it’s definitely the best it’s ever been, so I thought I’d show it off. Now, it is very simple at the moment, and it still has quite a few bugs in it. But I’ve had to sacrifice ease of use, just so I can get it finished. I’ll fix the problems later. So this is it :

addsphere.JPG

Currently you can only add spheres, so you’ll have to be content with that. It also takes quite a while to load, but just be patient. Now there are certain “rules” you’ve got to follow, or you’re going to break it. So this is what you can and can’t do.

1) Hover over Add -> Click Sphere

2) You’ll see a tab appear at the top of the screen saying “sphere”. Click that tab. DO NOT add another shape, you will break it. You can add more LATER

addsphere02.JPG

 

3) You’ll now see the “create/edit sphere” menu. Change what values you want, give the sphere a name, change the x,y,z and diameter, and when you’re done, press “save_sphere”. HOWEVER, remember the position of the ‘default’ tab at the top of the screen. As when you select ’sphere’, they will both vanish. Click in the area where the “default” tab was before, and the original menu will display itself once more. No, I don’t know why this happens - it’s something I’m still yet to figure out.

addsphere03.JPG

And that’s my GUI so far. From there you can Edit or Remove spheres. Remember, only one Sphere tab at a time. I will eventually change this, so that it makes a new tab for each sphere, but for now, this is how it will be! So enjoy.  Here is the link to the applet :

aAVis GUIPrototypev8 Applet

Thanks to Andrew Dekker, the Processing Forums, Wonko and Sojamo ( Creator of the GUI Library I’m using ) for their patience.  Thanks!

Help from Mac Users

Hi mac people. Wondering if you can help me out. This is a possible solution to the audio-input selection problem, it’d be nice if one of you could test it out and see how it works - thanks.

1) First, get this : http://www.cycling74.com/products/soundflower
2) Install it, then choose “soundflower 2ch” as the out, and “soundflower 2ch” as the in under System prefs/sounds.
3) Then download “LineIn” from : http://rogueamoeba.com/freebies/
4) Choose “Default System In” and the output device of your choice ( For Example:Headphones ).

This comes from Robert ( Flight404 ) so it’s a fairly reliable source. Once you’ve done this, head to my previous post, and download the motionblur test. See if it works when you’re playing some music through itunes. Please comment back to this post! Thankyou!

-  Anthony

Latest News, Additive Blending, and Motion Blur

So now that I’m all nicely moved, I thought it was about time I told you all what I’ve been up to.

I’ve been working on the GUI, come up against some problems, but I think I’ve solved most of them now - I’m working on that tonight and tomorrow and should have something semi-decent ready for the weekend to test loading/saving. Currently I’ve got a version that lets the user create spheres after specifying dimensions. Nothing amazing, but it works, so I’m happy.

As well as working on that, I’ve been doing a series of OpenGL experiments.

Example 1 Was a test of my new particle system. It creates a stream of 3d rotating cubes at the location of the mouse. It also features OpenGL Additive blending.

Example 2 was a happy accident. Once again it’s a stream of particles moving away from the mouse, this time into the Z axis as they rotate. And they are 2D objects. It gives a cool ‘wavy’ feel. I quite like it really!

Besides these three, I’ve also now created something I am incredibly happy with. I call it my motion blur example. I realised that I could use my particle generator to make 3 copies of the same object, each with a slightly lower alpha value and simulate a “motion blur” effect. I also realised that if I made the “particles” move off into the distance, I can get some rather interesting results. So I coded up a simple oscilloscope(esque thing) and added my motion blur class to it. The results were great :

oscilloscopeandmotionblur

The Osc. Motion Blur example reacts to audio input, and looks quite interesting ( it too, has additive blending ). Unfortunately I have trouble exporting these as applets. However here are the files for those of you wanting to have a play :

Mac Users (1.4mb)
PC Users (1.3mb)

It will react to whatever you have selected as your audio-in. I’ve got a possible solution for mac users which I’ll post in the near by future too, I’d appreciate it if a fellow mac users could test it out for me ? Thankyou.

Overall I’m relatively happy with my progress so far. Next on my list is to work on loading and saving presets, and from there, the completion of the GUI. After that, all that remains is to add the various graphical elements, and various effects. That will be the long and hard - although interesting part.

- Anthony

New Blog

So I moved my blog! woo!

So I’ve now got hosting and can store files locally.  This should increase the amount of data I can store and can therefore offer you , the public a little more insight into what it is I’m up to.  Tonight I’ll post my current status, should be a good long post - have achieved some very interesting things which I’d like to share.  Until then, please feel free to test the commenting, that’d be great.

- Anthony

GUI’s and OpenGL

First things first, thought I’d just mention the latest update to my blog, on the right hand side you can now see a list of what needs to be done in order to complete my prototype. Highlighted in green are the elements that are complete, highlighted in orange are the elements I’m currently working on. So you can keep track of my progress. And this leads in to my current problem.

In processing there are two options for GUI’s ( Graphical User Interfaces ).

1) Use a GUI Library
2) Code it all yourself from scratch

Option 2 would take a *long* time, so this leaves option 1. However, even option 1 has problems. Processing has 4 GUI Libraries ( that I am aware of ).
- controlP5
- MyGUI
- Interfascia
- SpringGUI
They all work fine by themselves. However add P3D or OpenGL, and they tend to break. MyGUI and Interfascia seem to die all together. SpringGUI works with P3D but not OpenGL, and controlP5 works with openGL, however the 3D elements always draw on TOP of the GUI. I tried running the GUI elements in a separate window, however that caused issues, and it seems to only work part of the time.

I have heard rumors of a way of re-coding MyGUI to work in conjunction with OpenGL, but I am not 100% sure of its authenticity ( or on the re-compiling process, I’d have to brush up on that ).

So I’ve gone to the processing forums for support, I’m hoping someone there can offer a suitable solution - Until then, I’m sort of forced to put everything on hold - so hopefully I’ll get a solution before then.

Processing Forum Thread

If I can’t get a solution, I will have to work out a possible solution. Even if this means ensuring no 3D elements move closer than 0 on the Z axis, and drawing all the GUI elements on that point. This will mess up perspective, but it may be the only compromise open to me.

- Anthony

Audio Analysis and Beat Detection version 2

I was bored yesterday afternoon, so I sat down and re-coded from scratch my beat detector. I received an email from Robert Hodgin ( aka Flight404 ) on some tips to getting beat detection working effectively.

His short answer was it’s very tricky. He’s still trying to figure out the best way to do it himself, and throughout the googleverse it’s about the same story wherever you go. The best way to do it I’ve decided is a version very similar to his own :

Basically you divide the FFT stream up into X number of segments ( I’ve chosen 6 ), the sizes get larger as they move to the right of the stream ( bass to treble ). For each of these segments ( or “Zones” ), you then calculate an average value, and a “threshold” value. If the average moves higher than the threshold, then you have a dramatic increase in that zone, and possibly ( I say possibly ) a beat.

Talking is boring, how about I show you.
Windows Users : Click here ( .rar 1.4mb )
Mac Users : Click here ( .rar 1.3mb )

Unrar the files. The instructions are in the mac .rar file ( there’s a readme.txt ). The program listens to your microphone. Windows users, you can go to your recording preferences and set your recording input to equal your audio output and get direct sound from winamp or wmp or whatever you use. Mac users ? no idea ( if someone figures out how to do it, tell me please !).

Let me explain what you’re seeing :

The Red lines are the zone “averages”. The yellow lines are the “threshold” values. When 2 or more areas trigger at the same time, I’m saying that’s a “beat”, the screen will flash white ( very quickly ). You’ll notice it’s still very jumpy, and requires a LOT of tweaking ,but I think I’m getting there. It’s kinda cool though.

Watching it, I’ve noticed certain trends. In the next version, I’m going to experiement with the timing of the thresholds. How much higher than the current value it has to be to trigger a threshold change, and maybe even “weighting” certain zones to be worth more than others ( as they seem to contain “beat” related frequencies more often than others … ) Suggestions ?

That’s it for now. Enjoy.

- Anthony

Presentation Feedback, and Change of Focus

Ok, so we had our project presentations on monday. Boy did mine not go well. I was actually feeling a little under the weather, so I wasn’t really thinking straight, not a good start. Eventually ( after 2 hours of waiting ) I got to present. Ralf I don’t think was amazingly impressed. Here is the feedback I got from my tutors, Petra and Lorna :

“- Sounds like an interesting product
- Ralf suggested getting it up to prototype
- Looking forward to seeing what you produce, played with processing a little, and is lots of fun.
- Well presented, and understandable
- Scope needs to be considered to make sure that it is achievable”

“Interesting project - though you need to sell it more! Aiming for the casual desktop user is kinda selling it short, considering the potential it has for inclusion into club setting. How are you going to differentiate it from the others out there - why would ppl use yours over theirs? Allowing for customisation would help to push up a level - and aiming for a particular group of users (like VJ’s) would also help.”

Taking all this, and Ralf’s comments into consideration - I am actually going to be more ambitious, and I’m going to move back to my original idea. Which is a Visualisation *CONSTRUCTING* tool. Based in processing still, and still using 3d. But so the user has the ability to construt their own 3D visuals, and play with them as they see fit. Much more fun, right ?

So, I’ve sat down and gone over the preliminary details, and boy, will it be a BIG assignment. I’ve got a lot to do. I’ve roughly broken it up into four parts :

1. Audio - Analysing of Audio Stream, Returning Useable Data.
2. Creation - Creation of Shapes/Particles/Effects to be displayed
3. Display - HOW the objects are displayed. 3d, blending, blurring…etc
4. Presentation - Live mixing of saved created presets.

I’ve got to delve into a little more detail, but I think this will be the direction I will take. How complex it will all be when it’s done ? I’m not sure. But it should be an interesting journey none the less! I’m tired and a little sick, so that’s all I’m writing for now - but I’ll write again tomorrow after I get the feedback from my draft report.

- Anthony

FFT Research, Project Choice and Processing Issues

Project Choice
I’ve decided to go with the audio-responsive visuals. I figure it’s the most challenging option available for me and so it’s therefore the best way to show off my skills for the end of year expo and beyond.

In Saying this, I wanted to get a decent amount of research done into FFT and Frequency analysis.

Processing Problems
Before I start anything, I’ve got problems. I wanted to start uploading my processing “sketches”. However I’ve encountered a problem. I spent a large portion of time yesterday afternoon attempting to get the sketches to work as a java applet from within a browser - no joy there, and now I’ve found that something has broken, and I can’t even export as a standalone application - BIG PROBLEM.

The error I get is : “File sonia_v2_9.jar,JSynClasses.jar,JSynV142.dll,libJSynV142.jnilib does not exist”
If anyone knows anything about processing and can help me, I’d appreciate it. I’ve also posted for support on the processing website here. Until I get this fixed, I can’t show you where I’m up to in my experiments - as a last resort I’m sure I can export them from my laptop, so I will have to try that later.

FFT Research
Now to the intersting part …
I’ve been doing some research into FFT and Spectrum Analysis. Just so I know what I’m dealing with here. I suppose I should start from the beginning.

In order to work with sound, I need to understand the format in which I can access it. Using processing, and one of the various sound libraries ( In my case, I am using ‘Sonia‘ I can access the live stream of music via my soundcard. This data is intepreted via FFT ( More on this later ), and then outputted into a spectrum array. This array can then be accessed and the music or sound can be intepreted.

So firstly, What is FFT ?
FFT ( or Fast Fourier Transform ) is an “Algorithm to compute the “Discrete Fourier Transform” and it’s inverse.” Ok, so what is a Fourier Transform ?
The Fourier Transform Produces a Spectrum. It saves the Magnitidue of each frequency component. This data can then be represented as a graph or plot.

So how does this tie in with processing ?
The FFT Data is collated and stored in the array. Each array element is an “FFT Bin”. These “bins” are basically storage elements for a *collection* of frequency ranges - not a single frequency. So how are you meant to know what frequencies are contained in which bins ?

Say you have a file with a Sample Rate of 44100Hz. A frequency range of 22050Hz is equally split into 512 bins. Each bin is : 22050 / 512 : 43.066Hz Wide.
The Left most bin ( Lowest Frequency ) has *half* the width of all other bins. ( contains frequencies 0.000Hz to 21.5Hz ).

So what does all this mean ?
This means that I can get data from a sound source, live streaming sound data - examine the frequencies, and calculate which elements represent which aspects of music ( kicks, snares, synths etc ).

And where will this lead ?
Eventually with a sufficiant understanding of the backbone behind the software, and an understanding of the data input and how it is aquired, I can isolate parts of my motion system to react to different parts / types of music in different ways. A greater understanding will help me to create a project of greater impressivenessnessness.

Any Questions ? Any Comments ? Any Suggestions ?

Where now ?
So what I have to do now, is try and get processing working. From there, the experiments continue.

- Anthony