Skip to main content

Topic: Winamp 2 Kernel Streaming Output Plugin (Read 400815 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #75
Quote
How does one determine in detail the pathway and conversions that audio bits take on their way out of the computer like this?  I'd love to know exactly what is happening in my PC (which succesfully outputs via kernal streaming/foobar via coaxial out of the soundcard) and laptop (which does not seem able to use kernal streaming, even though it's an option in the f2k config menu, when using f2k and a USB out for audio).
[a href="index.php?act=findpost&pid=352987"][{POST_SNAPBACK}][/a]


I don't think there's an easy way to determine this other than researching chipsets and drivers on the Internet and even then it's probably difficult to be sure.

However, you can prove if your bitstream is being corrupted in some way by attempting to decode HDCD recordings with an external DAC or AV amp via SPDIF. If the external decoder can successfully "lock on" to the HDCD content (usually shown by some kind of visual indicator) then the bitstream has not been corrupted. Obviously, to do this you need to possess a suitable outboard decoder (and some HDCD material), but it's one of the simplest ways to determine if your bitstream is being "modified" in any way. The slightest change to the bitstream will prevent HDCD from being decoded, this is why I recommend leaving the volume control and oversampler disabled in the Kernel Streaming plugin if you listen to a lot of HDCD recordings.

In my tests with my M-Audio Audiophile 2496 outputting via SPDIF, I could not get uncorrupted HDCD out of the card via any Winamp output plugin other than Kernel Streaming. With Kernel Streaming it just worked perfectly (unfortunately the plugin itself was very unstable - leading to my recent redevelopment of it).

Hope that helps.

Steve

  • ivalladt
  • [*]
Winamp 2 Kernel Streaming Output Plugin
Reply #76
Is Winamp 2 still downloadable from anywhere?

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #77
Quote
Is Winamp 2 still downloadable from anywhere?
[a href="index.php?act=findpost&pid=353624"][{POST_SNAPBACK}][/a]


Hi, I don't actually know if you can still get hold of Winamp 2, but the plugin works with all versions of Winamp from 2 onwards. I'm using it with 5.112.

Hope that helps.

Steve

Winamp 2 Kernel Streaming Output Plugin
Reply #78
Thanks for this plugin! My brother has tried to get bit perfect optical transfer to his stereo for some time and I hope this can do it him for.

One thing that happen for me when some load is put on is that i crackles like hell like if I used to low latency with an ASIO driver... Is it possible to add a latency option in the plugin to maybe make it less "fragile"?

Thanks alot for this one!

Best Regards
Rickard Gerthsson
Sweden

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #79
Your welcome, I hope it does the trick for him, although, please bear in mind that it is dependent on the hardware whether or not the bitstream gets through untouched.

I can't say that I've experienced any crackling, but I'm not using ASIO drivers and run it on a 2.6GHz PC whos sole purpose is to play music through my HiFi, so I guess I'm not really stressing the CPU.

If you are experiencing problems of this nature, make sure you've got both the oversample and volume control disabled as they both make heavy use of the CPU.

In the longer term, I'll take a look at making the packet size adjustable, it's currently 8K per packet which is roughly 46mS or 1/21 seconds, so a larger packet size may help.

Cheers,
Steve

Winamp 2 Kernel Streaming Output Plugin
Reply #80
I am using E-MU 1820M with the latest 1.81 drivers if that might help... I also noticed that sound can go silent for like half a second if I click up mIRC or program that has been minimized. It doesn't not happen every time I do, far from, but I just wanted to let you know about it.
Regards
  • Last Edit: 01 January, 2006, 01:24:23 AM by punkrockdude

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #81
There's a new version of the plugin (V2.5) here which fixes the problem with streaming media (e.g. internet radio). I've also added support for playing back 24 bit media - if anyone has any (I had to make my own  ).

I've spent quite a while looking into punkrockdude's crackling problem and I think I know why it's happening, but, it's a bit tricky to fix as it stands.

In essence, despite having an 8K output buffer, Winamp is only sending me around 2K of sample data, so each sample packet sent off to the sound card is really small (only 576 sample pairs for 16 bit stereo) which means that the plugin can be quite susceptible to heavy processor usage (causing gaps between packets as the processor gets busy doing something else).

