Author Topic: How to make a stream mono  (Read 5526 times)

Sheep

  • Posts: 243
How to make a stream mono
« on: 18 Jun '03 - 09:52 »
Does anyone knows how to make a stream mono? Just the playing of it, not the file itself. Could I take the left stream and pan them in the middle and do the same with the right stream? Does anyone knows how?

Thanks!

(: JOBnik! :)

  • Posts: 1080
Re: How to make a stream mono
« Reply #1 on: 18 Jun '03 - 13:41 »
Hi ;D

You will have to write a DSP function :)
* I've included a DSP like this: Stereo 2 Mono in next
BASS_FX 1.2 version :)

Have fun!

8) JOBnik! 8)

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #2 on: 18 Jun '03 - 20:27 »
Ah dammm, isn't there an easier and faster way?  :-/

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: How to make a stream mono
« Reply #3 on: 18 Jun '03 - 23:11 »
If you're dealing with MPEG files, you can just use the BASS_SAMPLE_MONO flag in your BASS_StreamCreateFile call.

Otherwise, a DSP function (or decoding channel + custom stream) is the way... simply add left & right samples and divide by 2 :)

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #4 on: 19 Jun '03 - 01:41 »
I need to put the stream (mp3) on mono while playing it, so a dsp is the only way. Thank you, I don't know how yet, but I hope to find it out =)

Another thing Ian, or maybe someone else, if I call the Bass_Init, from then on, by CPU goes up every 2 sec. I am not even doing anything. Not playing a mp3 not even called the BassStart function.

Your precompiled exe's do the same. And all FMod samples also. Why is this? And why doesn't has Mediaplayer or Winamp has this peak just when starting the application or when pressing pause (mediaplyer seems to load it's sound engine if you press play, so pause then, a flat line.

It's not just a peak, it's a block of usage of more then 500 ms. You can't tell me this is the fault of the Window Task Manager right? I read all the forum post about it, and still haven't found any answers why FMod or Bass just eats cpu so much visible in windows task manager even when not playing a file.

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #5 on: 19 Jun '03 - 01:44 »
Oh yeah, FMod has just one little peak every 2 sec and stays flat between them. While Bass humbles around the 30% all the time. What is he doing? No offense because I really LOVE bass hehe, but I just wnat to know what is happening and how I can improive this and tell other people who are complaining about the high and un calm cpu graph.

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: How to make a stream mono
« Reply #6 on: 19 Jun '03 - 13:55 »
Quote
You can't tell me this is the fault of the Window Task Manager right?

I can, and I will ;D

When you looked back at the old threads, you would have seen the SPECTRUM example that was taking 0% CPU flat on a Celeron 300, according to Task Manager (and Perfmon - they use the same data)... that's MP3 decoding, performing FFT calculations, and displaying the spectrum - I think you'll agree that would require atleast a bit of CPU :)

That right there is proof enough that Task Manager is practically useless if you're looking for accurate measuring of CPU usage. WinTop/Win9x is much better. For more accurate measuring on NT-based systems, you'll have to use proper/dedicated profiling software.

The way to get some CPU to suddenly appear in Task Manager is to increase the timer resolution. This applies to all processes, ie. any app increasing it increases it for all other apps running too (if you see a media player magically using 0% CPU, load up an app that increases the timer res and watch the player's CPU start to move :)). But even then the numbers are obviously rubbish. For example, we know the update rate of BASS is 100ms (default) - that means it's using some CPU every 100ms, but Task Manager shows some CPU use for a second, and then none for a few seconds, and then some more for another second, etc...

Anyway, to allow a sync latency of under 1ms, BASS sets the timer resolution to 1ms. BASS doesn't actually use any timers, but the timer resolution affects all "wait" functions (eg. Sleep, WaitForXXX), and the default resolution of 10ms is not sufficient for precision syncing.

The reason no CPU showed in the "SPECTRUM/Celeron" example mentioned above was that in the old BASS one could disable syncs, which meant that BASS didn't increase the timer resolution... if I disable the timer resolution increase in BASS today, Task Manager will again say 0% CPU.

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #7 on: 20 Jun '03 - 12:24 »
Wow, thanks for the great answer Ian :)

What is good CPU meter software than?
www.coolbeans.ws ? Check the System Details function in this program. I get the peaks also.

How do you change the time resolution myself? Can I make an app with a timer of 1 ms and a Application.processmessages. Is that what you mean?

I started a bass app (which does it like you said) and played winamp and media player at the same time. No changes when playing those 2 or closing them.

