Search Unity

Released: Visualizer Studio - A Music Visualization scripting package!

Discussion in 'Assets and Asset Store' started by AlteredReality, Aug 16, 2011.

  1. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    I'm working on finishing up another asset store product currently. After that, I'd like to release an update that includes support for it. However, with basic coding skills, it should be pretty easy to update the current scripts that spawn particles to use Shuriken particles instead.
     
  2. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Sure, you could - but since shuriken has been out quite a while now the package itself should be updated as the old particle system is quite out of date.

    Just sayin;-)
     
  3. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Hi, great plugin !
    I would need help for folder setup to access the components in javascript.
     
  4. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    I don't support accessing Visualizer Studio from Javascript. It may still be possible though, but I never use Javascript so I simply don't know. A quick search on how to access C# stuff from Javascript turned up this: http://answers.unity3d.com/question...ript-variable-or-function-in-javascript-.html

    So maybe if you drop Visualizer Studio into your plugins folder, you'll be able to access it. Let me know if that helps.
     
  5. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Finally i got it to work by :

    1 : moving Assets/VisualizerStudio/Editor to Assets/Editor
    2 : moving Assets/VisualizerStudio to Assets/Plugins/VisualizerStudio
     
  6. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Awesome, I'm glad to know you got it working. Let me know if you need anything else.
     
  7. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    244
    Hi,
    I'm trying to combine Visualizer Studio with the Asset MasterAudio (Use MasterAudio as Audiosource for VS). The problem is that in Visualizer Studio I only have one Audiosource as Input. MasterAudio uses multiple Audiosources to handle crossfading and other stuff. Is it possible to have an option to select different Audiosources at the same time? Or that Visualizer Studio uses multiple Audiosources from one Gameobject?
     
  8. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Visualizer Studio is built around the GetSpectrumData() function of AudioSource, so it only supports one audio source. Sorry!
     
  9. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    244
    But this doesn't mean it's impossible. Instead of using an AudioSource reference in the VisualizerManager you could use a GameObject and parse through the attached AudioSource Components.
    (AudioSource[] allAudios = gameObject.GetComponents<AudioSource>();)

    Then from every Audiosource I can get the SpectrumData and summarize all divided by the Audiosource count. For two AudioSources the performance should be OK.



    I have no problem to implement this by myself, but unfortunately VS doesn't come with the source code :(
    Are you willing to improve your Asset or can you provide your Asset with the source?
     
  10. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Nothing is impossible. However, what you describe what not be as simple as averaging the audio sources...it would likely require more analysis on what and when to blend in the various values. For example, if one source was very low in the current volume, it would drop the over all average.

    Regardless though, working with more than one audio source at a time is not what VS was designed for, and I'm not planning on adding support for it. The only other option is to use the master AudioListener. If you don't specify a source, it will default to using the static spectrum functions on AudioListener.

    The VS source code is available for sale on our website though, if you wish to make more advanced modifications yourself: www.alteredr.com

    Let me know if you have any other questions.
     
  11. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    244
    This is the solution! I didn't know that if I leave the source in VS empty that the master AudioListener is used. Thanks!
     
  12. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Oh, awesome! Glad to know that works for what you need! :)
     
  13. Scott-Curtin

    Scott-Curtin

    Joined:
    Mar 19, 2013
    Posts:
    14
    I just upgraded to Unity 4 and was wondering if there were any known issues with receiving audio that is being played outside of Unity- in say an audio program?.. This feature used to work brilliantly for me via the Stereo Mix selection in the Vis Microphone script... I'm testing it with your default scene file- turning off the built in song- and turning on the Stereo Mix in the Microphone Device slot.

    ... I've also checked any of the obvious sound card setting issues I could think of- Just curious if it's my own unique problem.
    Thanks for any input, as I really appreciate this asset and it's logic.
     
  14. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    As far as I know, there are no issues with the microphone script in Unity 4. Is it working if you just use a microphone for input?
     
  15. Scott-Curtin

    Scott-Curtin

    Joined:
    Mar 19, 2013
    Posts:
    14
    Thanks- It works now- I had turned off the Audio Source component with the music on it- thinking that as long as there was a Vis Microphone script and an Audio Listener then it would work... So to fix it I just left the Audio Source on, but turned off the Play on Awake feature... Apologies- for some reason I thought Audio Source was only necessary if you were playing music or sounds from within Unity.
     
  16. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Awesome, let me know if any other questions come up.
     
  17. grahamwell

    grahamwell

    Joined:
    Oct 5, 2013
    Posts:
    6
    Is there any way to capture audio playing from other applications, for example the Spotify player? Forgive me if this has been asked, I can't see an answer. Using microphone won't work if you're listening on headphones. Any third party tools which might achieve this?

    Thanks.
     
    Last edited: Feb 15, 2014
  18. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    There is no way I know of to do this. I'm simply just utilizing the Unity microphone support.
     
  19. KidSicarus

    KidSicarus

    Joined:
    Feb 3, 2014
    Posts:
    35
    Hey, AR.

    Could one use your asset to simulate a very basic lip sync with 2D animation? So, say you have a plethora of grunts or screams and every time a voice file plays it would switch out a sprite for an open mouth. Would this many needed script instances come at a high cost even if they had a very wide frequency window?

    Thanks.
     
  20. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    I think it might be theoretically possible, but that is not what Visualizer Studio was designed for. VS was designed to have one global listener that reacts to one specific audio source. What you want would require many VS manager scripts, which would be expensive, and I'm not sure how it well it would work since I've never tried it. So, overall, I don't recommend it.

    If I were you, I would probably try to make an animation clip that matches the audio clip. It might be more work upfront, but it would likely be more reliable and less expensive.
     
  21. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Hi Andy,

    I wonder is there any way to get an update if I'm using Visualizer Studio Pro Source? If I'm using Visualizer Studio, I can check update through Asset Store but I can't do this with Source version. Thanks.
     
  22. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    I've emailed you the latest version.
     
  23. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi ,
    I don't want to hijack this thread but I want to let know all user of Visualizer Studio (which I highly recommend to everyone) that I'm releasing a new Asset that could be useful in combination with VS: JACK4U - Route audio from a DAW to Unity with JACK Audio.
    ( In the video at my thread I show at 4:35 the usage of Visualizer Studio.)
     
  24. isharko

    isharko

    Joined:
    Jun 6, 2014
    Posts:
    4
    How do I access all the vars that are displayed per frequency controller in the debug screen? For example, I want to get the current avg, med, sum, in an array or list form?

    Thanks
     
  25. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Hi, i wrote an email to you at the 5.august and asked about an update for the basic version that i bought from your site directly but what ever the reason, until now i do not get an answer.
     
  26. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Hey, sorry I missed your email. I also sent out mass update emails for both Visualizer Studio Basic and Pro through our e-commerce site, so you should have received an email.

    To be safe, I found your email, and i sent a download link directly to you. Let me know if that works for you.
     
  27. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Anyone had problems getting the mic working? Can't seem to get it working, it recognises it fine too.
     
  28. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    I'm SUPER sorry, but apparently some testing changes to that script accidentally made it into the last update. :-(

    Here is the proper code for VisMicrophone.cs which is included. Just copy this code and paste it in the file. I am currently working on making an update with the fixed file.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. /// <summary>
    5. /// This class should be attached to the game object that contains an audio source.  If enabled, it will replace
    6. /// the current clip on the audio source with the microphone input.
    7. /// </summary>
    8. [RequireComponent(typeof(AudioSource))]
    9. [AddComponentMenu("Visualizer Studio/Utility/Microphone")]
    10. public class VisMicrophone : MonoBehaviour
    11. {
    12.     public string microphoneDevice = "Default";
    13.  
    14.     void Start()
    15.     {
    16.         //make sure it's okay to start the microphone
    17.         if (audio && Microphone.devices != null && Microphone.devices.Length > 0)
    18.         {
    19.             //get index
    20.             int index = 0;
    21.             for (int i = 0; i < Microphone.devices.Length; i++)
    22.             {
    23.                 if (Microphone.devices[i].Equals(microphoneDevice, System.StringComparison.CurrentCultureIgnoreCase))
    24.                 {
    25.                     index = i;
    26.                     break;
    27.                 }
    28.             }
    29.  
    30.             //assign and start microphone and then mute the audio source
    31.             audio.clip = Microphone.Start(Microphone.devices[index], true, 999, AudioSettings.outputSampleRate);
    32.             audio.mute = true;
    33.  
    34.             //Wait for microphone to be ready
    35.             while (!(Microphone.GetPosition(Microphone.devices[index]) > 0)) { }
    36.  
    37.             //start the audio source
    38.             audio.Play();
    39.         }
    40.         else if (audio)
    41.             Debug.LogWarning("No audio source was found, can't start microphone! You must attach thise script to the same Game Object as an Audio Source.");
    42.         else if (Microphone.devices == null || Microphone.devices.Length <= 0)
    43.             Debug.LogWarning("No microphone devices were found, can't start microphone!");
    44.         else
    45.             Debug.LogWarning("Unknown issue, can't start microphone!");
    46.     }
    47. }
     
  29. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    I just purchased this asset and it seems ok so far, but I need to be able to act on the presence of about 20 separate frequencies +- a few Hz. It's not clear to me how I can specify that particular frequency within the the inspector controls available. I would have thought I could just type in 293.66 Hz somewhere and be able to catch a D note. How can I do this? Thanks for any help.
     
  30. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    OK, I get now the relationship between window size/type and the resulting resolution that I can get, 10Hz vs 21.5Hz etc and I figured out I think, how I can use that resulting resolution increment to figure out how to calculate the range, via the Start and End settings (start=13 is the same as 13*21.5Hz = 279.9Hz). This is very tedious though, and it just feels like something code should be doing for me.. But my next question is, if I am going to have 20 separate controllers, is there any thing in Visualizer Studio that will only let the controller with the highest value for that sound event, trigger an event?
     
  31. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Also, I set the Sub Group Count to 1 and the debugger does not debug. And the documentation does not document.. So even with what seems like what should be a 21Hz resolution, I'm forced to use 2 groups, which lessons it to 42Hz?
     
  32. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Sounds like you understand the basics of how to setup the data groups. Keep in mind though, the Hz shown in the debug is meant to be an approximation and not and exact number. It is calculated using what I understand of how FFTs are handled versus the window size. However, Unity's implementation under that hood that is being used may not be exactly as expected. So, in short, don't count on those values as an exact number.

    As for having 20 controllers, it's technically doable, but I've not personally tested that many controllers, so the debug display may not scale to display that many too well. The sub group count should usually be set to a higher number than that, needs at least 2.

    It sounds like you also need a trigger that can listen to 20 controllers. That is not something that is supported out of the box, as they are setup to listen to only one controller each. However, the setup you want should be doable, you'd just have to write some custom script.

    I'll look into updated the inspector UI to properly limit the sub group count to it's expected minimum, as well as add some more extra data about the data group setup.
     
  33. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Is it possible to have certain actions take place only at certain pieces of music... for example fireworks exploding at every cymbal crash, but at no other time. Thank you
     
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    not unless you are really clever at frequency keying.
    or created some other additional mask/flag system outside the app to account for "valid periods of operation"

    AIUI
     
  35. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    If you look in the included demo scene, you can see a setup example as the fireworks are hooked up in that scene. Look for the "FireworksHigh" object. These are setup to trigger when the high frequencies peek. It's not an exact science, but it is using Visualizer Studio to keep track of the peaks in those frequencies, and then trigger the spawning of those particles when it peaks.
     
  36. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    it's more or less the same concept as the old Drawmer noise gate frequency key inputs.
    End of article http://www.soundonsound.com/sos/apr01/articles/advanced.asp

    Basically think of it as setting a "Range of reaction", if you could change those ranges on the fly then it would be possible, but not practicable, to follow any piece of music. Not practicable because, as you would need to know the ranges of interest in advance, you might as well just script the actions anyways.

    For the kind of thing you are taking about there I use DarkAce Curves. http://u3d.as/content/dark-1/dark-ace-audio-curves-and-events/75d , hope it helps.
     
  37. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Sweet, that's a really neat project! I had thought of doing something like the dark ace audio curves a while back as well, it's cool to see someone actually did it! Thanks for the link!
     
  38. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    • Yeah, Sorry, I meant to quote "Is it possible to have certain actions take place only at certain pieces of music... for example fireworks exploding at every cymbal crash, but at no other time. Thank you"
    • And Sorrry for cross posting other products. I am in no way affiliated. Just saying :)
    Enjoyed your app so far. The generalised triggers are the most helpful things so far.

    EDIT: Worked great on android on first tests. No tweaking from defaults whatsoever.
     
  39. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Oh, no problem about posting the link to the other product. As you point out in your comment about the generalized triggers, Visualizer Studio is more about a general approach to music visualization. To be able to take any song as input and react to it in a general way. The product you linked is to visualize a very specific song in a scripted way, which is a different product and also very cool! Not every product can do everything, so I have no problem pointing people to a product that better suits their needs. :)
     
  40. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Is there a way to get access to the frequency data?
    So I can do even more general things?

    I'll go pore* over the docs and those forum posts I found for more deets

    *The verb pore, with the meaning “examine closely,” may derive from two Old English words, a verb, spyrian, meaning “to investigate, examine,” and a noun, spor, meaning “a trace, vestige.

    Before I get my flamesuit on
     
  41. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    On the VisManager object, you can call GetSpectrumData() or GetRawAudioData().

    Raw data shows this: http://docs.unity3d.com/ScriptReference/AudioSource.GetOutputData.html
    Spectrum data show this: http://docs.unity3d.com/ScriptReference/AudioSource.GetSpectrumData.html

    Visualizer Studio takes that data (usually the spectrum data), and breaks it up and processes it as configured by your data groups and controllers.
     
  42. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Thanks very much.

    I'll tell you why. Seems to me that mapping the relative normalised frequency data 0 -> 1 from 20 to 20k say, would neatly map to a controller output in your app.

    just as a global perhaps. RMS average over - say - .3 seconds (or something) for the (mean/median/modal or w/e) average to spit out a 0 to 1 value... you could easily kink the output via exponential curving / weighting / sigmoids to get a more pleasing result. as you know.

    EDIT: Actually - thinking about it, in dance music that would produce a swinging sawtooth or sinusoid. not that useful.

    However, retrieving that value on a per "keyed" group basis would produce much more satisfying output. so - yeah, basically a normalised "Maximal Average Peak Frequency" per group would be awesome I reckon. Giving finer granularity and allowing for cross wiring the same data at offsets to create super patterns more easily. also allow for very rough "tune following".

    The very low cases might produce odd results and need eliding, the very high cases might be alias prone and need generalising (I'm purely speculating). A little derping for a sweet useful range I suppose.

    Tons of applications for that surely.

    anyways, that was my thought.
     
    Last edited: Nov 24, 2014
  43. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi, it seems Visualizer Studio is causing camera/microphone permissions to be required in Android builds, causing these lines to be added to the AndroidManifest.xml:

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-feature android:name="android.hardware.microphone" />

    Even though I deleted from the scene the microphone listener component that Visualizer Studio uses, I guess Visualizer Studio still triggers these permissions due to internal references to the microphone in the source code (which I don't have access to since it's not included in your package). Any advice on how I can somehow disable all references to the microphone so these permissions aren't added to the AndroidManifest.xml file?

    To further clarify, I really need to disable the microphone permissions as I am making a kids app. It will negatively impact downloads from cautious parents, and I don't blame them, because the these permissions cause the warning "This app requires webcam/microphone recording" to come up during install. It makes it seem like the app will record video and audio of their children, which is way creepy.

    Thank you
     
    twobob likes this.
  44. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hi. I need a way to simply detect the BPM of an AudioClip when it's loaded and nothing else. Would Visualizer Studio be ok for that or it would be overkill (since it would add a lot of additional unneeded stuff)? In case it would be ok, may I ask an example of how one could do that (if it's not too long for you)? :)
     
  45. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    pretty sure this would be the exact opposite of what you need.
    Short of making a subdivision of the stuff into bass, timing the pulses by hand, and dividing that over time inside some sort of sliding windowing function. In short. You could, but you wouldn't.

    Or scanning the entire track 1st one time and then hard coding it.
    at which point why would you want something realtime?

    I of course skipped the details of separating bass from kick, setting likely detection ranges, odd time signatures (dubstep), individual phases of odd beats in length (hard dance and logical house), swing (everything since the 70's), discarding offbeats, rallentando (club house), sections done "Colla voce" (current fad in Commerical Radio Dance openings) , et cetera... non trivial.

    I would say it is a No, perhaps that author knows of some feature I missed. I focused on the dance stuff cos that's what most folk who do beat detection think they want it for...
     
    Last edited: Nov 29, 2014
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Thanks @twobob. Indeed I don't need something that updates in realtime other than a handy method to detect the BPM when loading, and I don't care about speed either for what I'm doing. I'll look for other solutions in the meantime.
     
  47. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I see - a "full-pass" best-guess BPM scanner -
    I had a mate who wrote one of those once. He said it was fairly easy IIRC with .net. Think he reffed this, but I could be wrong. I forget the audio helper library but it was a MS one.

    There are solutions on here (Asset store) for BPM detection also.

    Here is where I would start digging. http://soundtouchdotnet.codeplex.com/ for c# code

    I haven't found any "scanning" functions like you describe in this product. Hope it helps.
     
    Last edited: Nov 29, 2014
    Demigiant likes this.
  48. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Sorry for the delay in reply, I've been out of town for Thanksgiving and just returned to my computer to catch up on things.

    Have you deleted the VisMicrophone.cs and VisMicrophoneEditor.cs files from your Unity project? I searched the DLL project, and it has no references to anything for microphones in it. So, the only references is in those two files.

    Let me know if that does it for you.
     
  49. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Twobob is indeed correct, Visualizer Studio is not intended to detect BPM.
     
  50. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Ah, nice, I too need this. Must try that out! asap