audio landscape EDIT: ????

hi all,

ive finished a script which analyses audio data and sets vertices on a grid one row at a time, producing an audio landscape if you like. currently it does this on a 5x5 grid, each rows vertices are appended to a list and the script cycles through these lists setting the Z position on each verice according to bass, bass-mid, mid, mid-high, high frequencies. when the script gets to the last row it goes back to the first and repeats.

i would like to write a script which would let me create a lot longer landscape i.e. a 5x1000 grid maybe even longer.

i can see two ways of going about this and it would be great to get your opinions on which way would be best and if there are any other ways which i am overlooking. i think it will take me a while to program this and i dont want to go wasting my time only to realise there was a much quicker way :smiley:

ok so:

method 1:

create a 5x1000 grid, append each rows vertices/vertexes(???) to 1000 lists, use my current script to move through them.
problems:
-a lot of hassle typing in each vertex into a list[ as vertexs i(ndex?)numbers do not correspond logically to their place in the grid i.e row1 does not consist of vertex 0-4, row2 does not consist of 5-9, more like row1 0,1,4,6,8 row2 3,2,5,7,9 row3 14,13,12,11,10 e.t.c
-if i want to make a grid for a longer period of time im buggered and have to rewrite it all again.

method 2:

keep my 5x5grid, when i get to setting the last row addObjectActuator another grid in front of the last, append the vertices to new lists cycle through these setting Xpos- repeat indefinatly.
problems:
-gonna be a bitch for my and my poor/adequate python skills to code, but seems to be the most futureproof.

well done if read through all that give yourself a pat on the back :slight_smile:

any comments on these methods or suggestions of other ways around this

thanks
Will :smiley:

ok so i went with method 2 and it looks like my coding isnt too bad after all but i overlooked something…

after setting all the rows in the grid, i add another grid next to first using an empty with addObjectActuator. then i get this grids mesh with getLastCreatedObject().getMesh(), this meshes vertices are put in a list which is then altered according to audio.

the problem is that the new grids mesh is the same as the old grids mesh so moving the verices on one mesh moves them on the others… is their a workaround for this?

i want this to happen:

grid1 alter mesh row by row get to end add
grid 2 stop altering grid1, alter grid2 mesh row by row get to end add
grid3 stop altering grid2, alter grid3 mesh row by row

e.t.c.

ant ideas guys

ok so method1 doesnt work because if there are two grids with the same mesh and i alter one i automatically alter the other, this is cos they are linked as i used an add object actuator to add the second grid. ive toyed with the idea of using setMesh to change the grids mesh so im only altering the current one but this hasnt brought any joy…

and method2 doesnt work because the maximum length of a grid is 100.

is there another way round this? please help??

does crystalblend offer vertex creation in engine??? or is it possible with this engine??

thanks
will

Please try not to double post let alone triple post :-? please just use the edit button with a --------------------------------- between each to show that you’ve edited :slight_smile:

Anyway, your ideas seem pretty well worked and thought out :slight_smile: As soon as I saw the topic this is what I thought it would be about, it would be so cool to have a working demo of it :smiley:

Sorry I can’t answer your question about crystalblend :frowning:

Thanks for the reply facemania, sorry bout the 3x post it shant happen again :smiley:

I didnt think anyone would be interested in the program but after a day of finding a place to upload one finally worked without buggering me about. Sorry its just an exe but im feeling kinda orotective over it at the mo, maybe when the full programs finished and im working on something else ill upload a blend. :slight_smile:

ok so heres the exe, its not dynamic i cant figure that out, youll have to put it in a folder with the appropriate dlls.

http://www.upload2.net/download2/N80AVvj6E2GfzcP/landscape_v0.3.exe.html

now to get audio into it you’re gonna need max/msp or puredata(free app which does pretty much the same)

i use max, if you havent got it you can download a 30day trial demo from:

this is the app which analyses audio- run it through max/msp.
http://www.upload2.net/download2/kw3u08bl6siuIMt/cncAPP_program.mxf.html

if you have puredata, i dont know how to set it up but heres a [huge?] screengrab of the OSC part in max it might have some clues :slight_smile:

http://www.upload2.net/download2/hBjz40QbuEOaYq5/maxmsp.bmp.html

oh yeh almost forgot you’ll need OSC.py which can be got from:

http://wiretap.stetson.edu/

ok so now for more questions ha ha!!

nobodys replied to the earlier posts so im gonna go for a hybrid of the two-

about 10 seperate grids each 5x500 long, when pne runs out we move to the next, this shouldnt be too intensive on the processor and i can hide the other grids offscreen or on another layer. the problem with this is that grids be 100 points long- ive looked for an option to change this but no luck yet- anyone know how to make a longer grid?

if not [which im guessing] ill just have to join meshes together which should be fun :frowning:

anyway hope you guys enjoy the app its quite entrancing if you listen to some mental high tempo music…

will
:smiley:

why have i got so many smiley faces in there??


there ya go :smiley: !

ok just had an epiphany i think. but im tired so maybe its stupid…

i cant be bothered to add each vertex to a list its a slow process so heres this:


import GameLogic

cont = GameLogic.getCurrentController()

own = cont.getOwner()

scene = GameLogic.getCurrentScene()
grid = scene.getObjectList()["OBGrid"]
mesh = grid.getMesh(0)
camera = scene.getObjectList()["OBCamera"]
campos = camera.getPosition()
print campos
b = own.b

for v_index in range(mesh.getVertexArrayLength(0)):
	vertex = mesh.getVertex(0, v_index)
	v_xyz = vertex.getXYZ()  
	n = v_index/5.0 #### there are 5 rows
	
	if n == b:
		vertex.setXYZ([v_xyz[0],v_xyz[1],1])
	elif n-0.2 == b:
		vertex.setXYZ([v_xyz[0],v_xyz[1],0.3])
	elif n-0.4 == b:
		vertex.setXYZ([v_xyz[0],v_xyz[1],0.5])
	elif n-0.6 == b:
		vertex.setXYZ([v_xyz[0],v_xyz[1],0.1])
	elif n-0.8 == b:
		vertex.setXYZ([v_xyz[0],v_xyz[1],3])
		
	camera.setPosition([campos[0],b/1.8,campos[2]])	
	own.b=b+1

i think you’d just alter the n = , depending on how many rows you got, now ive just got to figure how to slow it down with the tempo…
:smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley: