Rockbox Technical Forums

Rockbox Development => Feature Ideas => Topic started by: billy1ear on August 19, 2008, 01:42:51 PM

Title: Adjusting Volume via ambient noise on players with a mic
Post by: billy1ear on August 19, 2008, 01:42:51 PM
Though it would be nice to have the volume auto adjust based on ambient noise.
Say your in your car with the windows down and the volume goes up when your going 70, then goes down when you stop at an intersection.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: ZincAlloy on August 19, 2008, 01:51:00 PM
excellent. automatic destruction of your hearing ability. :-\  it would make much more sense to automatically turn down the volume when the ambience noise gets louder.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Llorean on August 19, 2008, 01:52:39 PM
Another interesting question: How will the player hear the ambient noise over the loud music after the volume goes up? Even if you know what's playing it doesn't necessarily mean there will be enough recoverable other audio for it to really be able to determine anything.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: pabouk on August 20, 2008, 04:17:17 AM
I already presented this ideal long time ago (it was probably on the tracker) and I think that it is usable with headphones. What I do most frequently while listening to a DAP on a street / bus / tram / underground is changing the volume according to the ambient noise. To avoid hearing damage there could be simple volume limit.

The main problem I see is how to filter out the contact noise of the microphone and close objects (clothes etc.)
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: nomis3613 on August 20, 2008, 05:36:09 AM
Excellent idea for headphone listening! I'd love to see this on Rockbox to allow further laziness on my behalf. Whether the hardware has enough brains to process this while doing decoding music etc, I dunno, but it's a great idea.

It may be possible to reduce contact noise etc by looking at a certain frequency range and using averages of over say 10 seconds. Might work, might not.

I reckon with control over 1) the maximum decrease in volume 2) the max increase in volume and 3) the ratio of volume change to background noise change (ie so you could set it to add 0.7 dB for every dB of background noise) it'd be awesome.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: (V)3@7Y on August 20, 2008, 05:45:08 AM
this sounds like a pretty cool idea
it'll take alot of refining i imagine.
but i have found 1 flaw. being impressed by the extreme capabilities of your DAP, you show your friends this amazing feature. soon enough your back to listening to your music when suddenly, someone comes up and screams into the microphone of your DAP... instant deafness.
whether this will be an issue, i am unsure, obviously it will be optional, but there will probably be alot of practical issues involved with it.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Chronon on August 20, 2008, 12:49:12 PM
I don't think it's a great idea.  If ambient noise is a problem it's generally better to take steps to reduce ambient noise than to boost the amplitude of the sound pressure.  If the ambient noise floor drops and you suddenly realize that you have the volume way too loud then you are still damaging your hearing when the ambient noise floor rises again.  This just sounds like a way to mask dangerous volume levels from yourself.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: pabouk on August 21, 2008, 05:11:40 AM
I see only two possibilities how to reduce the ambient noise in the described situations:
- avoid the place (it is difficult if I want to travel by train for example ;D )
- use headphones which more attenuate the ambient noise (I do not like this much because I want to hear the ambient sound in some situations without taking the headphones off.)

Anyway I do not need the sound volume much higher than the ambient noise and I prefer to lower the volume in quiet places just because I do not want to be deaf to quieter ambient sounds. Mostly I listen to spoken word thus I do not need high volume like when I am listening to music.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: soap on August 21, 2008, 02:35:34 PM
- avoid the place (it is difficult if I want to travel by train for example ;D )
- use headphones which more attenuate the ambient noise (I do not like this much because I want to hear the ambient sound in some situations without taking the headphones off.)

Active noise canceling headphones have an off switch if you want ambient noise, and they sell passive noise attenuating IEMs with an inline microphone to allow you to hear ambient noise at your discretion.

Turning up the volume in response to increased ambient noise is unarguably a bad idea.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: eylonk on May 16, 2010, 02:32:09 PM
What about a simple reduced feature"
Pause when ambient noise cross a threshold, replay when cross back again.
This make sense, when you walk and a very noisy bus come, you can't hear anything anyway so the right thing to do is pause for few seconds.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: zaphee on May 16, 2010, 03:15:37 PM
Wouldn't this feature be too battery-hungry in addition to being difficult to implement and harmful to the user's ears ? :-\
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: gevaerts on May 16, 2010, 03:27:45 PM
What about a simple reduced feature"
Pause when ambient noise cross a threshold, replay when cross back again.
This make sense, when you walk and a very noisy bus come, you can't hear anything anyway so the right thing to do is pause for few seconds.

I like that idea!
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Chronon on May 16, 2010, 03:37:56 PM
I agree.  That idea seems useful and doesn't pose a danger to people's hearing.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: GodEater on May 17, 2010, 03:06:13 AM
I'd be interested to see if anyone can actually manage to make accidental triggering of this by contact noise work first. I'm not optimistic it's going to be that easy or reliable.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Chronon on May 17, 2010, 03:19:40 AM
That's a pretty solid objection, actually.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Confuseling on May 17, 2010, 05:21:58 AM
How about the first idea, but volume only reduces.

So...

1) While you're setting the volume (to your preferred maximum), the playback volume fades up slowly to 100% of set volume. Rockbox measures 'base' ambient volume over a short period.

2) As the ambient volume falls against the measured base level, playback volume falls by a configurable amount. If the ambient volume rises and you wish for more playback volume, you have to set a new maximum yourself.

