Playing mp3 file while receiving it from stream

E

ElvisRS

Hi,

I have a stream with an mp3 file inside that i am receiving and saving
locally on disk. Is there a way to start playing that file while
download isn't completed?
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

It depends of what you are going to use to play it back.
 
E

ElvisRS

Thanks for your reply,

I was looking for something inside WPF but the source for MediaElement
must be a complete file. I read also about DirectSound and here i
found Buffer which can play audio from stream but the data in that
stream must be an decoded audio. The problem is that i receive by my
stream an entire mp3 file.
If you have any suggestions what i should use and what looking for let
me know.
 
E

Eps

Hi,

I have a stream with an mp3 file inside that i am receiving and saving
locally on disk. Is there a way to start playing that file while
download isn't completed?

when using wpf you can access System.Windows.Media.MediaPlayer, which
can open a mp3 from a URI, so it may work for you.

I am trying to write an mp3 player at the moment, there are a few ways
of playing mp3's (mediaplayer, directx audiovideo class, playing through
windows media player, etc.) but I also want to play ogg vorbis as well.
I have got a non microsoft ogg library working but that plays them at
a much louder volume than any of the mp3 playing methods, I have turned
the volume up when playing mp3's but it is still quiet compared to ogg.

It is meant to be a winamp clone, I am starting to think my options are
to either cut ogg support or try and write my own libraries for playing
both mp3 and ogg.
 
L

Liz

I am trying to write an mp3 player at the moment, there are a few ways of
playing mp3's (mediaplayer, directx audiovideo class, playing through
windows media player, etc.) but I also want to play ogg vorbis as well. I
have got a non microsoft ogg library working but that plays them at a much
louder volume than any of the mp3 playing methods, I have turned the
volume up when playing mp3's but it is still quiet compared to ogg.
It is meant to be a winamp clone, I am starting to think my options are to
either cut ogg support or try and write my own libraries for playing both
mp3 and ogg.

I don't know how you are getting consistent volume within the MP3s OR OGG
collections of files ... some tracks are just louder than others .. but if
OGG is actually consistently louder across the board, you should be able to
come up with some sort of (simple) heuristic to compensate the volume, no?

if (OGG)
volume *= .83;
 
S

Serge Baltic

Hello,
It is meant to be a winamp clone, I am starting to think my options
are to either cut ogg support or try and write my own libraries for
playing both mp3 and ogg.

Have you tried DirectShow filters for ogg vorbis, like those in the K-Lite
codec pack? For me, their volume is quite normal, when played with WMP.

(H) Serg
 
E

eps

Serge said:
Hello,


Have you tried DirectShow filters for ogg vorbis, like those in the
K-Lite codec pack? For me, their volume is quite normal, when played
with WMP.

(H) Serge

direct show is deprecated and I think I am right in saying that it is
not present in the current version of the direct x sdk

I have thought about installing an older directx sdk but that doesn't
really appeal to me, especially since this is a wpf app, I don't want
legacy stuff that may stop working at any time
 
E

eps

Liz said:
I don't know how you are getting consistent volume within the MP3s OR OGG
collections of files ... some tracks are just louder than others .. but if
OGG is actually consistently louder across the board, you should be able to
come up with some sort of (simple) heuristic to compensate the volume, no?

if (OGG)
volume *= .83;

Your right to a certain extent, although my music collection is almost
entirely normalized (by album though which still leaves room for varying
volumes).

I could do as you suggest, but it seems to make things unnecessarily
complex (Eventually I want the user to be able to control the volume
which means the ogg volume would always have to be a ratio of the true
mp3 volume), the ogg library I am using is clunky in other ways as well
 
P

Peter Duniho

direct show is deprecated and I think I am right in saying that it is
not present in the current version of the direct x sdk

It's not deprecated. As the MSDN documentation says, it's been moved to
the platform SDK.
 
E

eps

Peter said:
It's not deprecated. As the MSDN documentation says, it's been moved to
the platform SDK.

oh, I may look into that again then, have you ever used it ?, if so do
you have any code examples ?.
 
E

Eps

the above library is designed only to work from within a windows form :(

turns out that if you install an ogg direct show filter then the media
player available in wpf can play them

System.Windows.Media.MediaPlayer

and the volume is consistant too, so I am pretty happy now
 
S

Serge Baltic

Hello,
direct show is deprecated and I think I am right in saying that it is
not present in the current version of the direct x sdk

DirectShow filters are the driving force behind any media players on the
system, so once you have an OGG DS filter, any contemporary media-player
function should become capable of playing them. I doubt you'll ever have
to run them manually to just play a file.

(H) Serg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top