audio visualizer for iPhone - mic on/off switch

Hi guys

I’m trying to make music visualizer on iphone/ipod touch. I referenced “audioInputExample”, so it can detect sounds from the mic and visualizes the sounds as graphic images. However, I would like it to detect sounds from the default, built-in music player on the iphone/ipod touch. Also,I would like to add a “turn mic off/on switch”.
I tried to find the codes to do it in this forum, but I couldn’t find them. Please help!!

I don’t think it’s possible. I’d love to be wrong on this though. You can use the mic to detect sounds external to the device, but not from the device itself.

[edit] After seeing Audiogasm I’m going to modify this as: You can use the mic to detect sounds external to the device, but not from the device itself - unless you initiate those sounds yourself.

Thank you for quick response, DavidDC! :frowning:

Actually there is a way, as Audiogasm manages a workaround. I’m not quite sure how they do it. It may be that they are playing the music themselves - although the iPod music player is playing the track on exit. An area for research anyway.

I don’t have Audiogasm but looking at the app store description, it still needs a microphone.

I think using your own music playback routine is the only way you’ll be able to do viz without a mic.

Something like FMOD’s spectrum analyser would be more accurate than the microphone anyway. I think Audiogasm could be using both. In app you have to manually select the songs you want to visualise via their custom file browser. If they were grabbing the iPod player datastream direct either via mic or memory scraping they wouldn’t need to do this. They could just get the user to play whatever they want on the ipod player before loading up the visualiser.

They could be doing something wild like playing the song via FMOD and then starting iPod player on exit at the point in the song they just played. I wonder if that’s even possible…

[edit] I’ve been thinking about this a while now and my best guess is that they detect which song is playing on startup, and resume the song manually. You need to resume as iOS automatically detects the use of audio libs and stops background playing when your app starts. I’m guessing they are still using the iPod media API and playing through that. So the music analysis/response is all through the microphone. This would explain why the iPod player continues the music on app exit.