I had a look at buffering the small packets that WinAmp sends to me then, once I've got enough for a full packet sending it off to the hardware, but, given the WinAmp plugin framework, that's quite difficult to manage leading to various new problems so I've stripped all of that out for now.

Still, if I can come up with a workable solution that doesn't cause any new problems, I'll put it in.

Cheers,
Steve
  • Last Edit: 19 March, 2006, 03:58:55 PM by Steve Monks

Winamp 2 Kernel Streaming Output Plugin
Reply #82
Quote
I've spent quite a while looking into punkrockdude's crackling problem and I think I know why it's happening, but, it's a bit tricky to fix as it stands.


Thanks alot Steve! I really appreciate your help. I will download the update right away and try it out. I will get back to you and everyone else on how it works.
Happy New Year by the way!

Best Regards
Rickard G

  • callmeace
  • [*][*]
Winamp 2 Kernel Streaming Output Plugin
Reply #83
Thankyou very much for your improvements and time spent on this

The only problems I have had - which don't occur when I'm not using out_ks, was 'break up' of sound sometimes when dragging a scroll bar up or down in a program like internet explorer. or when another program does something intensive.

I am using:

Windows XP SP1
 
Soundcard as reported Creative AudioPCI (ES1371,ES1373) (WDM) which doesn't find an updated driver so I guess latest drivers installed. I think it is branded as a Creative PCI 128

Pentium 3 'Tualatin' 1.13ghz (not overclocked)

DirectX 9.0c

I run a generally clean system without lots of unnecassery programs running at startup. I avoid running many resource-hungry apps at the same time.
Does avoiding the Kmixer resampling mean that playing music via out_ks should takeup less system resources?

Anyway, hope my little report is some small help, thanks a lot

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #84
Thanks for the feedback guys, it's really appreciated.

Quote
The only problems I have had - which don't occur when I'm not using out_ks, was 'break up' of sound sometimes when dragging a scroll bar up or down in a program like internet explorer. or when another program does something intensive.
[a href="index.php?act=findpost&pid=353880"][{POST_SNAPBACK}][/a]


It sounds like the same problem as punkrockdude is experiencing, it's caused by the flow of data from Winamp to the sound card being disrupted because the CPU is busy doing other stuff (redrawing windows and so on). As Winamp is only sending very small packets to the plugin it only needs the CPU to be kept busy for a short period of time before an audible break in the data flow occurs.

As I said to punkrockdude, disabling the volume control and the oversampling may help as it reduces the amount of work the plugin is doing.

Unfortunately I can't reproduce this effect as my slowest machine is a 2.6GHz Celeron and, apart from the occasional pause when maximising windows I don't get any problems (I even tried loading the CPU up the other day doing simultaneous video and MP3 encoding with other apps while running Winamp and had no problems).

I'll try a new approach to buffering the data using another thread to drive it along and see if that helps, although that's essentially a rewrite but it may allow me to get rid of a couple of other bodges that have so far eluded me.

Winamp 2 Kernel Streaming Output Plugin
Reply #85
Quote
I'll try a new approach to buffering the data using another thread to drive it along and see if that helps, although that's essentially a rewrite but it may allow me to get rid of a couple of other bodges that have so far eluded me.


I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #86
Quote
I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards
[a href="index.php?act=findpost&pid=353967"][{POST_SNAPBACK}][/a]


Thanks, it's actually been quite fun to do. My original intention was only to sort out the stability problems which were affecting me (and from what I've read, other people too) however with that out of the way it's surprising how many other enhancements can be added to something like this.

I imagine that the Foobar API is a little more flexible than the Winamp one which is probably best described as "basic" (Foobars API looks huge from what I've seen). Still, it does make it very easy to get to grips with when starting from first principles, but it gets in the way when trying to add features such as buffering to this plugin (partly a fault of the way the plugin is currently structured too).

In order to add buffering I'm going to have to internally split the plugin into two parts, one part to talk to Winamp and a second part which will run pretty much independently handling the actual streaming side of things and acting on messages from the other half. If I can put this together in the time I have available (back to work in a couple of days - no more time to play), then I'm pretty confident it will solve your problems.

Cheers,
Steve

Winamp 2 Kernel Streaming Output Plugin
Reply #87
Quote
Quote
I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards
[a href="index.php?act=findpost&pid=353967"][{POST_SNAPBACK}][/a]


Thanks, it's actually been quite fun to do. My original intention was only to sort out the stability problems which were affecting me (and from what I've read, other people too) however with that out of the way it's surprising how many other enhancements can be added to something like this.

