Author Topic: Master GetLevel  (Read 4638 times)

MB_SOFT

  • Posts: 496
Master GetLevel
« on: 27 May '03 - 12:23 »
Hi Ian,
it would be possible to add a function to retrieve the current audio level from the digital master instead a single stream channel?

Thank you
Maurizio

fredvs

  • Posts: 325
Re: Master GetLevel
« Reply #1 on: 27 May '03 - 13:52 »
Hi
Good idea, but you can do the same with getlevel of all your streams and then take the higher level.

MB_SOFT

  • Posts: 496
Re: Master GetLevel
« Reply #2 on: 27 May '03 - 14:01 »
But sometimes i play several channels at different volume level, and ChannelGetLevel is not affected by channel volume. So it will be great to have a real current level of general master output, i only need to detect when master out is below a given value.....

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Master GetLevel
« Reply #3 on: 27 May '03 - 16:09 »
BASS doesn't have access to the final mix - it's mixed by the hardware (or DirectSound if the device has no hardware mixing). But there a couple of ways to do what you're asking...

1. Record the sound, using BASS_ChannelGetLevel(RECORDCHAN) to get the level. The good side is it takes minimal effort/processing, the bad side is that it'll include the sounds from all apps using the device. Also, some old soundcards don't have "what you hear" or "wave" type of recording inputs.

2. Use BASS_ChannelGetLevel on each of your playing channels (scale each by the channel's volume), and add them all together to get a total level. The good side is it only measures your app's sounds, the bad side is it requires a bit more processing.

Personally, I'd use method 2 :)

fredvs

  • Posts: 325
Re: Master GetLevel
« Reply #4 on: 27 May '03 - 17:14 »
Hi Ian

Quote
and add them all together to get a total level


Are you shure ?
If i play 2 same streams at level 30, it is not so load as only one stream  at volume 60. (it depend maybe of log or linear calcul)

It seems to me that the total volume is the volume of the stream who have the highest volume. (but i have strange ears)

Quote
the bad side is it requires a bit more processing


Whum..., recording needs acces to memory, temp files,... getlevel only gives the volume, i dont understand...
« Last Edit: 27 May '03 - 21:42 by fredvs »

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Master GetLevel
« Reply #5 on: 27 May '03 - 22:18 »
Quote
Are you shure ?

Yep, you can confirm it yourself... load up 3 instances of CoolEdit (or another sample editor), and generate sine-waves of equal amplitude (but different freqs to avoid phase issues) in 2 of them. Now try looping one of the sine-waves, while recording it in the 3rd instance. Then try looping both the sine-waves - you'll see that the recorded waveform is twice as high.

Quote
Whum..., recording needs acces to memory, temp files,... getlevel only gives the volume, i dont understand...

There's no need for temp files, as you're not interested in keeping the recorded data - just getting it's level. Your RECORDPROC would do nothing.

fredvs

  • Posts: 325
Re: Master GetLevel
« Reply #6 on: 28 May '03 - 00:00 »
Hi Ian

Quote
you'll see that the recorded waveform is twice as high


Yes i have seen (not hear) and i go direct to the doctor.

« Last Edit: 28 May '03 - 00:02 by fredvs »