13 Replies Latest reply on Jul 10, 2006 3:46 AM by Newsgroup_User

    Sound Channel challenge

    BruceMasai
      I made a dual language Director movie with English audio files reside in Ch 1 and the foreign language files resides in Ch 2. Using sound(1). play ()and sound(2).stop() does not seem to stop both languages to play simultaneously.What is the correct coding to make soundChannel 1 active while SC 2 is stays inactive. I have a stub movie with an english button and the foreign language on another button. No matter what I've read in the Lingo guides, and tried, I can't seem to inactivate one language while the other is speaking.
        • 1. Re: Sound Channel challenge
          Level 7
          Not exactly what you asked, but you could place both audio files in a
          QuickTime file and turn individual tracks on or off.

          To work with sound channels, it might be easier to use lingo to play the
          files rather than placing them in a sound channel. For example, your
          buttons in your stub file could set a global that you read in your
          "main" file to determine which file to play. Perhaps something along the
          lines of:
          -- buttons:
          global gLanguage

          on mouseUp me
          gLanguage = sprite(me.spriteNum).member.name
          go to movie "main"
          end

          -- movie script in file "main.dir":
          global gLanguage

          on startMovie
          if stringP(gLanguage) then
          sound(3).play(mmeber "sound" && gLanguage)
          end if
          end
          • 2. Re: Sound Channel challenge
            Level 7
            I don't work with the sound channels much but if you must do it that way,
            why not set the volume of the unused channel to 0?



            --
            Craig Wollman
            Word of Mouth Productions

            phone 212 928 9581
            fax 212 928 9582
            159-00 Riverside Drive West #5H-70
            NY, NY 10032
            www.wordofmouthpros.com


            "BruceMasai" <webforumsuser@macromedia.com> wrote in message
            news:e8mp5u$5ua$1@forums.macromedia.com...
            >I made a dual language Director movie with English audio files reside in Ch
            >1
            > and the foreign language files resides in Ch 2. Using sound(1). play
            > ()and
            > sound(2).stop() does not seem to stop both languages to play
            > simultaneously.What is the correct coding to make soundChannel 1 active
            > while
            > SC 2 is stays inactive. I have a stub movie with an english button and the
            > foreign language on another button. No matter what I've read in the Lingo
            > guides, and tried, I can't seem to inactivate one language while the
            > other is
            > speaking.
            >


            • 3. Re: Sound Channel challenge
              BruceMasai Level 1
              Sean,
              Thank you very much for taking your important personal time out to reply to my distress call over the dual sound channel problem. Your info is very helpful and I would use them except (unless I didn't program this movie correctly) I had to use the sound channels because there are animation activity linked to each cut-up sound file. The sound channel 1 is occupied by Chinese and snd ch 2 is English. Both languages are sync to various forms of animation that occur at various lengths. At the beginning title page of the Director movie file are two buttons. One button is for the Chinese audio (pressing it should startup just snd ch 1 and disable snd ch 2) and the other button of course should run the English and disable the Chinese files residing in snd ch 1). It sounds simple enough, but even using the following does not work properly (for some reason beyond me, only the english version plays):
              In the English button sprite script resides:
              --Begins English Version
              on mouseEnter
              sprite(19).cursor = 280
              updateFrame
              end mouseEnter

              on mouseDown me
              sprite(19).cursor = 0
              _movie.updateFrame()
              _movie.go("P00")
              --P00 is one frame before the audio files of both languages begin
              sound(1).volume = 0
              --snd 1 is the Chinese lang file track and set to silent
              end mouseDown

              on mouseLeave
              sprite(19).cursor = 0
              end mouseLeave

              In the Chinese button cast script resides the following:
              --Begins Chinese Version
              on mouseEnter
              sprite(20).cursor = 280
              updateFrame
              end mouseEnter

              on mouseDown me
              sprite(20).cursor = 0
              _movie.updateFrame()
              _movie.go("P00")
              sound(2).volume = 0
              --which should play the Chinese and silence the English
              end mouseDown

              on mouseLeave
              sprite(20).cursor = 0
              end mouseLeave

              When I click the English button, it works. When I click the Chinese button, only silence (both Chin and Eng does not play), and as you can see, both syntaxes are written in opposite. Can't figure why the Chinese won't play.
              Both files run above various forms of Director animation effects, thus I can't use the other Snd channels.
              I've tried puppetSound 1, 0 in the Enlish button cast script, to silence the Chin, but that fails to work, too.
              • 4. Re: Sound Channel challenge
                Level 7
                Sean,
                Thank you very much for taking your important personal time out to reply to my
                distress call over the dual sound channel problem. Your info is very helpful
                and I would use them except (unless I didn't program this movie correctly) I
                had to use the sound channels because there are animation activity linked to
                each cut-up sound file. The sound channel 1 is occupied by Chinese and snd ch 2
                is English. Both languages are sync to various forms of animation that occur at
                various lengths. At the beginning title page of the Director movie file are two
                buttons. One button is for the Chinese audio (pressing it should startup just
                snd ch 1 and disable snd ch 2) and the other button of course should run the
                English and disable the Chinese files residing in snd ch 1). It sounds simple
                enough, but even using the following does not work properly (for some reason
                beyond me, only the english version plays):
                In the English button sprite script resides:
                --Begins English Version
                on mouseEnter
                sprite(19).cursor = 280
                updateFrame
                end mouseEnter

                on mouseDown me
                sprite(19).cursor = 0
                _movie.updateFrame()
                _movie.go("P00")
                --P00 is one frame before the audio files of both languages begin
                sound(1).volume = 0
                --snd 1 is the Chinese lang file track and set to silent
                end mouseDown

                on mouseLeave
                sprite(19).cursor = 0
                end mouseLeave

                In the Chinese button cast script resides the following:
                --Begins Chinese Version
                on mouseEnter
                sprite(20).cursor = 280
                updateFrame
                end mouseEnter

                on mouseDown me
                sprite(20).cursor = 0
                _movie.updateFrame()
                _movie.go("P00")
                sound(2).volume = 0
                --which should play the Chinese and silence the English
                end mouseDown

                on mouseLeave
                sprite(20).cursor = 0
                end mouseLeave

                When I click the English button, it works. When I click the Chinese button,
                only silence (both Chin and Eng does not play), and as you can see, both
                syntaxes are written in opposite. Can't figure why the Chinese won't play.
                Both files run above various forms of Director animation effects, thus I can't
                use the other Snd channels.
                I've tried puppetSound 1, 0 in the Enlish button cast script, to silence the
                Chin, but that fails to work, too.

                • 5. Re: Sound Channel challenge
                  BruceMasai Level 1
                  Craig,
                  Thank you very much for taking your important personal time out to reply to my distress call over the dual sound channel problem. Your info is very helpful and I tried it before writting to this forum (see below). I had to use the sound channels because there are animation activity linked to each cut-up sound file. The sound channel 1 is occupied by Chinese and snd ch 2 is English. Both languages are sync to various forms of animation that occur at various lengths. At the beginning title page of the Director movie file are two buttons. One button is for the Chinese audio (pressing it should startup just snd ch 1 and disable snd ch 2) and the other button of course should run the English and disable the Chinese files residing in snd ch 1). It sounds simple enough, but even using the following does not work properly (for some reason beyond me, only the english version plays):
                  In the English button cast script resides:
                  --Begins English Version
                  on mouseEnter
                  sprite(19).cursor = 280
                  updateFrame
                  end mouseEnter

                  on mouseDown me
                  sprite(19).cursor = 0
                  _movie.updateFrame()
                  _movie.go("P00")
                  --P00 is one frame before the audio files of both languages begin
                  sound(1).volume = 0
                  --snd 1 is the Chinese lang file track and set to silent
                  end mouseDown

                  on mouseLeave
                  sprite(19).cursor = 0
                  end mouseLeave

                  In the Chinese button cast script resides the following:
                  --Begins Chinese Version
                  on mouseEnter
                  sprite(20).cursor = 280
                  updateFrame
                  end mouseEnter

                  on mouseDown me
                  sprite(20).cursor = 0
                  _movie.updateFrame()
                  _movie.go("P00")
                  sound(2).volume = 0
                  --which should play the Chinese and silence the English
                  end mouseDown

                  on mouseLeave
                  sprite(20).cursor = 0
                  end mouseLeave

                  When I click the English button, it works. When I click the Chinese button, only silence (both Chin and Eng does not play), and as you can see, both syntaxes are written in opposite. Can't figure why the Chinese won't play.
                  Both files run above various forms of Director animation effects, thus I can't use the other Snd channels.
                  I've tried puppetSound 1, 0 in the Enlish button cast script, to silence the Chin, but that fails to work, too.
                  • 6. Re: Sound Channel challenge
                    Level 7
                    Try to insert a line in both scripts, where you also set the other sound
                    channel:

                    --english version
                    sound(1).volume = 0
                    sound(2).volume = 255

                    --chinese version
                    sound(2).volume = 0
                    sound(1).volume = 255


                    • 7. Re: Sound Channel challenge
                      BruceMasai Level 1
                      Anders Skov,
                      You're Brilliant! Thank you so very much for taking your important weekend time to provide to me the simple , but very pertinent solution to SAVE my Director movie project! You will get credit for helping this project succeed!!! I will never forget your programming mentoring and in your same spirit of generosity, I will look to share my Lingo solutions with developing Lingo developers in this forum!
                      • 8. Re: Sound Channel challenge
                        BruceMasai Level 1
                        Anders Skov, Sean Wilson, Lingo Pros...
                        Now that each language buttons silences the other out when pressed (as per Anders Lingo lines), in succeeding frames that has a loop script that waits (loops in frame) until the audio file ends (since each audio file is different lengths), seems to cut off the ending words (the event head moves before the audio finishes), even though I used the below frame script. Please let me know if there is a better way to write a loop in frame script that either acknowledges which channel is on and which has been silenced or can loop no matter which snd channel is active (sound.volume = 255). The following are scripts I wrote but either don't work or the audio doesn't complete even though I'm looping in frame:
                        Resides in each of the last script channel frame of each audio file...
                        The following script does not let the audio finish before moving on to the next frame, thus cutting off the audio in mid sentences.
                        --Sound file playing check
                        on exitFrame me
                        if soundBusy(1) then go the frame
                        else
                        sound(1).stop()
                        go the frame +1
                        end if
                        end

                        This set of Lingo I tried to see if the movie would recognized which Snd Channel frame was active, but it caused silence on Snd Channel 1 even though Snd channel 1 (the Chinese language) button was selected, thus becoming unuseable
                        on exitFrame me
                        if soundBusy(1) then go the frame
                        else
                        sound(1).stop()
                        go the frame +1
                        end if
                        if soundBusy(2) then go the frame
                        else
                        sound(2).stop()
                        go the frame +1
                        end if
                        end

                        And I even tried to double up the syntax, but to no avail!
                        on exitFrame me
                        if soundBusy(1) then
                        if soundBusy(2) then
                        go the frame
                        else
                        sound(1).stop()
                        sound(2).stop()
                        go the frame +1
                        end if
                        end if
                        end

                        And tried this syntax that I kept getting Lingo error messages.....
                        on exitFrame me
                        if sound(1).volume = 255 and sound(2).volume = 0 then
                        go the frame
                        else
                        go the frame +1
                        end if


                        if sound(2).volume = 255 and sound(1).volume = 0 then
                        go the frame
                        else
                        go the frame +1
                        end if
                        end
                        • 9. Re: Sound Channel challenge
                          Level 7
                          > if soundBusy(1) then
                          > if soundBusy(2) then

                          Well, when using both soundchannels, and ajusting the volume to only hear
                          one of them, it gets a little messy.
                          Both channels can actually be playing, and the only way you can test for
                          which you are hearing is to also test for volume.

                          Try:
                          if (soundBusy(1) and sound(1).volume > 0) or (soundBusy(2) and
                          sound(2).volume > 0) then go the frame
                          (watch for linebreaks)

                          Or

                          Try not using the soundchannels, like Sean suggested....any soundmember can
                          be played directly (without placing them in the channels), like this:
                          sound(1).play(member "someSound")

                          In your case, you could then forget setting the volume, and later testing
                          for volume.
                          For the two buttons use instead:
                          --chinese
                          sound(1).play(member "chineseSound")
                          --english
                          sound(1).play(member "englishSound")

                          and later in your framescript, when you need to test if the sound is
                          playing, you only need to test for one channel/the actual sound playing:

                          if soundBusy(1) then go the frame


                          • 10. Re: Sound Channel challenge
                            Level 7
                            See my response above...

                            --
                            Craig Wollman
                            Word of Mouth Productions

                            phone 212 928 9581
                            fax 212 928 9582
                            159-00 Riverside Drive West #5H-70
                            NY, NY 10032
                            www.wordofmouthpros.com


                            "BruceMasai" <webforumsuser@macromedia.com> wrote in message
                            news:e8p5b6$rhj$1@forums.macromedia.com...
                            > Anders Skov,
                            > You're Brilliant! Thank you so very much for taking your important weekend
                            > time to provide to me the simple , but very pertinent solution to SAVE my
                            > Director movie project! You will get credit for helping this project
                            > succeed!!!
                            > I will never forget your programming mentoring and in your same spirit of
                            > generosity, I will look to share my Lingo solutions with developing Lingo
                            > developers in this forum!
                            >


                            • 11. Re: Sound Channel challenge
                              Level 7
                              One more idea is to use one sound channel and assign the audio file to that
                              sound channel depending on which button is pressed. Of course this assumes
                              that the languages are in sync but I would guess they're not.

                              --
                              Craig Wollman
                              Word of Mouth Productions

                              phone 212 928 9581
                              fax 212 928 9582
                              159-00 Riverside Drive West #5H-70
                              NY, NY 10032
                              www.wordofmouthpros.com


                              "BruceMasai" <webforumsuser@macromedia.com> wrote in message
                              news:e8mp5u$5ua$1@forums.macromedia.com...
                              >I made a dual language Director movie with English audio files reside in Ch
                              >1
                              > and the foreign language files resides in Ch 2. Using sound(1). play
                              > ()and
                              > sound(2).stop() does not seem to stop both languages to play
                              > simultaneously.What is the correct coding to make soundChannel 1 active
                              > while
                              > SC 2 is stays inactive. I have a stub movie with an english button and the
                              > foreign language on another button. No matter what I've read in the Lingo
                              > guides, and tried, I can't seem to inactivate one language while the
                              > other is
                              > speaking.
                              >


                              • 12. Re: Sound Channel challenge
                                Level 7
                                But they must be since you're using the same score for each, so just use one
                                channel and set the appropriate sound file.

                                if <chinese> then
                                frameSound1 = member (<chinese sound member>)
                                else
                                frameSound1 = member (<english sound member>)
                                end if

                                This way you don't need to worry about jury rigging the volumes etc. (and I
                                would get credit this time even though I came up with the sound = 0 idea
                                ) )

                                Craig


                                --
                                Craig Wollman
                                Word of Mouth Productions

                                phone 212 928 9581
                                fax 212 928 9582
                                159-00 Riverside Drive West #5H-70
                                NY, NY 10032
                                www.wordofmouthpros.com


                                "Word of Mouth Productions" <lingoboy@spamershaveforcedmetofakethisname.com>
                                wrote in message news:e8talc$m6p$1@forums.macromedia.com...
                                > See my response above...
                                >
                                > --
                                > Craig Wollman
                                > Word of Mouth Productions
                                >
                                > phone 212 928 9581
                                > fax 212 928 9582
                                > 159-00 Riverside Drive West #5H-70
                                > NY, NY 10032
                                > www.wordofmouthpros.com
                                >
                                >
                                > "BruceMasai" <webforumsuser@macromedia.com> wrote in message
                                > news:e8p5b6$rhj$1@forums.macromedia.com...
                                >> Anders Skov,
                                >> You're Brilliant! Thank you so very much for taking your important
                                >> weekend
                                >> time to provide to me the simple , but very pertinent solution to SAVE my
                                >> Director movie project! You will get credit for helping this project
                                >> succeed!!!
                                >> I will never forget your programming mentoring and in your same spirit of
                                >> generosity, I will look to share my Lingo solutions with developing Lingo
                                >> developers in this forum!
                                >>
                                >
                                >


                                • 13. Re: Sound Channel challenge
                                  Level 7
                                  Of course, my solution of just using one sound channel would solve the
                                  problem of the sound getting cut off.

                                  --
                                  Craig Wollman
                                  Word of Mouth Productions

                                  phone 212 928 9581
                                  fax 212 928 9582
                                  159-00 Riverside Drive West #5H-70
                                  NY, NY 10032
                                  www.wordofmouthpros.com


                                  "Anders Skov" <anders.nospam@avnatura.nospamhere.dk> wrote in message
                                  news:e8su4e$6bn$1@forums.macromedia.com...
                                  >> if soundBusy(1) then
                                  >> if soundBusy(2) then
                                  >
                                  > Well, when using both soundchannels, and ajusting the volume to only hear
                                  > one of them, it gets a little messy.
                                  > Both channels can actually be playing, and the only way you can test for
                                  > which you are hearing is to also test for volume.
                                  >
                                  > Try:
                                  > if (soundBusy(1) and sound(1).volume > 0) or (soundBusy(2) and
                                  > sound(2).volume > 0) then go the frame
                                  > (watch for linebreaks)
                                  >
                                  > Or
                                  >
                                  > Try not using the soundchannels, like Sean suggested....any soundmember
                                  > can
                                  > be played directly (without placing them in the channels), like this:
                                  > sound(1).play(member "someSound")
                                  >
                                  > In your case, you could then forget setting the volume, and later testing
                                  > for volume.
                                  > For the two buttons use instead:
                                  > --chinese
                                  > sound(1).play(member "chineseSound")
                                  > --english
                                  > sound(1).play(member "englishSound")
                                  >
                                  > and later in your framescript, when you need to test if the sound is
                                  > playing, you only need to test for one channel/the actual sound playing:
                                  >
                                  > if soundBusy(1) then go the frame
                                  >