The worst thing brushing your clothes could do would be to bias the base level, so volume fell off after you stopped and you had to set it again. Screaming into the microphone wouldn't do anything either.

Not really any more likely to cause harm than the present set up.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: gevaerts on May 17, 2010, 06:27:18 AM
I'd be interested to see if anyone can actually manage to make accidental triggering of this by contact noise work first. I'm not optimistic it's going to be that easy or reliable.

For the "pause on noise" feature, I think you want some extras anyway, such as hysteresis. That would (I think) take care of both this issue and sudden gaps in the noise.

Actually, I think you also want to combine this with rewind-a-bit-on-resume
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Llorean on May 17, 2010, 07:36:32 AM
Well, I mean as a start you'd want it not to go off unless the noise raises above a certain level for half a second or so (to avoid sudden sharp noises triggering it) and not to stop again until it's been "quiet" for a certain amount of time too.

I imagine it could be made... I don't want to say "reliable", but I think most false positive can be weeded out so that once you've picked a trigger level it won't accidentally pause. I think for it to work nicely it would be okay if sometimes it didn't pause, but it wouldn't be okay if it sometimes did when it shouldn't.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Confuseling on May 20, 2010, 07:33:48 AM
Any thoughts on the above suggestion? In case it isn't clear, here's some pseudocode of sorts (bearing in mind I'm no programmer... ;))

Code: [Select]
do
{
  play music at playback volume;

  if (volume key pressed)
  {
    adjust set volume;
    playback volume fades to set volume;         // for ~10 seconds or something
    sample base Average Ambient Volume;      // 'AAV' from here on
  }
  else
  {
    sample current AAV;

    if (current AAV < base AAV)
    {
      playback volume = set volume - ((base AAV - current AAV) * volume adjustment multiplier);
    }
    else
    {
      playback volume = set volume;
    }
  }
}
loop

I read on an IRC log somewhere that some players can't sample and play back at the same time. For the ones that can, this seems like it would work quite well to me if the averages were taken fairly slowly so it didn't jump around all over the place... Am I missing something (probably...)? Would there perhaps be an excess CPU / battery overhead? I could still see myself using it occasionally, on public transport for example. Could it, perhaps, work as a plugin?

Thanks.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Davis_1377 on November 22, 2013, 09:50:49 PM
Having it auto adjust the volume to ambient noise is a good idea if its done right, when the noise gets loud and quiet it will adjust the volume just small enough to apear the same. It won't adjust too much like if someone screams into your Mic and it would be alittle time delayed. The other pausing when loud noise is also a good idea. I work in a factory and been using these from www.plugphones.com for over 2 years with the clip zip and this would be very handy features.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: phr on November 23, 2013, 01:10:50 AM
Rather than adjusting the volume it would be much more interesting (though harder) to have noise cancellation in the software.  Basically the mic picks up the ambient noise and plays it out of phase through the earphones.  There would be some equalization tunable to the earphones, maybe with multiple profiles for different earphones.  I've wanted a feature like this for many years and suggested it on another board about 5 years ago, but got no comments on it.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: saratoga on November 23, 2013, 01:20:00 AM
Rather than adjusting the volume it would be much more interesting (though harder) to have noise cancellation in the software. 

This has been suggested a few times, but its not possible without a microphone built into each ear phone. 
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: phr on November 24, 2013, 03:26:41 AM
I think it can be done with just the mic in the player, since it only has to take out low frequencies (long wavelengths).  Some commercial noise cancelling headsets work like that, with a single mic.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: saratoga on November 24, 2013, 10:24:45 AM
Link to one?
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: phr on November 24, 2013, 11:08:07 AM
Dunno about a link, but I used to have one and it's conceivable that I still have it, buried in a box someplace.  Don't expect me to find it anytime soon, but if it turns up I can send it to you.  Conceptually it's pretty simple: most of the energy is at the low frequencies, so taking out those is enough to make the environment feel calmer (e.g. if you are on a plane or something).  It wasn't great, but the fancier one I have now isn't great either.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: saratoga on November 24, 2013, 12:37:57 PM
I mean, are you sure they work the way you think they do?  If the microphone is 0.5 meters away in your pants, at 100 hz you're 0.9 radians away from your ears.  cos(2pi*100*t) - cos(2pi*100*t+.9) = 1.2 dB attenuation.  Even at 30 Hz, you're only at 7 dB.

And thats assuming free space.  In reality if the microphone is clipped to your body, you have shadowing and diffraction on top of phase error. 

Most likely if they provide any benefit at all, they're using a microphone built into the headphones. 
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: phr on November 27, 2013, 03:07:46 PM
It's been some years since I looked at that thing but I remember a little box with a neckstrap, that headphones plugged into.  I opened it up and it was really cheap and crappy inside, PC board with a bunch of analog parts, nothing digital looking at all.  It's in my storage locker if I still have it, so I'll look for it next time I'm there.
Title: Re: Adjusting Volume via ambient noise on players with a mic
Post by: Michael7 on December 21, 2014, 07:15:24 PM
My wife has just changed her car to a Honda Jazz which has this feature built in to the stereo, the faster you go the louder the music gets and it works quite well. I came onto this site with what I thought was a brilliant idea but I see the OP has beat me to it :o and as I see by the replies there are a few problems.