I imagine that the Foobar API is a little more flexible than the Winamp one which is probably best described as "basic" (Foobars API looks huge from what I've seen). Still, it does make it very easy to get to grips with when starting from first principles, but it gets in the way when trying to add features such as buffering to this plugin (partly a fault of the way the plugin is currently structured too).

In order to add buffering I'm going to have to internally split the plugin into two parts, one part to talk to Winamp and a second part which will run pretty much independently handling the actual streaming side of things and acting on messages from the other half. If I can put this together in the time I have available (back to work in a couple of days - no more time to play), then I'm pretty confident it will solve your problems.

Cheers,
Steve
[a href="index.php?act=findpost&pid=353971"][{POST_SNAPBACK}][/a]


I really look forward to see what you will come up with. I will check this thread several times each day to be up to date on it

  • Gabes Dad
  • [*]
Winamp 2 Kernel Streaming Output Plugin
Reply #88
Steve,

I don't know if you have used ASIO4all or not but it has buffering built in and I believe the buffer size is changeable.  I haven't used it in a while and I believe a newer version has been released since then.  To use it with winamp, you also need the asio output plugin.

Anyway, I don't believe the source code is available, but I believe the author would be willing to give you any advice needed.

One other small thing, which really isn't an issue for me, but if you try playing something from the "winamp music" (not shoutcast radio or aol xm radio) of the online media section in the media library, it will play but choppy and at the incorrect speed.  This plays fine with DirectSound and it the winamp modern skin is showing a 44.1k sampling rate and 65 kbps bitrate, although the audio sounds like a lower sampling rate - I though it may just be a sampling rate my sound card couldn't handle.  Anyway just wanted throw this out there for troubleshooting.

By the way streaming (with and without extensions) works great on my setup.  Thanks for all the hard work.

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #89
Quote
I don't know if you have used ASIO4all or not but it has buffering built in and I believe the buffer size is changeable.  I haven't used it in a while and I believe a newer version has been released since then.  To use it with winamp, you also need the asio output plugin.

Anyway, I don't believe the source code is available, but I believe the author would be willing to give you any advice needed.


Hi, nope, I haven't had a play around with ASIO drivers as I'd pretty much got the Kernel Streaming plugin doing what I needed. Might take a peek though.

Quote
One other small thing, which really isn't an issue for me, but if you try playing something from the "winamp music" (not shoutcast radio or aol xm radio) of the online media section in the media library, it will play but choppy and at the incorrect speed.  This plays fine with DirectSound and it the winamp modern skin is showing a 44.1k sampling rate and 65 kbps bitrate, although the audio sounds like a lower sampling rate - I though it may just be a sampling rate my sound card couldn't handle.  Anyway just wanted throw this out there for troubleshooting.


Yep, it does the same for me (I'd never even noticed the "Winamp Music" option!). I reckon it's either the latency value I pass back to Winamp on initialisation or the GetOuptutTime/GetWrittenTime functions which (as far as I can see) don't return "proper" values. Another one for the bug list.

Quote
By the way streaming (with and without extensions) works great on my setup.  Thanks for all the hard work.


Great, glad to hear it. Once again, thanks for the feedback.

Regards,
Steve

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #90
There's an alpha version of the new plugin available here (V3.0 alpha). This is an incomplete work in progress version which lacks the following features (for now);

pause
volume control
24 bit support
oversampling

It's essentially a rewrite and uses my new buffering technique which I hope will solve the crackling under load problem. It also now seems to work better with "Winamp Music" with just a little breakup at the start.

It seems to behave okay here but I'd like to know if it makes matters any better (or worse) for those of you who were getting the breakup under load problems (e.g. punkrockdude and callmeace), I'd appreciate it if you guys could give it a try and let me know how it goes.

This plugin is V3.0 alpha, so you'll have to select it as the output plugin instead of the existing one. All config settings other than Output Device are ignored for the minute and you may need to re select your output device if you are not already using the default.

This is test code and although it works fine for me it may crash your systems, so I'd recommend saving any important data before you try it. As usual, you try it at your own risk (although it shouldn't do anything catastrophic).

Cheers,
Steve
  • Last Edit: 19 March, 2006, 03:59:35 PM by Steve Monks

Winamp 2 Kernel Streaming Output Plugin
Reply #91
Great work Steve! I can't seem to get any crackling or machinery sound with the new version! Wait... some stuttering happened now. But maybe that is my computers fault and not a bug in your plugin...

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #92
Quote
Great work Steve! I can't seem to get any crackling or machinery sound with the new version! Wait... some stuttering happened now. But maybe that is my computers fault and not a bug in your plugin...
[a href="index.php?act=findpost&pid=354262"][{POST_SNAPBACK}][/a]


That sounds promising, I don't like the stuttering though. It might help if you can give me the following details;

When it stuttered...
What other stuff was running at that point?
Were you doing anything with the machine at that point?
Was it at the start of a track or part way through?
What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
What speed / type of CPU have you got?

Thanks for your help.

Regards,
Steve

  • Gabes Dad
  • [*]
Winamp 2 Kernel Streaming Output Plugin
Reply #93
The new alpha plugin is working well here for me as well.  I did have some stuttering before with the old plugin, but I can't remember if that was on my 1 Ghz P3 at home or my 2.8 Ghz HT P4 at work (I'm currently using my work machine).  It also works fine with Winamp music.

