OpenCL itunes visualizer for Snow Leopard

Discussion in 'macOS' started by elbows, Sep 3, 2009.

  1. elbows macrumors regular

    Oct 27, 2005

    Ive been mucking around with Quartz Composer again. In about 40 minutes I will post an early test of some new stuff in Snow Leopard. It will only work with graphics cards that support OpenCL (I think) and it hasnt been tested with many cards so Ive no idea how many of you will be able to run it ok.

    When the file is available, just pop it in ~/Library/Compositions and it should show up in the itunes visualizer list.

    Version 0.2 has some keyboard controls:

    e to cycle through effects
    s and d increase and decrease sensitivity to music
    + and - change the speed of the smoke/fluid
    r to reset the smoke & above parameters

    Attached Files:

  2. jmpage2 macrumors 68040


    Sep 14, 2007
    Sounds sweet. Can you make a screen cap with the new Quicktime X feature so we can see it in action before loading it?
  3. elbows thread starter macrumors regular

    Oct 27, 2005
    OK here it is.

    Its not really finished, the colours probably need improving and it probably works better with music that isnt too hectic. It's possible there could be bugs in snow leopard which could cause this to crash or have memory leaks, and as I already mentioned it wont work on all machines.

    If anybody remembers me from when Leopard came out, I made a crude attempt at replicating the missing ichat star wars hologram effect, again using Quartz Composer. I was too lazy to post screenshot of that at the time, I just posted the .qtz file here and let everyone else get on with figuring out what to do and how to improve it. Well its the same story this time, do what you like with this thing. I will be very interested in knowing how it runs and on what graphics cards, and there is a chance I will post improved versions later, but I make no promises. And as Quartz Composer is available as part of the developer tools for snow leopard, anyone can pick up the ball and run with it, though any serious crashes or compatibility issues are likely out of our hands as that will be down to Apple to sort out the underlying technologies this composition makes use of. I didnt even write or modify any of the OpenCL stuff thats in this composition, it came with quartz composer in snow leopard as a virtual macro called 2D Fluid Simulation.

    I havent tried this on another machine yet so I suppose there is a small chance it may not work due to something being missing, so I eagerly await the first report that it worked.
  4. elbows thread starter macrumors regular

    Oct 27, 2005
    Forgot to say that the machine I tried it on had 8600M GT graphics.
  5. macfanboy macrumors 6502a

    Jun 5, 2007
    maybe i did something wrong, but when i turn on the visualizer, its looks very pixelated and blurry.

    is it just me?

    9400M graphics (13" MacBook Pro)
  6. elbows thread starter macrumors regular

    Oct 27, 2005
    The balls that make the smoke are quite pixellated because I was trying to maintain a decent framerate. It looks far worse with music where there is a lot going on across the spectrum.

    The main attraction, the smoke/fluid, is supposed to be blurry but move in very nice ways.

    So I cannot really tell from your description whether it is looking the same for you as it does for me. Try with different music maybe, or post screenshot. Whats the framerate like? If its not smooth then I imagine this thing just looks like a complete fail.
  7. elbows thread starter macrumors regular

    Oct 27, 2005
    OK I added a screenshot to the opening post to avoid confusion about what it should be doing.

    I have seen it get stuck sometimes and you just end up with nasty blurry balls and no lovely smoke, its just a prototype.
  8. elbows thread starter macrumors regular

    Oct 27, 2005
    I know Ive said a lot of things that will put people off trying this, but I was really hoping for a bit more feedback. Nobody has it making lovely stuff when fed ambient or other fairly quiet music?
  9. tropic10 macrumors member

    Sep 8, 2008
    Works fine for me on a late 2008 MBP. Definitely better with slow music.
  10. elbows thread starter macrumors regular

    Oct 27, 2005
    Thanks for the feedback :)

    I will tweak it over the weekend so that it will hopefully work better with all types of music.
  11. 2002cbr600f4i macrumors 6502

    Jun 21, 2008
    Running fine on my 2009 Mac Pro w/Radeon 4870...

    Only thing, how can we tell whether it's running the OpenCL code on the graphics card or on the CPU?

    Also, where's the OpenCL code for it? I'd like to take a look at it and maybe tweak it a bit.... (Sorry, I've never used Quartz so I'm a bit lost with it.)
  12. elbows thread starter macrumors regular

    Oct 27, 2005
    Im pretty sure there is presently a bug in Quartz Composer that means CPU fallback for OpenCL is broken within Quartz Composer, so its pretty certain the openCL stuff is running on your GPU. At some point I assume Apple will fix this, and then I will look at how to report OpenCL info such as which devices its using.

    As for looking at the code, the context it is used in wont mean much without some Quartz Composer knowledge. Its also a tad confusing because the OpenCL parts are within a virtual macro, which you cannot edit directly just by opening my composition. If you have quartz composer installed, right click on the 2D Fluid Simulation in the library, select edit, and then you can see what it consists of. A few of the patches used in it are OpenCL, and you have to click on them, open the inspector and make sure it is on the settings tab, and it will show you OpenCL code.
  13. J the Ninja macrumors 68000

    Jul 14, 2008
    Looks pretty nice for me. (late 08 MBP) Good work!

    (A note to some folks: If you add it to ~/Library/Compositions while iTunes is running, you will need to exit and restart iTunes for it to show up)
  14. elbows thread starter macrumors regular

    Oct 27, 2005
    Thanks :)

    I am pleased to report that version 0.2 is coming within an hour, here is whats new:

    Change the speed of the smoke with + and - keys
    Cycle through some effects by pressing e
    Reset the smoke by pressing r
    More responsive to music
    Should work better with a wider range of music
  15. elbows thread starter macrumors regular

    Oct 27, 2005
    New version is up (attached to first post) and in addition to what I mentioned in previous message, it also got some crude control over the sensitivity by using the s and d keys.
  16. 2002cbr600f4i macrumors 6502

    Jun 21, 2008
    Just grabbed and installed version 0.2. NICE!!! Works a lot better, and I love the options.

    HOWEVER... It's looking like it's using the CPU for the OpenCL stuff on my 2009 Mac Pro w/4870... I have it set up with 8 threads (4 cores w/HT on) and iStat Menus is showing iTunes using 581% CPU, and that's with the visualization only running in a window.

    Turning the visualization off returns iTunes to 2.2%.

    Might not be your code at all, but I'd check to make sure that it tries to use a GPU rather than the CPU if there's a compatible GPU... If your code is checking and using whichever OpenCL device is fastest (or a combination of all available) then this 4870 must really suck at OpenCL (which is what many of us are suspecting...)
  17. elbows thread starter macrumors regular

    Oct 27, 2005
    Strange, my code isnt doing any checking, in fact there really isnt any of my code in this visualizer, its just gluing stuff that already exists together in quartz composer. And as far as I know, non-GPU OpenCL is broken in Quartz Composer at the moment.

    It could be some other element of the composition that is eating your CPU, as I only get 25-30% CPU use on a Macbook Pro with 8600 graphics. Unfortunately none of the ATI graphics cards I have for my Mac Pro support OpenCL so the composition wont run at all on that machine, so I cant track down the problem. Maybe the ATI OpenCL implementation for your card has bugs that make it use a lot of CPU, maybe there is some other issue with ATI drivers & Quartz Composer at the moment, or maybe the way I wired it all together in Quartz Composer is causing ATI issues.

    Im sure there is a memory leak somewhere too, as RAM steadily dribbles away whilst this composition is running on my machine.
  18. elbows thread starter macrumors regular

    Oct 27, 2005
    OK I found out how to get CPU-only OpenCL working in Quartz Composer, and CPU use on my mac pro is very similar to what you reported: very high indeed. So for some reason the OpenCL was not using your GPU.

    I posted a bit more info on this as well as a different version of the itunes visualizer on my blog:
  19. J the Ninja macrumors 68000

    Jul 14, 2008
    Did the old one have the vertical mode in it? It's cooler that way. If you care about my framerates:

    256MB 9600M GT: 20-25fps, drops to about 5-7fps in high-res mode. Vertical mode seems to drop it a little, maybe 2-4fps or so.

    9400M (God, I hate this thing. And that's before we get to the "blinking internal display" thing): Maybe 10fps tops. Drops well below 5fps with high-res turned on.

    9600M seems to be the slowest card it's still "fun" on, and that's provided you keep high-res turned off. Anybody with the something more powerful want to give it a try? (Like, a G92 or GT200 based card?)

Share This Page