I would love to have a good CPU meter than. With an update every 500 ms. Not every 2 sec, that totally sucks. I tried 4 software things,a nd they all have the 30% peak, so they must be using the same data.


Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: How to make a stream mono
« Reply #8 on: 20 Jun '03 - 17:21 »
Quote
What is good CPU meter software than?
www.coolbeans.ws ? Check the System Details function in this program. I get the peaks also.

It no doubt uses the same performance data (accessible via the HKEY_PERFORMANCE_DATA registry key).

I've not gone hunting for CPU meters :) ... but "RoMa" seemed to find something more reliable in this thread, so you could ask him what he used.
http://un4seen.com/YaBB.cgi?board=bass&action=display&num=1030698202#6

Quote
How do you change the time resolution myself? Can I make an app with a timer of 1 ms and a Application.processmessages. Is that what you mean?

See the timeBeginPeriod function. You don't need to actually setup a timer in order to set the timer res.

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #9 on: 21 Jun '03 - 01:52 »
What program do you use, because you have such a strong convinced opinion about it, but you are comparing to windows 98 which works completely different with threads and cpu usage. The whole world works with the Windows TaskManager, and I really would love to see it flat, is it possible in future relaese that you can put that removed flag back?

And I did some testing with the program you say is reliable. Well basstest goes from 0..10 % up and down. And winamp goes for 0..1 %. Comparing that program to windows taksmanager, is almost giving the same data.

In all the discussion threads you keep saying a 1.6 bass spectrum example showed 0%. But hey that's not a proof that bass doesn't use 10%. Taskmanager just times at some intervals where your exe doesn't use any I think. I mean, it's no proof at all that bass doesn't use 10% cpu. What program do you use on win nt to get this opinion? Win98 is really not reliable to nt.

Here's a screenshot:


Yeah, hey since you've made bass which looks a very very very hard task to me, I am almost sure you are right, don't get me wrong, but the arguments you keep saying do not contain a proof. Just give me an exe which points the truth. Your cpu meter in basstest.exe gives 2% all the time, while the prohgram you suggested me to use gives 0..10% So... What's happening here, can we get this straight for once and for all? :)

Thank you, hope this post doesn't come rude. That's totally not my meaning. And I want to believe you, but really all the programs I use to test it say that bass uses about 10  times as much cpu as winamp.

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: How to make a stream mono
« Reply #10 on: 21 Jun '03 - 12:13 »
First of all, I did not suggest that program :) ... As I said in that thread, it (TaskInfo) uses the same data as Task Manager, so will obviously just say the same thing.

But anyway, if you want to see some proof yourself... try any of the BASS examples with this version of BASS.DLL (1.8a without the timer res increase) - you'll see Task Manager (and all other CPU meters using the same data) flatline at 0%. Does that mean it's really using 0% CPU? Of course not - it's simply not possible. Equally, when Task Manager says the "official" BASS uses CPU for a second, and then none for a few seconds (etc...), that's obviously nonsense too (that 10% in your screeny turned to 0% for the next few seconds, right?).

For a more accurate/reliable picture you need to use something with a high sampling rate, eg. dedicated profiling software, like VTune...



This is on an Athlon550/WinXP system. As before, both are playing the same MP3 file simultaneously, and Winamp (v2.81) has no DSP or visuals enabled (not even the little scope/spectrum).

I'm confident that if you put any other library/player in the comparison, BASS would at least match, and most likely surpass it - I've yet to see any be quicker :)

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #11 on: 21 Jun '03 - 14:50 »
Sorry for the misunderstanding then. This Intel application is 120 MB to download. So I cannot check that app this moment. I am on 32% so I will come back on that :)

Further, the bass1.8a does not have a flat line. It has a flatter line and looks much more calmer. But the peak every 2 sec still remains.


This is basstest.exe playing a mp3 file with the bass18a version of bass.dll.

Don't you have that peak?

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: How to make a stream mono
« Reply #12 on: 21 Jun '03 - 18:12 »
Look at the process list.

Also, by "bass18a version of bass.dll", I trust you mean the modified version of 1.8a that I posted above, and not the release version :)

Sheep

  • Posts: 243
Re: How to make a stream mono
« Reply #13 on: 22 Jun '03 - 01:55 »
Yeah ofcourse the posted bass.dll. I can see the difference. Yeah, basstest stays on 0 in the process list, but not on the graph view. Maybe that's the correct one. The peak comes from the basstest example. If you can make that peak going away, then I believe you :) haha. just kiddening. Oh yeah, Vtune doesn't work at my pc. Some license problems it says..

Well I like this bass.dll much more because i can see what's happening to my system while playing a background mp3 in my player.

Thanks ian for all the help and the patients.