3 Replies
      Latest reply: Feb 1, 2017 3:03 PM by eskimo RSS
      McMatt_ Level 1 Level 1 (0 points)

        How would I store a file inside an app and when another sound file is recorded compare it with the saved sound? For example, I have a file named "file.mp3" when the user hits the record button and records a sound imitating the sound in "file.mp3". I would then tell the user how simular the recorded sound is to the saved sound  . So how would I do this. I am already able to record and save the sounds locally on the app but how would I then do this other stuff?

        • Re: Store file on app and compare it with a recorded file.
          eskimo Apple Staff Apple Staff (7,530 points)

          There’s a bunch of parts to this but the key component is DSP Magic™.  Comparing two sounds to see how similar they are is a very specialist technical field.  iOS certainly does not provide APIs for that.  You’ll have to write (or acquire) the code to do it.  It’s possible that someone here has some specific experience to share but, if not, you’re going to have to research this independently.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Store file on app and compare it with a recorded file.
              McMatt_ Level 1 Level 1 (0 points)

              I researched a little and it seems that getting the fft of a file seems to be the quickest option to try out. What is the best way to do this in Swift? I am a javascript developer and have not messed with swift.

                • Re: Store file on app and compare it with a recorded file.
                  eskimo Apple Staff Apple Staff (7,530 points)

                  Apple does provide Fourier tranform APIs as part of the Accelerate framework.  Specifically, you’ll want to look at the vDSP subsystem.  It’s possible to call these APIs from Swift but, as they’re low-level C APIs, it’s not particularly pleasant.  Moreover, there’s a big gap between a working Fourier transform and an audio comparison library.

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"