Audio Fade

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Keif
    Forum Member
    • Jul 2004
    • 2

    Audio Fade

    Hi,
    I'm trying to add audio fade to the background audio on each page before the page jump action occurs. I found a sample on one of the forum archives that was identicle to what I could come up with, but Cory mentioned using a page timer to activate the fade. This is where I am lost. What do you need to do with the page timer to step the volume to zero before the page jump. Here's the link that I looked at:



    Thanks,
    Keif
  • yosik
    Indigo Rose Customer
    • Jun 2002
    • 1858

    #2
    Lets say that a button is the trigger. You would put the following action in the onClick event:

    --get current volume and launch timer with a 1/10 second interval
    vol = Audio.GetVolume(CHANNEL_BACKGROUND);
    Page.StartTimer(100);

    In the onTimer TAB of the page, you can add the following actions:

    --lower volume value by 20 every timer interval. This value can be changed
    vol = vol-20;
    Audio.SetVolume(CHANNEL_BACKGROUND, vol);
    --when volume has reached lowest value, jump to page
    if vol<10 then
    Page.Jump("nextpage");
    end


    Good luck
    Yossi

    Comment

    • valym23
      Forum Member
      • Oct 2007
      • 34

      #3
      Audio fade in AND out for more buttons...

      I wrote aboute fader that it's made with "OnTimer" function... but, question...
      it's work with more buttons? (i don't think so)
      Because on end of commands you made the command line with "Page:Jump (Next)...". The page has ONE "OnTimer" command that you can do, so for a only one "nextpage".

      Tell me if is another way to make the audio fader, without "OnTimer" function.
      Maybe some commands in "OnShow" function.
      And is possible to make audio fade in AND out on the same page?
      Ex: i have 3 pages, with 2 buttons and 1 audio file for each page (totally = 3 audio files).When the first page appear i wanna play first audio file in fade in mode. When i press the first button i wanna fade out and after audio is zero jump to second page(i saw it on a post in forum, so i know it is possible with "OnTimer" function).

      Here is the problem. "OnTimer" it's working only for ONE button. How can i made this fade in/out function working with two ore more buttons?

      Comment

      • longedge
        Indigo Rose Customer
        • Aug 2003
        • 2498

        #4
        Originally posted by valym23 View Post
        How can i made this fade in/out function working with two ore more buttons?
        Have a look at the attached example. Each button starts the timer with a different value.

        Tell me if is another way to make the audio fader, without "OnTimer" function.
        Yes there are other ways, but using the page timer is by far the best way to do it.

        Comment

        • valym23
          Forum Member
          • Oct 2007
          • 34

          #5
          Originally posted by longedge View Post
          Have a look at the attached example. Each button starts the timer with a different value.



          Yes there are other ways, but using the page timer is by far the best way to do it.
          hey, thanks for that... but you didn't understand what i want to say...
          look... here is a detailed example, a fictive one...
          i have 3 pages ... in the first page i put 2 buttons (one button jump to second page and the second button jump to the third page). When i press the first button i want to fade out the melody on the first page, jump to the second page and fade in the melody on the second page (another melody like the first page). on the second page i have some buttons (doesn't care about this) and one back button(who jump to the first page). When i press this "Back" button i wanna fade out audio on the secon page, jump to the first page and fade in the audio on the first page. In the first page, when i press the SECOND button, i wanna fade out the audio in this page (the first one) jump to the third page and fade in the audio in the third page (another like first and second page). When i press the back button on the third page i wanna fade out the audio on the third page, jump to the first page and fade in the audio on the first page. I don't think are that easy those steps.
          If you make this you are the best!!!

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2498

            #6
            OK I think I understand what you want. I'm uploading an updated example.

            I've only used one sound for all 3 pages to keep down the file size but you could specify a different sound in each page preload section.

            Comment

            • valym23
              Forum Member
              • Oct 2007
              • 34

              #7
              Uau...

              Originally posted by longedge View Post
              OK I think I understand what you want. I'm uploading an updated example.

              I've only used one sound for all 3 pages to keep down the file size but you could specify a different sound in each page preload section.
              UAU... That's really works!!!
              Very good, man!

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #8
                Valym23- Regarding your p.m. asking how in this example you could run another application but hide the AMS window you could put this in a button on click -

                Code:
                --Minimize your application while the exe is running and
                -- then restore it when the other exe has finished or is closed.
                Application.Minimize();
                Audio.Pause(CHANNEL_BACKGROUND);
                result = File.Run("AutoPlay\\Docs\\someprogramme.exe", "", "", SW_SHOWNORMAL, true);
                Application.Restore();
                Audio.Play(CHANNEL_BACKGROUND);
                
                --or if you need to close your AMS application then this
                -- might work but I haven't tested it.
                --result = File.Run("AutoPlay\\Docs\\MyProg.exe", "", "", SW_SHOWNORMAL, true);
                --result = File.Run("AutoPlay\\Autorun.exe", "", "", SW_SHOWNORMAL, false);
                --Application.Exit(0);
                Using the forum means that other people can benefit from solutions and also help out with problems :yes

                Comment

                • Macord
                  Forum Member
                  • Oct 2006
                  • 14

                  #9
                  Just applied the scrip indicated:

                  Application.Minimize();
                  Audio.Pause(CHANNEL_BACKGROUND);
                  result = File.Run("AutoPlay\\Docs\\dubai3d.wmp", "", "", SW_SHOWNORMAL, true);
                  Application.Restore();
                  Audio.Play(CHANNEL_BACKGROUND);

                  But when it minimize to start play...it's just restore imediatly. Why is it happening?

                  Comment

                  • longedge
                    Indigo Rose Customer
                    • Aug 2003
                    • 2498

                    #10
                    What is "dubai3d.wmp"?

                    If you double click on it what happens?

                    Comment

                    • longedge
                      Indigo Rose Customer
                      • Aug 2003
                      • 2498

                      #11
                      Originally posted by Macord View Post
                      But when it minimize to start play...it's just restore imediatly. Why is it happening?
                      Because this only works for executables so if your file was say a video you would use something like -

                      Code:
                      Application.Minimize();
                      Audio.Pause(CHANNEL_BACKGROUND);
                      result = File.Run("C:\\Program Files\\Windows Media Player\\wmplayer.exe", " /play /close C:\\NameOfFolder\\NameOfVideo.mpg", "C:\\Program Files\\Windows Media Player", SW_SHOWNORMAL, true);
                      Application.Restore();
                      Audio.Play(CHANNEL_BACKGROUND);
                      I would guess that your file is a video or audio file of some sort and not an exe.

                      Comment

                      • Macord
                        Forum Member
                        • Oct 2006
                        • 14

                        #12
                        Thank you longedge, looks like it works...but...i believe its a bug happening here.

                        Now i made a more simple solution. Just placed a:

                        on click
                        Audio.Pause(CHANNEL_BACKGROUND);

                        on leave
                        Audio.Play(CHANNEL_BACKGROUND);

                        Works fine but every time i made a mouse over the button (made by a image object) it pauses the music or interupt the music reproduction (like 1 sec).

                        And...seriously...moving the mouse over from left side...pause...over the image...right side...music return

                        Maybe its not possible using an image?

                        Comment

                        • longedge
                          Indigo Rose Customer
                          • Aug 2003
                          • 2498

                          #13
                          You are bound to have problems with this. If you click a button, then you've got to leave it after you've clicked it. The sound will start again as soon as you leave.

                          Simply mouse over and leave without clicking has no effect when I try it.

                          The above is true whether it's a button or an image.
                          Last edited by longedge; 03-13-2008, 07:39 AM.

                          Comment

                          Working...
                          X