Giter VIP home page Giter VIP logo

audio-visualizer's Introduction

Lorenz System Audio Visualizer in Unity3D

Overview

This is my first project in Unity3D and first experience in game development and CGI. It is an audio visualizer in the pattern of a Lorenz System, which is a system of 3 ordinary differential equations that form the shape of a butterfly or figure-eight. The objects at each point change size and color with the song's audio frequency.

Changes

This project was modified from Hypnotoad09's original project (see Videos and References sections below), which was then converted from UnityScript to C# by Dommii.

Code Refactoring

  • The pattern that is created can now be changed in the IDE, by making an enum value for the pattern type a public field. This enum is passed into a Factory Method that creates a List of vector points. The List of points is a property on an abstract base class, Pattern. The classes Lorenz and Circle inherit from Pattern and add to this List according to their own variables like radius for Circle and sigma, rho and beta for Lorenz.
  • Fields that were duplicated between scripts like maxHeight for the object, were made public in AudioManager.cs and internal elsewhere.
    This creates one central access point for editing parameters, rather than having to know which script to open, and eliminates ambiguity of which value from the two scripts will actually be used.
  • Objects expand depending on the type of prefab mesh is used. For example, if the mesh is a sphere, it expands in all dimensions, but only expands in the y-dimension for cubes.
  • Added an accessor method into the AudioManager's internal array of frequency samples rather than indexing into the array directly.
  • Commented code, sectioned off regions for Fields, Parameters, Event Functions, and Methods.

Visual Updates

  • Added a skybox background.
  • Added a silver reflective object material for each prefab object.
  • Prefab objects expand downwards as well as up.

Assets

Scripts

  • Visualizer.cs: Creates a prefab object at each location for the specified pattern. Currenctly either Lorenz or Circle patterns can be chosen from the Unity IDE.

  • AudioManager.cs: Saves the song's audio frequency data to an array with a size of the given sampling rate. Samples are taken using a Hamming Window.

  • PrefabBehaviour.cs: Updates each prefab's size and color according to the current audio spectrum value and its position in the Hamming Window.

  • CameraRotation.cs: Rotates the camera's position on a specified axis and at a specified rotation rate.

Patterns

  • Pattern.cs: Abstract base class that others below derive from. Has a List of points that the derived classes add to using its specific implementation of the AddPoints method.

  • Lorenz.cs: Implements a Lorenz system.

  • Circle.cs: The points that were generated in Hypnotoad09's original project.

Materials

Executables

Files to download that allow you to change the visualization's resolution and frame rate.

Videos

References

Future Enhancements

  • Create a UI with sliders that changes the visualizer's parameters, like number and max size of objects, as seen in this project.
  • Add the ability to select your own audio file.
  • Listen to any audio coming out of speakers. This is much harder to implement, as it would require writing a plugin to get the audio directly from the hardware device.

audio-visualizer's People

Contributors

aldrinabastillas avatar domiii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.