views:

67

answers:

3

1. I have created a audio player in silverlight.

within that player user is able to select a portion of song to save as ringtone.

but i got the time duration from .. but I have to cut the partial portion of stream or audio stream and save it to the server dick.

Plz suggest me how I can convert the selected audio time duration into the stream or byte array..?

-- Additional information on this question: 2. I have created a ringtone audio player in silverlight. Within that user can select a portion which can be cut and save as a audio file.

I am unable to save the stream to the disk.. it is giving following errors:

Error 1. Attempt to access the method failed System IO FileInfo OpenWrite

Plz help

-- Additional information on this question: 3. What are the use of MediaStreamSample & MediaStreamSource class in silverlight with respect to MediaElement?

Will it help in cutting a portion of audio file in order to create the ringtone out of a song?

A: 

Error 1. Attempt to access the method failed System IO FileInfo OpenWrit, you getting this error coz of security reasons. Before saving to disk you should promt SaveFileDialog to user, and then only save file to disk.

Silverlay
I have to save that stream at server side not on client machine.
ajit kumar
+1  A: 

If you need to save to the server, then you need to get that data to the server.

Just saving it (as answered) will try to save to the client's machine. What you need to do is upload the data to the server either via a WCF service or an ASHX handler or such. I've done something similar -- uploading MP3 files from a Silverlight client to a WCF service via a Stream, works well.

Next: You need to make sure that whatever splitting process you use accommodates the audio format-- ie you probably just can't split the binary file. What format are you using, mp3?

I've used something called mp3plt, before to split mp3s. You may be able to recompile the source into a Silverlight-compatible library, assuming it's written in something you can use, source here.

Or you can look into the mp3 specs to see if it is possible to just split the binary file, in which case taking the duration to cut (the one the user chose), and multiplying by the bitrate, (kb/s * seconds = kb) will give you the place in the file byte[] you can cut at.

Bobby
A: 

ok.. thats right.. plz provide me more detail in this respect.. can u plz provide me some sample code for this.. so that i can take hint from the code

ajit