1

I'm wanting to create a program that you can import an mp3 file into, and tell it to play it starting at a specific position, and to play for a specified amount of time.

I've looked into NAudio, and got it to play and stop the mp3 file, but I can't figure out how to start at a specific position. Anybody know what I should do?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Entity
  • 7,972
  • 21
  • 79
  • 122
  • Sorry, don't know C#, BUT do you stream the file &| provide a file object? The MP3 header is relatively easy to decipher and estimate location of time in the stream/file. – Jé Queue Jan 12 '11 at 01:22

1 Answers1

1

If you're using NAudio, look for a Seek method on the output stream -- the information returned from this Google search, http://www.google.com/search?q=seek+site:naudio.codeplex.com, should get you started.

You could also use some old but functional Windows APIs (the MCI interface) as shown here: http://forum.codecall.net/csharp-tutorials/20420-tutorial-playing-mp3-files-c.html demonstrates how to call MCI from C#. MCI uses a very simple string interface, so once you can call it at all it's pretty easy to use any command it supports, and it supports seeking, with the "seek [file] to [position]" command, as shown here: http://www.codeproject.com/KB/audio-video/MP3Example.aspx.

metamatt
  • 13,809
  • 7
  • 46
  • 56