Giter VIP home page Giter VIP logo

Comments (2)

jesse-scam avatar jesse-scam commented on August 23, 2024

Sure.

Basically what you'll want to do is reduce the SpectralFluxAnalyzer::spectralFluxSamples to only contain the information you want to store to a file.

At the point where the full audio file has been processed:
https://github.com/jesse-scam/algorithmic-beat-mapping-unity/blob/master/Assets/Lib/Internal/SongController.cs#L143

You are guaranteed that the public member SpectralFluxAnalyzer::spectralFluxSamples has all of the information you are looking for.

Now, you can loop through that List, picking out which items you care about. If you only care about peaks, you could do this when the peak is detected, but we'll assume that you want to pull information after the processing has completed.

You could do something like:

  1. Loop over preProcessedSpectralFluxAnalyzer.spectralFluxSamples, storing the string time of each sample you want to save.
List<string> timeStrings = new List<string> ();
foreach (SpectralFluxInfo info in preProcessedSpectralFluxAnalyzer.spectralFluxSamples) {
    if (info.is_peak) {
        timeStrings.Add(info.time.ToString());
    }
}

Pseudo-code, but you get the idea.

Then write all strings of this List to a file:
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealllines?view=netframework-4.7.2#System_IO_File_WriteAllLines_System_String_System_String___

If it isn't quite the format that you want, you could build a string in the loop instead of adding to a List, or you could store the information you want to save in a Serializable struct or class, and save the serialization to the file.

Quite a few choices. Let me know what you come up with!

from algorithmic-beat-mapping-unity.

dza6549 avatar dza6549 commented on August 23, 2024

Wow thanks @jesse-scam. Do you home deliver hot food to Australia as well? :)

I'm very much a newb and quite in the dark. Originally I thought the Timeline would be the way to approach this but as I've read a bit more about how things work in Unity I'm thinking I could process the samples and extract a number of "tracks" based on various properties and then feed those "tracks" into a procedural routine that animates various GameObjects in the scene. Sort of like number of differently EQ'd and effected sub-busses on an audio mixing deck. I think this might enable me to, for example, apply LocalScale to a number of different objects at different timings but still be "holistically" in time/visually synced with events in the audio track.

I'll give these ideas a shot and let you know.

Thanks again. Cheers

from algorithmic-beat-mapping-unity.

Related Issues (3)

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.