A custom mp3 player

I want to create an simple mp3 player, but I want the files not to be mp3, to be converted some how to another format (not known) that only this player will play.

I just want my audio files not to be able to be played from other players.

How can I do it?

Can it been done using a simple file encryption/decryption?

I d prefer c# solution or something familiar.
Who is Participating?
MerijnBConnect With a Mentor Sr. Software EngineerCommented:
I must say that it might be a little bit over your head in 2 months, but I can't really tell how much 'general programming' experience you have.

Like said before, the question as a whole is too big to answer. I'll try to make smaller parts which you should dig into. If you have questions about those parts, ask a question here. But you should really try to do the big 'whole' thing yourself.

A little info: things like crossfading and seeking is something you want to do on uncompressed audio (PCM wave), not mp3 (or any other format you are going to use).

So the chunks are more or less:

- Pick a compressed audio format you are going to use. Look for something you can uncompress from code (in small parts, not as a whole!).

- Find a way to feed this audio to your soundcard. I don't know how this should be done (properly) in .NET, but with for example c++ one would use the API's WaveOutReset, WaveOutOpen, WaveOutClose, WaveOutPrepareHeader, WaveOutUnprepareHeader, WaveOutWrite, etc. If you want to do things like crossfade, you must be able to manipulate the audio at the sample.

- Play around with the PCM waves, try things like crossfading, etc.

- Pick a encryption / decryption algorithm. I don't think it will differ much which one it is. Keep in mind that you must be able to encrypt the source files in such a way that you can decrypt small blocks, instead of the whole file only, this is to keep things more secure (don't keep the whole song uncompressed in memory).

- Combine all above steps ;)

Hope you're not overwhelmed!
MerijnBSr. Software EngineerCommented:
How secure does this have to be / how much time are you willing to put in?
icecbrAuthor Commented:
The player will be used for simple use, just to play some playlists, with classic features such as crossfading the songs and shuffling them.

The "converter" will be a seperate program of course...

I prefer to be very secure. Time is not a problem, I have 1-2 months and maybe more...

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

MerijnBSr. Software EngineerCommented:
I'd suggest you simply encrypt normal mp3's.
You will probably spend the most time in decoding only little pieces in memory at a time and decoding these pieces, instead of the whole mp3 at once (insecure).
icecbrAuthor Commented:
could you give me more info plz?
MerijnBSr. Software EngineerCommented:
Do you have previous experience with processing and playing audio?
he whole thing is too big to just get a working solution to everything, so you'll have to break it down a little into smaller parts. What part is it you don't understand?
icecbrAuthor Commented:
No I dont have such experiense, I d say I have general programmin experiense, you r right, lets start from the beggining...

Firstly I am a little confused about what to use, I took a look at codeproject and found some mp3 players...
There are some ways to do it, like using winmm.dll directx and others...
Which are best for low cpu usage, seeking and of course I need crossfading?

Which is a good method for crossfading? get length of playing file and 10sec before it ends start playing the next file?

If for start I make a player just playing the mp3 of a folder and crossfading them its half my work, then I ll just add more playlists, shuffle etc...

and finaly I think that a method like this: http://www.codeproject.com/KB/security/fileencryptdecrypt.aspx can achive the encoding issue....

thank you
MerijnBSr. Software EngineerCommented:
Oh, on crossfading.

Crossfading consists out of two parts:

1) Being able to fade in and fade out (simple a matter of doing a multiplication on the samples).
2) Being able to mix two different audio signals (simple a matter of adding up the samples).

Keep in mind (for the fading) that the dB scale is logarithmic and not linear.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.