Adjusting audio output based on an audio input!

Kay so I live in an older apartment where my AC bombards my eardrums every ten minutes.  My stereo master slider on my mixer is my best friend for overcoming this inaudible catastrophe!  Men, I need you to help me link my microphone to my audio output gain so one of my arms doesn't get very strong compared to the other.  I've been working out my other arm on a daily basis, but it's coming to the degree where I can't walk in a straight line.  To prevent the repetitive volume increases and decreases and keep me from walking in circles, is there some software I can use to auto-adjust the gain from my machine?

Ok,
Looked simple, but fun, so I did it. Where you go
#!/bin/bash
MAX=20.0
MULT=1.0
TIME=5
function volume(){
arecord -f S16_LE -r44100 -d $TIME 2>/dev/null|sox -t wav - -t raw /dev/null \
stats 2>&1 |awk '/RMS lev dB/ {print $NF}'
level=$(volume)
while true; do
new_level=$(volume)
diff=$(echo $new_level - $level|bc -l)
level=$new_level
adjust=$(echo "
v=$diff*$MULT;
if (v < $MAX && v > $MAX*-1){
if (v > 0) {
print v,\"%+\"
} else {
print -v,\"%-\"
} else {
print \"0%+\"
}"|bc -l)
echo $diff,$adjust
amixer set Master -i $adjust >/dev/null
done
Its use arecord and sox to calculate the noise and bc to do some math (because bash is dumb =[). Some parameters MAX is the maximum absolute adjustment that can be made, MULT is a multiplicative factor applicated to the difference of dB measured, and TIME is how much seconds to record in each pass.
TIME can be used to adjuste the reaction time, a small value (like 1) react nearly instantaneous but a bigger value like 6 give some margin for rapid pops in the noise and only adjust if the noise difference existed in much part of TIME window.
When I use pulseaudio MULT=1 works ok, but with alsa I need MULT=5.
About pulseaudio, I started using it this week, and I really think that using pulse audio you have a lot more clear/cool/functional solution, but I need to explore it...
I dont know much about sound theory, so I dont know if I choose the best 'volume' description, but you can look at sox man pages and look for something more adequate (look for stats and stat).
PS. I hate bash... zsh is so much better (but, python is better than all) I only used bash because, uhhh I dont know the reason... masochism?
Last edited by kazuo (2010-05-31 10:31:07)

Similar Messages

  • HT204392 Doe's the  Audio/Output socket,also take Audio In?

    Doe's the  Audio/Output socket,also take Audio In?

    On what Mac or iDevice with what operating system?

  • Audio output problem - using M-Audio Fasttrack

    I had been using Logic Express (7.2.3) without any issues until recently plugging in a mic through my M-Audio Fasttrack.
    I don't remember the exact chain of events - but at some stage, the software instrument outputs were no longer audible played either through the M-Audio, with earphones attached to its output, or through the laptop.
    Even after disconnecting the Fasttrack, resetting the audio driver to 'built-in-input' and rebooting Logic Express, I still can't get any audio output from the software instruments. They aren't muted and the volume is turned up. Audio output from other programmes is working fine.
    Can anyone give me any tips on how I could resolve this/suggest what I might have done to screw the audio up and what I need to do to undo it?
    Thanks,
    Antony

    this is actually really simple
    i just had the same problem with my m-audio and called support
    when you plug in the m-audio fast track mac automatically sets the input and output through the fast track. To fix this you need to create an aggregate device. heres how:
    click the finder in your dock
    then click applications
    in applications a utilities folder should appear...click that
    in applications click Audio MIDI Setup
    at the very top of the computer screen where it usually says what program is open it will say Audio MIDI Setup ..next to that click Audio
    then click open aggregate device editor
    you need to click the + to add a device
    in the aggregate device screen it should say aggregate device.
    below that check the option built in output
    then check the option fast track (or device your using) the one that says 2 under the IN category and 0 under the OUT category.
    click done
    now open logic express (reopen if already open)
    then click preferences
    audio
    under device tab the device option needs to say aggregate device.
    click apply changes
    and your done!
    hope it works!

  • No audio output from built in audio

    I do a lot of music production/recording on my mac, and to do so I use a firewire audio interface as my audio input and output while recording. When the device is not plugged in my mac usually automatically switches to the built in speakers or headphone jack for audio output. Tonight when I was done recording, I unplugged the interface, opened up iTunes, and went to turn the volume up, but what I got was the little pop op graphic of the speaker, with a little crosse out circle (like a no smoking sign). Now under my system preferences, built in audio is no longer listed as an option for output. After rebooting the machine the problem persists. Any thoughts?

    You might try resetting the PRAM:
    http://support.apple.com/kb/HT1379?viewlocale=en_US
    If this does not work then I would run "Repair Permissions" from Disk Utilities.

  • Cant reset my Audio Output after plugging in Audio Kontrol Interface

    Whenever i plug in my audio kontrol interface to use a microphone Logic recognizes it and changes the input so that it picks it up, but it also makes sets the Output to the interface, like what garageband did, but i cant figure out how to change the output from my interface back to its original speakers output! PLEASE HELP

    Unlike GarageBand, you can't set input and output devices separately. You can create a set up using both your interface and built-in audio at the same time by creating an aggregate device. Instructions on how to set this up are here:
    http://support.apple.com/kb/HT1215
    If you want to switch outputs on the fly, try using SoundSource. It's free, very useful, and you can find it here:
    http://rogueamoeba.com/freebies/

  • No audio output on record enabled audio track

    Hi guys,
    Not sure whether anyone else has encountered this issue with Logic X. When recording using an audio track once the record enable button is selected I am able to see input but the input doesnt go to any output so I am unable to monitor what I want to record. Once I record I am able to hear what I have recorded on playback. The issue has nothing to do with my audio interface as it does the same thing with the built in audio and output.
    This problem doesnt exist when using audio instruments and it seem to have just started randomly.
    Please help!
    System spec
    OSX 10.8.5
    Procesor: 3.4 GHz intel Core i7
    Memory 32 GB
    Logic 10.03
    Audio Interface: M-audio  project Mix

    I think this might help the discussion. I also have auto input monitoring selected. I can also hear the audio when I click the input monitoring button.

  • Simultanious audio output from both mini Displayport and Audio Output port?

    Hey guys,
    I was wondering if someone who already has audio+video output through the mini displayport set up can be so kind and answer the following questions for me:
    Can audio be output simultaniously from 3.5mm audio port as well as the mini displayport? That is, if I output both video and audio to my reciever through the 2010 iMac's mini Diplayport, can i use the standard audio output port to provide line input for a further set of (active) speakers (analog would be fine)?
    In the case both outputs CANNOT work simultaniously, which one will work if i have both plugged in? If the mini displayport has higher rank (or priority or what whatever i should call the one that works when both outputs are plugged in), and the reciever it is plugged into is switched off, will audio automatically switch to the standard audio port? Same question goes if the standard audio output port has higher rank/priority?
    Many thanks in advance!
    Just in case you are wondering why the heck i would wanna do that, here's some background:
    I am planning on setting up my new 27' iMac on a 'work' desk in my bedroom, where i can comfortably sit and work on the computer as well as use the beautiful screen as my bedroom TV. Since i also wanna use my mac for all my living room multimedia needs (movies, tv shows, music, etc), i plan on running a long (15m) audio+video HDMI cable all the way up to my reciever in my living room. Furthermore, i am also planning on running a USB cable to the living room (through something of this sort: http://www.coolgear.com/images/171632pro.jpg) plugged in to a usb hub mainly for mouse/keyboard availability in the living room, but also for other things such as external hard drives and so on. The problem is that, apart from having my audio play in the living room, i also want to provide line input to my reference monitors that will be located at the iMac desk and i obviously much prefer i get the line input directly from the mac rather than running a third cable from reciever back to the speakers.
    Message was edited by: Leeon

    Anyone?
    Is that so few people are using the new mini displayport for audio, or did i ask the wrong way?
    Help will be greatly appriciated as i need this info in order to plan my purchases!

  • Problem with multiple applications using one audio output

    Hey there, I'm having issues setting up my 5.1 headset seen here (http://www.sharkoon.com/?q=en/content/x-tatic-digital) to work with multiple applications.
    Right now I have audio streaming from a flash video, when I try run "$ speaker-test -c 6" I get the following error:
    speaker-test 1.0.25
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 6 channels
    Using 16 octaves of pink noise
    ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
    Playback open error: -16,Device or resource busy
    If I try open another application which uses this device, the first application has its sound cut off.
    2 more things to note:
    - My preference for setup would be audio output through S/PDIF and input through USB, with the USB output disabled (To not waste system resources).
    - I unmuted all channels in ALSA, however when I ran the test only 2 channels seemed to be working (Front L&R), it may have been defaulting to the USB connection, in which case, that explains only 2 channels being in use, is there a method of setting the S/PDIF as default system wide?
    Thanks in advance for any help given!

    brebs wrote:It's put the comments on multiple lines - fix that.
    Woops, I guess my paste messed up, new .asoundrc: http://pastie.org/3706033
    I can run both at the same time, however I cannot hear any audio. Do I somehow have to change the default device, if so how can I do that?
    Edit:
    Restarted system now I get:
    speaker-test 1.0.25
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 2 channels
    Using 16 octaves of pink noise
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 2048 to 8192
    Period size range from 1024 to 1024
    Using max buffer size 8192
    Periods = 4
    was set period_size = 1024
    was set buffer_size = 8192
    0 - Front Left
    Segmentation fault
    (That's with both commands)
    EDIT 2:
    Interesting, apparently 2 audio streams are working, however the console thing still doesn't work..?
    EDIT 3:
    Didn't last long, now flash crashes and html 5 doesn't work -.-
    EDIT 4:
    Flash only works when other audio is active, however it has constant popping sound. I went through the system logs to get the errors of when flash crashes, it's audio crashing it, here's the error:
    Apr  1 02:04:15 localhost kernel: [ 7057.499787] AudioThread[6227]: segfault at 7f2e2f7a8008 ip 00007f2e413a2786 sp 00007f2e33614ae8 error 7 in libasound.so.2.0.0[7f2e4131e000+eb000]
    Last edited by B3NW (2012-04-01 01:11:04)

  • No audio output for CS5 even with Audio Output box checked

    Ever since about a year or so, My CS5 has been unable to render any projects with audio outputs, regardless of the audio format. I had checked the Audio Output box in the Output Module setting every time.Still no audio. Now I have to export the project to Premiere to output it. In my current project, my audio is a MP3 music file. Same result. Should I convert the audio into certain formats first?

    Just speaking from experience on my own systems, irrespective of software used, I have found that despite being able to play both 44100 khz and 48000 khz my Blackmagic based systems have sometimes had issues with mute audio On one of the settings but fine on the other. If you start with an accepted preset and work from there it might be best.
    Are you sure the audio track(s) is turned on in the timeline? I know it is ridiculous but we can all develop silly habits and keep on making the same mistakes over and over when we try to make things work, then add some more mistakes for good measure having forgotten to return settings to their previous state.
    Also, I would not assume you are dealing with one error only, sorry. :-)

  • Using M-Audio Fast Track C400 Audio Interface for FaceTime but only input 1 audio is coming through?...

    I'm trying to use my M-Audio interface for FaceTime/U Stream for music purposes. I'm a professional recording artist and I'd like to do some "live stream" concerts for fans from home. I have my keyboard in input 1 and my microphone in input 2. Both signals come through just fine when I'm using Garageband or Logic, but for some reason when I select the interface as the "microphone" option when streaming, only audio from input one is heard from my viewers. I've also switched the keyboard and mic to rule out the mic being the problem, but then the mic audio comes through and not the keyboard...I'm wondering if I'm missing some minute setting somewhere?...I don't understand why it's only for video chat applications that it's only receives one channel of audio...Any help would be appreciated, thanks.

    Are you using Logic 8 or 9?
    What are you trying to hear Logic's output through?
    If you're expecting audio output through built-in audio, and you're using Logic 9, make sure your Fast Track is set as the input device, and built-in audio is set for the output device (both in Logic's audio preferences)
    However, if you're using Logic 8 or 7, you need to create an aggregate device if you're using built-in output.
    Details here:
    http://discussions.apple.com/thread.jspa?messageID=8813763&#8813763
    OR
    use the FastTrack's audio outputs to drive your monitoring, NOT your built-in audio.

  • Audio outputs on FCE?

    If I have, say 5 audio tracks in Final Cut Express, will it be possible to route these tracks to different audio outputs (I have an audio interface with several analog audio output channels)? So far I have only been able route all audio tracks to one stereo output.
    If not possible with this app. any hints on how to play out video + five different audio tracks / outputs simultaneously??

    Not simultaneously. In real time you can only output 1 stereo audio pair. Your 5 tracks will be mixed into a single stereo pair based on the Left/Right channel assignments you make on each audio track.
    On the other hand, you CAN export each audio track independently, with appropriate markers for use in SoundTrack, DVD Studio Pro, etc. This is a technique to export audio tracks to build a 5.1 soundtrack in an application like DVD Studio Pro.

  • Apple Audio Output levels / monitor calibration

    Hello all. I am mixing sfx and foley out of my macbook pro, and as a student on a very limited budget, I am forced to monitor with a consumer stereo - run of the mill Sony surround receiver, powering a pair of JBL Northridge N26II's. I know, bad reference and probably a frequency curve that is not even close to flat, but it is all I have access to right now for the bulk of my work. I have limited studio time with monitors, and I plan to use this to touch up these mixes that were done on the JBL's. The idea is that I do the bulk of my work, then bring it into the studio, hopefully to be able to salvage the mix. At least it is better than headphones.
    Anyway, I am attempting to calibrate my system, and I have a few questions. To get the audio out (at line level I believe, through the headphone jack on the MBP), I am wondering at what level I should set my system volume. Is the zero at the highest setting, as indicated on the volume slider in the Audio Output section of the Audio MIDI Setup program in OSX? Or is this amplifying the signal?
    Also, I have been told that I could use the ref. tone generated when one puts the bars up in Final Cut Pro to calibrate my monitoring setup, thus assuming that every level slider is at zero on the way from the audio source (say tone in FCP, or tracks of audio in STP or logic), I could adjust the receiver's volume control to playback the tone at a comfortable level and keep it there for the duration of the mix. Is this legit, or do I have some flaws in this plan?

    Hello all. I am mixing sfx and foley out of my macbook pro, and as a student on a very limited budget, I am forced to monitor with a consumer stereo - run of the mill Sony surround receiver, powering a pair of JBL Northridge N26II's. I know, bad reference and probably a frequency curve that is not even close to flat, but it is all I have access to right now for the bulk of my work. I have limited studio time with monitors, and I plan to use this to touch up these mixes that were done on the JBL's. The idea is that I do the bulk of my work, then bring it into the studio, hopefully to be able to salvage the mix. At least it is better than headphones.
    Anyway, I am attempting to calibrate my system, and I have a few questions. To get the audio out (at line level I believe, through the headphone jack on the MBP), I am wondering at what level I should set my system volume. Is the zero at the highest setting, as indicated on the volume slider in the Audio Output section of the Audio MIDI Setup program in OSX? Or is this amplifying the signal?
    Also, I have been told that I could use the ref. tone generated when one puts the bars up in Final Cut Pro to calibrate my monitoring setup, thus assuming that every level slider is at zero on the way from the audio source (say tone in FCP, or tracks of audio in STP or logic), I could adjust the receiver's volume control to playback the tone at a comfortable level and keep it there for the duration of the mix. Is this legit, or do I have some flaws in this plan?

  • Is there a way to have Firefox respect the default audio output device when it has been changed while Firefox is open?

    I have been a Firefox user for many years and I still use it as my primary browser. One problem that has bothered me for years is the fact that when Firefox is open and I change my default audio output device, Firefox doesn't respect that change and continues playing audio through the device that was originally being used. Even if you stop the audio and continue playing, the output device doesn't change.
    Is there any way this can be configured in Firefox? Now if I listen to music online (e.g. Soundcloud) I always use Chrome since it's respects the default audio output device change even while in the middle of playing audio.
    Reproduce:
    1. Start playing audio (e.g. from a YouTube video; HTML5 and Flash are affected)
    2. Change your default audio output device
    3. Audio will continue to play from original output device
    Thanks!

    This is the same issue that has plagued me for years. I always thought that this was a Flash plugin issue, but it does occur on HTML5 as well. A friend of mine verified that this does not occur in Linux, but only on Windows. It would be great to have this fixed, as it's honestly the only thing that's making me use Chrome all the time, as I don't want to have multiple browsers open.

  • No Audio Out Of Headphone Or External Audio Output Jacks

    We have a Rev. B Bondi iMac that I recently put in my wife's 4th grade classroom for her to use. When trying to hook up external speakers I discovered there is no audio output from the side audio output jack or the front two headphone jacks when listening to the CD player. (I also checked using headphones)
    The internal speakers sound fine and normal. I do hear something very distorted and weak from the external audio output jacks but it is so distorted the only way I can tell it is coming from the CD player is by pausing its playing. I have been into OS X now for about 15 months and am starting to forget everything I knew of OS 8.6 which is in the Bondi.
    I checked the sound portion of the Monitors and Sound Control panel and all seems set correctly. Is there some other setting that I have forgotten? Any ideas/suggestions will be greatly appreciated.
    TIA

    Herb Mesler...
    Other than exercising the jack-ports with a plug from a headphone, it may need some expensive repair. However I do have a trick for you to try first.
    Here is my trick;
    Computer must be off! Because there is some light voltage applied to the ports they can slightly arch, spoiling the trick. Arching is the root cause of electrical resistance thus not allowing for proper contact and sound will not pass through to the device.
    Next take a plug "softly and full travel" through each port in the side and on the front. I repeat them about 5 times. (any proper spec/type of plug, like from a headphone can work. If it from something that is powered, like from speakers, do not use it)
    Boot up the computer and test by avoiding the side ports, using only the front ports. Quite frankly I found the use of the side ports to be somewhat the cause of the problem. Mine has been taped off for about 6 years now and I never have had to repeat my trick to date.
    Give it a try and post back if there is any questions. Also, I would like to hear your results.
    ...Ron

  • [Solved] VLC 'Audio output failed' no sound from anything

    Very new to Arch so not sure what outputs to post.
    I installed arch about a week ago with no dramas, then after installing xfce-volumed I lost all sound and got this from vlc:
    Audio output failed:
    The audio device "default" could not be used:
    No such file or directory.
    So I did a new install and only installed vlc and the same thing happened again.
    Here is the terminal output from vlc:
    [mpeg4 @ 0x7f2868f17280] Invalid and inefficient vfw-avi packed B frames detected
    [0x7f2850000958] pulse audio output error: PulseAudio server connection failure: Connection refused
    ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
    [0x7f2850000958] alsa audio output error: cannot open ALSA device "default": No such file or directory
    [0x7f2850000958] oss audio output error: cannot open audio device (/dev/dsp)
    [0x7f2850000958] main audio output error: no suitable audio output module
    [0x7f2868f057c8] main decoder error: failed to create audio output
    Output from aplay -l:
    **** List of PLAYBACK Hardware Devices ****
    card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    Very new to all this, any tips/help would be great.
    Last edited by Oldmoth (2013-01-27 22:24:56)

    No.  I doubt it's a hardware problem either.  It's a matter of getting the right sound drivers loaded for your card.  Don't give up on Arch yet.  These are the experiences you embrace with Arch.  Not run away from! :-)
    You said you were new to Arch so stick to the Beginner's Guide starting out https://wiki.archlinux.org/index.php/Beginners'_Guide .  Make sure you read every single sentence related to "sound". 
    The Wiki is an awesome resource.  https://wiki.archlinux.org/index.php/Main_Page It's power is in the search box so do some generic searches there and it will take you to whole articles related to your problem.
    For sound problems, be sure you check out:
    https://wiki.archlinux.org/index.php/Sound
    and
    https://wiki.archlinux.org/index.php/ALSA
    at the very least.
    In fact there's a whole page devoted to your sound card:
    https://wiki.archlinux.org/index.php/Realtek_ALC892
    It mentions installing some packages from the AUR.
    For AUR, you really want to install "yaourt". 
    Read about that here: https://wiki.archlinux.org/index.php/Yaourt
    Once you have that installed then you use it just like pacman with all the same switches.    So to install the "alsa-driver.hda-intel.hda-codec-realtek-git" package from the AUR as the Realtec_ALC892 wiki page suggests, you'd issue "yaourt -S alsa-driver.hda-intel.hda-codec-realtek-git" from the command line running as your regular user.
    Don't give up.  It's time to dig!
    Hopefully this will get you a little further down the street.

Maybe you are looking for

  • Convert ASCII HttpServletRequest to UTF-8 Correctly (Possible)?

    Hi All, Is it possible to convert a request encoded in ASCII that contained UTF-8 Characters to UTF-8 correctly? I am using ATG Dynamo's Application server and for the life of me, it doesn't seem to let me encode the request in anything but ASCII. An

  • A warning to those with iWeb not publishing to .mac

    I made a beautiful web site on iWeb, but when I lost my hard drive, even though I saved all my info, I can not restore my web page to the iWeb program! They make it impossible. I was told I should have save my page (not very sympathetic) but I had al

  • Battery not charging when MBP is RUNNING

    Strange thing just started happening, when my MBP is running my battery is not charging (green light on MS, says not charging on screen). When it is asleep or shut down I get an amber light and it does charge. It will also charge iPhone over USB. Whe

  • Dependent process chains design

    HI,     we need to create the transactional process chains design based on the master data flow status. since this both are present in the different flows, we can't have them in the same chains,once the master data process chains are completed then t

  • Buisness Event not raised from People/Assignment screen?

    I found a seeded Business Event for People/Assignment screen : oracle.apps.per.api.assignment.update_emp_asg. So, i went and added subsription to it and then tested it. It works fine from Business Event Test page(html framework). However, when i did