[SOLVED] how do I extract the mixer volume?

I'm setting up openbox to use my media keys, and want to show an OSD with the current volume(%) when I press volume up or down.
I have come this far:
amixer get Master |grep % |awk '{print $4}'|sed 's/.//'
this gives me
51%]
How do I get rid of the last bracket?
Is there an easier way to get this value? (probably. I don't often do something like this )
Through google I found how to remove the first char, and I also found how to remove the last char using sed. However I couldn't find anything that combines the two.
Any good ideas?
Last edited by madeye (2010-01-26 20:54:58)

And then I learned something new again
Actually I didn't know about the tr command.
Thanks for all the solutions.
EDIT:
In case anyone is interested in my volume script, here it is:
#!/bin/sh
case $1 in
up)
/usr/bin/amixer -q -c 0 sset 'Master' 5%+
down)
/usr/bin/amixer -q -c 0 sset 'Master' 5%-
/usr/bin/amixer -q -c 0 sset 'Master' toggle
esac
CURVOL=`amixer get Master | awk '/Mono.+/ {print $6=="[off]"?$6:$4}' | tr -d '[]'`
notify-send "Volume: $CURVOL"
I have added the following to my ~/.config/openbox/lxde-rc.xml
<!-- volume control -->
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<command>amix.sh up</command>
</action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<command>amix.sh down</command>
</action>
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute">
<command>amix.sh</command>
</action>
</keybind>
Last edited by madeye (2010-01-26 21:18:44)

