Coder Social home page Coder Social logo

Comments (4)

Matt54 avatar Matt54 commented on July 19, 2024 1

@AttilaTheFun Hey! This came across my email so I daydreamed about it while walking my dog. AudioKit may not currently have a solution, but here are some thoughts for putting one together:

If you find the function in AudioKit: loadAudioSignal(audioURL: URL) -> (signal: [Float], rate: Double, frameCount: Int)?

This will return for you an array of floating point values (signal) for a given audio file (as well as the sample rate and number of samples).

As far as combining lossless files go, we can think of it as simply adding the samples together. Assuming the sample rates of your two (or more) files are the same, then all you need to do is:

  • loop for the longest sample count
  • add all the existing samples from the audio files together at that index/frame
  • hard clip / clamp to the min/max [probably just -1.0 / 1.0]

Then you will be left with a resulting floating point array with an associated sample rate (same from before) - I imagine that you could google your way to flipping that into an audio file from there 🙂

from cookbook.

aure avatar aure commented on July 19, 2024

AudioKit doesn't have too much to do with audio file creation, besides recording. It would be a nice addition. It's not really a Cookbook issue though, since if it's not part of AudioKit it can't be in the Cookbook, so I will close this here.

from cookbook.

Matt54 avatar Matt54 commented on July 19, 2024

@AttilaTheFun Things get more complicated if the sample rates are not the same. I can imagine then the solution would look like resampling any audio file that is not at whatever your desired output sample rate would be before doing the loop/arithmetic.

Even still, it probably wouldn't be that bad. I think there are some Accelerate functions for performing this sort of resampling for you.

from cookbook.

AttilaTheFun avatar AttilaTheFun commented on July 19, 2024

Awesome, I'll see if I can get that working this weekend! 😊

from cookbook.

Related Issues (20)

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.