0

My basic requirement is to mix two or more audio files (Like a DJ kind of app).. I could do this using local audio files. But I would like to know whether I can use two or more spotify tracks to be played simultaneously..? or play my local file along with spotify track..?

So, all I want to do is get the songs from spotify to be played in my app's audio units that are capable of mixing rather than spotify's audio player..

PLease suggest.

revanth
  • 45
  • 2
  • 8

3 Answers3

1

If you're using CocoaLibSpotify, the Spotify Mac/iOS library, you get given the raw PCM data stream of the decoded audio. The code included with the library uses Core Audio to get that data through to the speakers, but you can certainly add different Audio Units to the graph to achieve your desired result.

As an example, this blog post (by me) discusses adding a graphic EQ to the graph: Core Audio: AUGraph Basics in CocoaLibSpotify. That post could well be a good starting point for making a more complex graph to suit your needs.

It's worth mentioning that the Spotify service will only allow you to stream one audio track at a time, so you'll only be able to do live mixing of one Spotify track with local track(s).

iKenndac
  • 18,730
  • 3
  • 35
  • 51
  • Thanks for the info. I will be using CocoaLibSpotify. what is the possibility that we can use multiple spotify tracks for mixing. Live mixing is not mandatory here. so, can we access tracks selected for offline playback? – revanth Jul 09 '12 at 14:59
  • No, not directly. The closest you can do is to stream one track after another and cache the PCM data yourself. However, this will take a long time since streaming is limited to 1.5x actual playback speed. – iKenndac Jul 09 '12 at 15:50
  • If I turn off WiFi and I am using the tracks already downloaded by marking that playlist to be available offline, I will not be having the streaming problem, right? But, Is this possible? – revanth Jul 09 '12 at 16:31
  • That's possible. However, the library will still only give you audio data at 1.5x, whether the tracks are cached offline or not. – iKenndac Jul 09 '12 at 16:42
0

If Spotify allows you to pull directly from an audio stream or file, then you can certainly use Core Audio to do this. Unfortunately, AV Foundation is unable to do any live audio processing (though this is changing in iOS 6), so you may be stuck having to use Core Audio to combine your audio streams (whether local or remote) and then use your audio units to do the actual audio processing.

CIFilter
  • 8,647
  • 4
  • 46
  • 66
0

You might want to have a look at https://docs.audiostack.ai/docs/automixingservice. I'd be intrigued if this solves your problem

Peadar Coyle
  • 2,203
  • 3
  • 16
  • 20