Similar Messages

  • How do I get the full volume to return after disconnecting HDMI and MAC BOOK PRo from tv?

    After buying and connecting the HDMI cable from my MAC BOOK PRO to my tv to play DVDs I had no sound on my tv. So I followed suggestions from this communintyl through selecting PREFERENCES/sound and following the instructions and was successful. After disconnecting all from my TV my tv will not return to it's FULL volume capabiliity. How do I get the full volume to return to my tv?

    Some suggestions
    Turn off the TV/ turn it back on
    Turn up the volume

  • How do you increase the voicemail volume on an iPhone 4s ( Verizon ). The phone volume is fine. It is when I retrieve voicemails. Even the speakerphone is faint. I have adjusted the side volume buttons and the volume control in settings.What am I missing?

    How do I increase the voicemail volume on an iPhone 4s ( Verizon )? The phone volume is fine. I have adjusted both side volume buttons as well as the volume control in settings.

    Number one - that person has given you false information...the Apple store genius bar supports all Apple products whether in or out of warranty.  Checking is free, service on an out of warranty item is not free.
    Try a reboot by holding both the power and home buttons until the apple logo appears, ignore the red slider if that appears.
    Since you show that you have iOS 7.0.3 you might want to update that iOS to 7.0.4...plug the iPhone in so you are on a solid power source, then while on a WiFi go to Settings > General > Software Update and update to 7.0.4.

  • How can I extract the two channels from a stereo track?

    Hi,
    I am writing a class that is able to draw an audio signal. It seems to be working well but I have a question. If I load a mono audio file I am able to draw it on a graph by using the byte[] array and everything is ok until now. That's the code:
    void Draw(byte[] x)
                Graphics g=getGraphics();
                Graphics2D g2=(Graphics2D)g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                     RenderingHints.VALUE_ANTIALIAS_ON);
                for(int i=0; i<x.length-6; i++)
                    g2.draw(new Line2D.Float(((i*(getWidth()-6))/x.length)+5, (getHeight()/2)-          ((x*(getWidth()-6))/x.length), (((i+1)*(getWidth()-6))/x.length)+5, (getHeight()/2)-     ((x[i+1]*(getWidth()-6))/x.length)));
    The results is correct only if I have a mono track. Obviously when I get a stereo track the array becomes very large so here the question. How can I extract the two audio channels from a stereo track?
    Thanks in advance.
    Maurizio Di Vitto                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    A mono audio stream is stored [sample, sample, sample, sample], so just a list of samples in an array.
    A stereo sample is interleaved in the same manner, so you get [left-sample, right-sample, left-sample, right-sample]
    So every nth sample is the 1st channel, every nth+1 is the 2nd channel...

  • How can I extract the data from Xstring .

    Hi Gurus ,
    How can I extract the data from a XSTRING  .
    I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
    Someone told me that there is a standard FM for that . but I am not able to find .
    Please reply with the FM in case some one knows about it .
    Thanks in advance .

    The following code works as of 7.0 (in any SAP system):
    FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
    TYPES : BEGIN OF ty_struc,
              line TYPE c LENGTH 100,
            END OF ty_struc.
    DATA lt_char TYPE TABLE OF ty_struc.
    DATA length TYPE i.
    length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = input
      tables
        binary_tab            = lt_char.
    CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
    output = output(length).
    ENDFORM.
    Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM

  • How do I extract the BODY of a POST request?

    How do I extract the BODY of a POST request?
    Is this possible?

    Yes, this is true but why is it that after I use
    request.getInputStream() then request.getParameterValues()
    stops working correctly?

  • How do I extract the data of Variant configuration into internal tables

    Hi Experts,
    How can I extract the data of variant configuration into an internal tables while preparing the report.
    Thanks,
    bsv.

    Hi i´m not a "Expert.." but may I can help you:
    CUCB_GET_VALUES_FROM_INSTANCE
    Example:
    Instance =  MARA-CUOBF  or
    Instance = lips-cuobj
    Result is the data of the Variant tables.
    I need that for a simple report to evaluate customer & and his Variants......
    Robert

  • How can I view the boot volume permissions?

    How can I view the boot volume permissions in the Terminal and/or Single User Mode?
    I have tried: 'ls -l /Volumes' but this appears to only work for the non-boot volumes. I can test this by 'sudo chmod 777 /' followed by 'ls -l /Volumes' but the change is not reflected by the new list.

    I prefer to have my bootable volumes as follows:
    drwxrwxr-x
    I see no point in allowing others to write to / and sticky here often gets in my way. Can you see anything wrong with this?
    I couldn't say, as I let Mac OS X do what it wants with the / root directory. I don't know how sticky can hurt, as you need to have elavated privs to do anything in root anyway.
    But if it is working for you, have fun. Just make a note to yourself somewhere that you have made this change, so that if something stops working, you can take this change into consideration. And if this change does not cause problems, but does something useful for you, you can use the note to remind yourself that you need to re-make the change when installing a new system. So take notes on your changes. It will make your life easier in the future.

  • How do I locate the mixing console?

    How do I locate the mixing console?

    drumr123 wrote:
    How do I locate the mixing console?
    the mixing controls are on the left side of the timeline. unless you're using a very old version of GB, there's no way to hide it.

  • How do you change the alarm volume, how do you change the alarm volume

    How do you change the alarm volume on a iPhone 5C?

    You can change it in Settings > Sounds > Ringer and Alerts (or with the buttons on the side of the phone if you have "Change with Buttons" turned on in that same section of Settings > Sounds).
    Note that this change is not specific to the Alarm -- it will change the volume of incoming calls and other alerts as well as the alarm.
    I have found it works better for me to set the sound at the volume I want it to be for incoming calls and then to find an Alarm sound that works best with that volume level. Without changing the volume, some Alarm sounds seem louder or quieter (or at least more or less irritating). You select the sound when setting the alarm and the sound selected will then be the default on future alarms.

  • How can I extract the info from my Time Capsule?

    How can I extract the info from my Time Capsule?

    What info would that be??
    If you mean how to recover TM back to a computer.. see Pondini Q14-17
    http://pondini.org/TM/FAQ.html
    If that isn't it .. we do not know what.. "the info" you are talking about.

  • How can I extract the full SQL script for a schema?

    Hi,
    How can I extract the full SQL script for a schema?
    I am looking for some method that needs jus SQL*Plus and preferably doesn’t need any extra tool.
    Thank you,
    Alan

    How can I extract the full SQL script for a schema?What are you looking for? PL/SQL code? DDL for objects?

  • HOW CAN I EXTRACT THE SYSTEM DATE?

    HOW CAN I EXTRACT THE SYSTEM DATE?

    import java.util.*;
    import java.text.SimpleDateFormat;
    public class date2{
        public static void main(String[] args){
            Date today = new Date();
            SimpleDateFormat output = new SimpleDateFormat();
            String answer = output.format(today);
            System.out.println(answer);
    }If you want to make it prettier, you can look at using a locale, or a pattern string in the SimpleDateFormat constructor. Read the Documentation.
    Note that new Date(), constructs a Date with the current Time,
    you could also use: new Date(System.currentTimeMillis());
    Hope this helps
    -Philip.

  • How can I extract the native SQL generated by TopLink?

    How can I extract the native SQL generated by TopLink?
    This is useful for example to use pagination, or pass the SQL to a stored procedure that may do many things, like using a cursor, or apply security.
    Pagination example where the SQL inside the inner parentheses are generated from Toplink, and the outer SQL is generic:
    select *
    from
    (select xx.*, rownum as rn
    from
    (select o.order_id, r.name, ...
    from placed_order o, restaurant r
    where o.restaurant_id = r.restaurant_id
    order by o.order_ext_id
    ) xx
    where rownum < 21)
    where rn > 10

    Alternatively, you can open your sessions.xml in the Mapping Workbench and for a specific session, you can Click the Login Tab and then the Options tab. Then select "Native SQL" and it will be outputted to the console (assuming that is where you outputing it).
    zb

  • How can I extract the soundtrack from iMovie and put it in my iTunes Library?

    How can I extract the soundtrack from iMovie and put it in my iTunes Library?

    Or this
    From iMovie 10.0.6 select Share > File. Then select Format=Audio Only. Then select File Format and choose from AAC,MP3,AIFF or WAV.

Maybe you are looking for