Due audio + run stepper motor concurrently?

I'd like to play some prerecorded music and control a high-speed stepper motor at the same time using an Arduino Due.

Looking at the audio example on the Arduino website, it looks like the Audio.write() function does not return until all the buffer has been played. It therefore seems that it would not be possible to drive a stepper motor concurrently as either the audio would stutter or the motor speed would be very slow.

Is that correct and if not, how could I solve my problem please?

I had the same issue. I wanted to play music with the Seeed Music Shield on an UNO and poll input for new song requests at the same time. I could not find a way to do it on one Arduino so I added a second Arduino and split the tasks between the two. One Arduino queues up song requests while the other Arduino plays them. Still wish I could find a way to do both on one Arduino. -Steve

You could probably use a timer to regularly interrupt the music playback process and run a short routine to check for new song requests. Or you could put the polling in the same loop that plays the audio. It depends on how long the polling takes and whether it will cause a glitch in the music. If you use a lower sampling rate for the music then the time between each sample wil be larger, giving you more time to do something else.

On the Due you could possibly have two processes running in parallel though it's not clear to me how / when exactly to use the yield() function.

What I plan to do is to use an external MP3 player. That way the microcontroller only needs to send start / stop / next / prev commands with no other processing required. Here's an example of a hack of a very cheap MP3 player:

http://www.instructables.com/id/MP3-Interface-for-Arduino-Cheap-and-Easy/