The only thing I noticed different when examining winamp and its associated processes with Process Explorer is that a thread for out_ks3.dll shows up as a subset of the winamp threads.  When using the out_ks25.dll output, no corresponding thread appeared under the winamp threads.  The differences are probably due to the rewrite.  There was a slight increase in winamp CPU usage (from an peak of 0.75% to 1.5%), but perhaps the old plugin showed up under a different thread.

Great Stuff.

Edit: Just noticed something quite strange.  When playback ends (for me the end of the playlist), Winamp's CPU usage jumps to a constant 50% (on a hyperthreaded machine) and when examining this in process explorer it appears that out_ks3.dll is the one using the full 50%.  The process does terminate fine when shutting down winamp so at least that is good.  Hope this helps.
  • Last Edit: 03 January, 2006, 11:16:23 AM by Gabes Dad

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #94
Quote
The new alpha plugin is working well here for me as well.  I did have some stuttering before with the old plugin, but I can't remember if that was on my 1 Ghz P3 at home or my 2.8 Ghz HT P4 at work (I'm currently using my work machine).  It also works fine with Winamp music.

The only thing I noticed different when examining winamp and its associated processes with Process Explorer is that a thread for out_ks3.dll shows up as a subset of the winamp threads.  When using the out_ks25.dll output, no corresponding thread appeared under the winamp threads.  The differences are probably due to the rewrite.  There was a slight increase in winamp CPU usage (from an peak of 0.75% to 1.5%), but perhaps the old plugin showed up under a different thread.

Great Stuff.
[a href="index.php?act=findpost&pid=354272"][{POST_SNAPBACK}][/a]


Yes, that's correct I create another thread. In the new plugin, I basically shove all the packets Winamp sends to me into a big buffer. The new thread you've seen simply sits there checking if there's anything in the buffer and if so it dispatches it off to the Kernel Streaming interface.

The main improvement with this new strategy is that every packet I send off to KS is full whereas in the original plugin only a quarter of each packet was used (playing 44.1K 16 bit WV files), so that didn't really give much of a safety margin between packets in case the CPU got busy. As it now stands, I can make the various buffer sizes adjustable to suit peoples needs.

The increase in CPU usage is probably down to two things, firstly, I have to copy each packet twice, once into my intermediate buffer and then a second time into the Kernel Streaming buffers. Secondly, my player thread, if starved of data will sit running in a tight loop wasting CPU time until something comes along - I'll have to see about sending it to sleep when nothing is being fed to it.

I've now got Pause and the volume control working again. I'll sort out 24 bit and post an update (plugin and source) once I've finished tidying the code up (either tonight or tomorrow).

I'm going to drop the oversampler as it doesn't seem to have any noticable benefit and I'll remove the "Release Audio Device When Stopped" option as this new plugin will always do this anyway.

Regards,
Steve

Winamp 2 Kernel Streaming Output Plugin
Reply #95
When it stuttered...

What other stuff was running at that point?...
- I ran quite many things. MSN, Explorer, DC++, Outlook.

Were you doing anything with the machine at that point?
- When I think about it was happening when winrar compressed some files that probably took alot of cpu

