Shop OBEX P1 Docs P2 Docs Learn Events
Control of uMP3 Volume — Parallax Forums

Control of uMP3 Volume

GuidoGuido Posts: 195
edited 2007-06-25 23:17 in BASIC Stamp
Trying to control the volume of the Rogue uMP3 Player with the Stamp without much or should we say any success. I am sure that I have something wrong in the code. Any help would be appreciated.

VOLFULL:································ 'Reset the volume to "full"
· SEROUT TX,BAUD,[noparse][[/noparse]"PC ST V ",120,CR]
· PAUSE 500
· RETURN
VOLLOW:································· 'Reset the volume to "LOW"
· SEROUT TX,BAUD,[noparse][[/noparse]"PC ST V ",254,CR]
· PAUSE 500
· RETURN

Thank You
Guido

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-25 01:23
    Guido,

    I believe the uMP3 wants the value in ASCII text, which would mean you’d use a command like the one below. Take care.
    SEROUT TX,BAUD,[noparse][[/noparse]"PC ST V 120", CR]
    

    But if you wanted to use a variable you could use:

    SEROUT TX,BAUD,[noparse][[/noparse]"PC ST V ",DEC volume, CR]
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Vern GranerVern Graner Posts: 337
    edited 2007-06-25 23:17
    Guido said...
    Trying to control the volume of the Rogue uMP3 Player with the Stamp without much or should we say any success.

    I had luck using this routine on a BSIIp to fade out the music from a uMP3 in a device I built:

    
    ' ************************
    ' * I/O Definitions      *
    ' ************************
         MP3music    PIN 3  ' uMP3b: set the pin where the uMP3 "R" pin is connected MUSIC
    
    
    ' ************************
    ' * Variables            *
    ' ************************
      ' Rogue uMP3 player
        Volume           VAR   Byte      ' uMP3 Volume control variable 0-255, 0= loudest
    
    
    ' ************************
    ' * Constants            *
    ' ************************
      'uMP3 Settings
        uMP3Baud        CON     T9600 ' uMP3 music player
        DefaultVolume   CON     0     ' Default volume level
        FadeTime        CON     30    ' Delay between volume commands in fade routines
        MinVolume       CON     80    ' Minimum volume
        VolumeStep      CON     2     ' Volume fade steps
    
    
    '***********************
    '* Fade out music      *
    '***********************
        Volume = DefaultVolume
        DO WHILE Volume < MinVolume
          SEROUT MP3music,uMP3Baud,[noparse][[/noparse]"PC V ",DEC Volume,CR]
          Volume = Volume + VolumeStep
          PAUSE FadeTime
        '  DEBUG "PC V ",DEC Volume,CR
        LOOP
    
    
    



    The above assumes the uMP3 is already playing music. [noparse]:)[/noparse]

    Also, remember that ZERO is the LOUDEST setting.. sorta counter-intuitive, but once u have it coded its a non-issue [noparse]:)[/noparse]

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
Sign In or Register to comment.