简体   繁体   English

在iOS应用中混合Spotify曲目

[英]Audio mixing of Spotify tracks in ios app

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. 我的基本要求是混合两个或多个音频文件(就像DJ之类的应用程序)。我可以使用本地音频文件来做到这一点。 But I would like to know whether I can use two or more spotify tracks to be played simultaneously..? 但是我想知道是否可以使用两个或多个Spotify曲目同时播放..? or play my local file along with spotify track..? 或播放我的本地文件以及Spotify曲目..?

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.. 因此,我要做的就是从Spotify获得歌曲,然后在能够混合而不是Spotify音频播放器的应用程序音频单元中播放。

PLease suggest. 请提出建议。

If you're using CocoaLibSpotify, the Spotify Mac/iOS library, you get given the raw PCM data stream of the decoded audio. 如果您使用的是CocoaLibSpotify(Spotify Mac / iOS库),则会获得解码音频的原始PCM数据流。 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. 库中包含的代码使用Core Audio将数据传输到扬声器,但是您当然可以在图表中添加不同的Audio Unit以获得所需的结果。

As an example, this blog post (by me) discusses adding a graphic EQ to the graph: Core Audio: AUGraph Basics in CocoaLibSpotify . 例如,此博客文章(由我本人)讨论了如何在图形中添加图形均衡器: 核心音频:CocoaLibSpotify中的AUGraph基础 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). 值得一提的是,Spotify服务一次仅允许您流式传输一个音频轨道,因此您只能将一个Spotify轨道与本地轨道进行实时混合。

If Spotify allows you to pull directly from an audio stream or file, then you can certainly use Core Audio to do this. 如果Spotify允许您直接从音频流或文件中提取内容,那么您当然可以使用Core Audio做到这一点。 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. 不幸的是,AV Foundation无法执行任何实时音频处理(尽管在iOS 6中有所更改),因此您可能不得不使用Core Audio组合音频流(无论是本地还是远程),然后使用音频单元进行处理。做实际的音频处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM