Audio Visualization - Unity/C# Tutorial [Part 5 - Adding Buffers]

Поділитися
Вставка
  • Опубліковано 10 лис 2024

КОМЕНТАРІ • 53

  • @lowhueying
    @lowhueying 4 роки тому +4

    You're a genius for working out the logic for this exercise, and a saint for sharing them. Thank you so much!!

  • @RobertCasas
    @RobertCasas 7 років тому +9

    Very good tutorial. I have reviewed it two times to get all of them. Some points:
    - How do you make that cubes glow? You have emission color with realtime gi. I thought you need to have a baked gi to make this.
    - I made a music visualizer some years ago. One thing that was cool is adding a small cube on top of the cube bars for showing the top value. The typical bar stands "floating" for some time until goes down. I used colliders and physics to let the bar go down by gravity.
    And thanks! You are great

    • @vvitor95pt
      @vvitor95pt 5 років тому +2

      add a post processing from the unity store, add the post processing behavior to the camera or create a game object an place it there, then create a post processing profile where you have the assets/scripts, open the profile and turn on the bloom

  • @matthewmarcus1849
    @matthewmarcus1849 5 років тому +1

    thanks for these tutorials! They were very easy to follow and I have been wanting to add audio visualizers into my games for too long now

  • @timbarrett4580
    @timbarrett4580 7 років тому +3

    This worked beautifully. Thank you so much!

  • @Metacious
    @Metacious 6 років тому +4

    I fixed _bandBuffer -= _bufferDecrease[g]; for _bandBuffer[g] -= _bufferDecrease[g]; since Unity would complain about it
    Edit: well, the mistake was fixed 0.05 seconds after I paused the video. At least I'm glad I tried

    • @anthonyparisi8551
      @anthonyparisi8551 5 років тому

      lol i paused and panicked too

    • @Acrozi
      @Acrozi 5 років тому

      hey man, its the thought that counded

  • @VENTO_off
    @VENTO_off 4 роки тому

    Thank you very much for this tutorial! You helped me so much and now I understand how this works.

  • @StarOnCheek
    @StarOnCheek 5 років тому +6

    Did you just do
    if (foo) {}
    if (!foo) {}
    instead of
    if (foo) {}
    else {}

  • @lordciciu
    @lordciciu 5 років тому +3

    my real question is... can we do this with a particle emitter too?

  • @gamedevjourney4231
    @gamedevjourney4231 4 роки тому

    Cool tutorial. Thanks for sharing it with us.

  • @FireJojoBoy
    @FireJojoBoy 4 роки тому +1

    i followed the tutorial but it seems like the buffer does not work. Is this stuff normally working on Unity 2019.4?

  • @pfrankster
    @pfrankster 5 років тому

    Amazing your tutorials! Thx for share your knowledge, I´m learning a lot with you. Keep making then, U r fantastic bro. Good Job.

  • @auburnkit
    @auburnkit 7 років тому

    hey! Wanted to say these are incredibly great and informative videos and very helpful especially with someone with basic knowledge with scripting. I'm a broke college student so I can't contribute too much $, but I definitely will support in anyway until i can! Keep it up!

  • @LuisMaizo
    @LuisMaizo 4 роки тому

    Great Tutorial! Thank you very much!

  • @gooshy8854
    @gooshy8854 8 років тому +1

    I've been working on a visualizer in Unity as well. Instead of a buffer, I would adjust how often I got the spectrum data using Invoke. Nice going with splitting the frequencies into bands! It took a long time for me to split up the different sounds as well. How far are you taking this project? Now that the analyzing the data is finished, you can create a whole bunch of effects with it.

    • @PeerPlay
      @PeerPlay  8 років тому

      Hey there! I am just uploading the next part of the tutorial. I have been taking it quite far. Check out some other videos on my channel. I've made a whole bunch of games that run on audio. The invoke is a good one, I will check that out. I'm sure there is alot of optimization to be done, but I'm quite happy with the results I got. I'd love to see your take on it in script. Cheers!

    • @gooshy8854
      @gooshy8854 8 років тому

      github.com/gushrodah/Visualizor
      heres my project if you wanna check it out. definitely not as extensive as your code but just wanted to share it :D

    • @dylanhabersetzer4005
      @dylanhabersetzer4005 8 років тому

      Wade Gushikuma did that end up looking smooth?

  • @jmeph5221
    @jmeph5221 4 роки тому +1

    Hey I know this tutorial is old but I'm stuck. I'm having problems with it working. There are no errors in the console and I've looked over the code like hundred times and I can't find what wrong. I'm not sure what's wrong but it would mean a lot if someone could help me?

  • @vitorhugoferreira9559
    @vitorhugoferreira9559 7 років тому

    You have a great future!!!!

  • @jobbyjaws8050
    @jobbyjaws8050 5 років тому

    thank you for putting these up. do you know if it is possible to use an external audio program such as pure data as the audio clip to be analysed?

  • @crxssed7
    @crxssed7 5 років тому +1

    how did you get it to glow

  • @nand3kudasai
    @nand3kudasai 2 роки тому +1

    man that intro music rips my ears every time :((((

  • @DoomsDayFortress
    @DoomsDayFortress 6 років тому +2

    How did you make the cubes glow?

    • @PeerPlay
      @PeerPlay  6 років тому +3

      Assign emission color to the standard shader and use a bloom post processing on the camera.

  • @coreybertelsen7689
    @coreybertelsen7689 7 років тому

    hi, can you explain why the jittery effect occurs? is it a because of the difference between unity frame update (~30-90 hz) and audio filter update (~441khz or whatever your audio file is), or is it something else?

  • @VisserStudio
    @VisserStudio 5 років тому +1

    Thanks for the tutorial. I have a question: How can I make the buffer work on the ring / 512 samples? Because at the moment the buffer works on the 8 cubes and seems to be interwoven with 'band' code. I've been copy & pasting code from the other scripts and adjusting it but I can't seem to find out what I have to do/change to make the buffer work on those 512 cubes.

  • @slubberdegullion5699
    @slubberdegullion5699 6 років тому

    since I did the buffers the cubes are just flat?

  • @godsentthearbitor
    @godsentthearbitor Рік тому

    How do the cubes you have only extend in one direction. Mine extends both ways. Please help

    • @cheeseonvase4723
      @cheeseonvase4723 Рік тому +2

      In case you haven’t figured this out, this comes down to where the center of your objects are, in the video he is using a cube where the center is placed at the very bottom of the cube, so when it is scaled around it only scales up. In order to do this yourself just go to any 3D modeling site and make a cube, then move it so the bottom of the cube is touching the default point.

  • @nand3kudasai
    @nand3kudasai 2 роки тому

    my take on the frequency bar update
    void Update()
    {
    var val = useBuffer ? AudioPeer.buffers[band] : AudioPeer.bands[band];
    var scale = transform.localScale;
    scale.y = scaleStart + (val * scaleFact);
    transform.localScale = scale;
    }

  • @purpleice2343
    @purpleice2343 7 років тому

    Is it possible to be sure that no matter what kind of music I put on, sound will always be divided into same bands?
    (for example 0th is always bass, 6th seems to be high pitched rings and so on)

    • @PeerPlay
      @PeerPlay  7 років тому

      That is what this script currenly does. It divides any soundfrequencies over 8 bands between 0 and 20000 hertz. But those bands will be in the same ranges, and doesn't matter what audio is playing. If for example a song has a higher pitched bass, their bass could be present in band 1 instead of zero. To fix that, you could write an algorithm to determine what profile the song consists out of, and how it's own frequencies should be dispenced. classical piano music, would be totally different than a male voice track.

  • @Mickyelloow
    @Mickyelloow 7 років тому

    I don't know why but the buffer isn't working (the parametric cubes aren't doing anything). If I disable _useBuffer the bars are working the same way as in part 4 (without buffering).
    I have no clue what the problem is and I've checked everything. The parameters are the same, the scripts are identical, so WHY is it not working for me?

    • @PeerPlay
      @PeerPlay  7 років тому

      Mickyelloow that is a hard question specifically answer. Though what you can do: Debug.log() the bandbuffer values and see if they actually change. if they are working in the AudioPeer script, you atleast know there is something wrong in the parametric script.

    • @Mickyelloow
      @Mickyelloow 7 років тому

      I just checked that and I didn't forget to put BandBuffer() in the void Update. I didn't have the chance to check for the problem since I'm still in school and I'm learning C# (I'm a semi-noob at programming).

  • @Acoyo
    @Acoyo 8 років тому

    The function MakeFrequencyBands in the script AudioPeer is different from in the last tutorial. I have downloaded the source files but the folders appear empty. Stuck!

    • @PeerPlay
      @PeerPlay  8 років тому

      No it is not, I just removed the comment lines. And you are right, I haven't yet updated the source files ;) I'll send you the audiopeer class ;)

    • @Acoyo
      @Acoyo 8 років тому +1

      Works anyway lol, Iv changed a few things. Have them all rotating around an object on all axis. looks good. Cheers for the videos appreciated!

    • @prolthof
      @prolthof 8 років тому

      Thank you! I'm so glad I helped you! Good luck with your game designs!

    • @PeerPlay
      @PeerPlay  8 років тому

      lol I ment to reply with this account xD

  • @frankyredente4152
    @frankyredente4152 7 років тому

    thanks works great. could you please tell me how to change the instantiate512Cubes position? i would like to change the positions of the 512 cubes, by keeping the circle shape. the InstantiateCubes game object transforms controls dont affect the 512 cube position. I have manage to make a public float for the radius, but cant work out how to make a public float for the position . let me know if you could help thanks

    • @PeerPlay
      @PeerPlay  7 років тому

      Yes they do affect the position of all the cubes, as the 512 cubes are all childs of its parent. So move the transform of the parent object. The only way I could think of this not working, if you didn't actually parent the instances of cubes.

    • @frankyredente4152
      @frankyredente4152 7 років тому

      mm I think i did ..could you please help. ideally i would love to have public floats for x, y, z, position of the cubes.?
      using UnityEngine;
      using System.Collections;
      public class Instantiate512Cubes : MonoBehaviour {
      public GameObject _sampleCubePrefabs;
      GameObject[] _sampleCube = new GameObject[512];
      public float _maxScale;
      public float _circleSize;
      // Use this for initialization
      void Start () {
      for (int i = 0; i < 512; i++) {
      GameObject _instanceSampleCube = (GameObject)Instantiate (_sampleCubePrefabs);
      _instanceSampleCube.transform.position = this.transform.position;
      _instanceSampleCube.transform.parent = this.transform;
      _instanceSampleCube.name = "SampleCube" + i;
      this.transform.eulerAngles = new Vector3 (0, -0.703125f * i, 0);
      _instanceSampleCube.transform.position = Vector3.forward * _circleSize;
      _sampleCube [i] = _instanceSampleCube;
      }
      }
      // Update is called once per frame
      void Update () {
      for (int i = 0; i < 512; i++) {
      if (_sampleCube != null) {
      _sampleCube [i].transform.localScale = new Vector3 (10, (AudioPeer._samples [i] * _maxScale) + 2, 10);
      }
      }
      }
      }

    • @prolthof
      @prolthof 7 років тому +1

      I have really no clue what you mean. The script you posted is basically the script I have in the tutorial. All the transforms are public anyways.
      To move a cube:
      _sampleCube[numberYouWantToMove].transform.localPosition = ...something

    • @frankyredente4152
      @frankyredente4152 7 років тому

      hi i am not an unity expert sorry. thats why i posted the script for you to see. yes thats your script. I dont want to move 1 cube. i want to change the position of all instantiated512 cubes. the game object transforms (with the script) do not work change where the cubes are instantiated. going back to what you said :
      'Yes they do affect the position of all the cubes, as the 512 cubes are all childs of its parent. So move the transform of the parent object. The only way I could think of this not working, if you didn't actually parent the instances of cubes.'
      what you see wrong in the code i posted? where should i add :
      _sampleCube[numberYouWantToMove].transform.localPosition = ...something ??
      thanks for your help

    • @frankyredente4152
      @frankyredente4152 7 років тому

      btw nows it works. my professor helped me:
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Instantiate512Cubes : MonoBehaviour {
      public GameObject _sampleCubePrefabs;
      GameObject[] _sampleCube = new GameObject[512];
      public float _maxScale;
      public float _circleSize;
      public int numberOfCubes = 512;
      // Use this for initialization
      void Start () {
      for (int i = 0; i < 512; i++) {
      GameObject _instanceSampleCube = (GameObject)Instantiate (_sampleCubePrefabs);
      _instanceSampleCube.transform.position = this.transform.position;
      _instanceSampleCube.transform.SetParent(this.transform);
      _instanceSampleCube.name = "SampleCube_" + i;
      this.transform.eulerAngles = new Vector3 (0, -(360f / numberOfCubes) * i, 0);
      _instanceSampleCube.transform.position = this.transform.position + Vector3.forward * _circleSize;
      _sampleCube [i] = _instanceSampleCube;
      }
      }

  • @vitorhugoferreira9559
    @vitorhugoferreira9559 7 років тому

    This code works in realtime right?