Was it at the start of a track or part way through?
- It was in th middle of songs mostly.

What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
- ogg or m4a

What speed / type of CPU have you got?
- Pentium 4 2.4GH with 768 MB Ram... My soundcard is E-MU 1820M with the latest 1.82 drivers.

I hope this can help!

Best Regards

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #96
Quote
When it stuttered...

What other stuff was running at that point?...
- I ran quite many things. MSN, Explorer, DC++, Outlook.

Were you doing anything with the machine at that point?
- When I think about it was happening when winrar compressed some files that probably took alot of cpu

Was it at the start of a track or part way through?
- It was in th middle of songs mostly.

What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
- ogg or m4a

What speed / type of CPU have you got?
- Pentium 4 2.4GH with 768 MB Ram... My soundcard is E-MU 1820M with the latest 1.82 drivers.

I hope this can help!

Best Regards
[a href="index.php?act=findpost&pid=354282"][{POST_SNAPBACK}][/a]


Thanks, that's helpful, you've got a reasonable spec system there, so it's surprising that its happening. It's probably the Winamp to KS intermediate buffer getting starved, this can hold up to around 1/3 second of data and smooths out update problems caused by thread switching, before I added this, the system constantly stuttered.

There's a second set of buffers on the KS side which hold around 1/6 second of data, if either of these two sets of buffers get starved it will stutter.

When I post the finished plugin, these buffers will be adjustable so that should help (at the cost of latency).

Cheers,
Steve

Winamp 2 Kernel Streaming Output Plugin
Reply #97
Quote
When I post the finished plugin, these buffers will be adjustable so that should help (at the cost of latency).

That is not a problem. Multitrack stuff that I require low latency I do in Sonar  I really look forward to the release.

  • Steve Monks
  • [*][*][*]
  • Developer
Winamp 2 Kernel Streaming Output Plugin
Reply #98
Hi all.

V3.0 is now available for download. This is essentially a complete rewrite of the plugin so there may be all kinds of new and exciting bugs in there. I've been testing it all evening (while making minor tweaks) and it seems stable for me, so fingers crossed it will be for you.

The main intention with this rewrite was to make the plugin behave in a more robust manner when the CPU is under stress. To this end, there are a couple of adjustable buffers on the config screen. If you get excessive stuttering or audio breakup, try adjusting these. Bigger values should improve the plugins resilience to external influences but will adversely affect the response times of Winamps controls, particularly the Seeking Bar, Stop button, volume control and jumping from track to track. On my system, the defaults seem fine but feel free to have a play.

I've also removed the "Release Device When Stopped" and Oversampler buttons from the config. The "Release..." option is now always done and I've just got rid of the Oversampler as it didn't really seem to achieve anything and was really just a bit of an experiment.

There are currently two known issues;
1. The visualiser synchronisation is somewhat out, plus the update rate falls off if you use larger output buffers. I'll have to find a better way of determining where the playback is up to from the filter.

2. "Winamp Music" from the library, tends to skip. Not sure what's going on here but it seems to be mucking up the input buffering somehow and needs further investigation.

The plugin can be found here (V3.0)
The source code can be found here

The V2.5 plugin and source may still be found at the old location (see earlier posts).

Hope it all works okay.

Have fun,
Steve
  • Last Edit: 19 March, 2006, 03:54:50 PM by Steve Monks

  • Gabes Dad
  • [*]
Winamp 2 Kernel Streaming Output Plugin
Reply #99
Quote
Edit: Just noticed something quite strange.  When playback ends (for me the end of the playlist), Winamp's CPU usage jumps to a constant 50% (on a hyperthreaded machine) and when examining this in process explorer it appears that out_ks3.dll is the one using the full 50%.  The process does terminate fine when shutting down winamp so at least that is good.  Hope this helps.
[a href="index.php?act=findpost&pid=354272"][{POST_SNAPBACK}][/a]

Steve, I don't know if you saw the edit to my post a while back before you replied or not, but the issue is still there in the current 3.0 release.  It seems to occur any time playback is stopped, similar to what you described in a post:
Quote
Secondly, my player thread, if starved of data will sit running in a tight loop wasting CPU time until something comes along - I'll have to see about sending it to sleep when nothing is being fed to it.

I don't know if you tried to resolve this or not in the 3.0 release, but it is still an issue for me.