How to play an instance of a sound in a soundchannel

I have some sounds in my library that I want to play in a soundchannel, but how? This is what I have so far:
var music:Sound = new Sound();
var channel:SoundChannel = new SoundChannel();
var sTransform:SoundTransform = new SoundTransform();
var sound:SoundFile1 = new SoundFile1();  // Note: SoundFile1 is a class; in it is my soundfile in the library
// music.load(sound); ??
channel = music.play();

It should be more like:
var music:Sound = new SoundFile1();
var channel:SoundChannel = music.play();

Similar Messages

  • How to play a cue point with mixer

    I know how to play a cue point of sound with the method:
    sound(1).queue([#member: ...  #startTime: ... EndTime: ... ])
    How can I transfer the method of cue point using  the mixer?
    I need to have any hint about this because I must use both cue
    point with playrate, at my begginer level of knowledge I know that:
    1) I can't use "playrate" with  "sound(1).play()" method.
    With this method I can use cue point;
    2) I'm trying to know If I can use cue point with   mixer method.
    With this method I can use "playrate" .
    It is also for me important to know if it is possible or
    impossible to solve this problem in director.
    Thanks.

    iPhone 3gs, 4 or 4s?
    With the former two, just drag the videos to the desktop iTunes and sycnhronize to your iPad. They will be synched to the stock Videos.
    With the latter, you can either resize the video to 720p (or less) OR use a third-party app (It's Playing, AVPlayerHD, GoodPlayer being the best choices) to play it back. I'd go with the latter to avoid quality degradation and long-lasting reencodings.

  • How to play sound in servlet program

    How to play sound when a page is gernerated? Thank you for any suggestion.

    Why would you want to do that? Remember that the servlet runs on the web server, which is probably in a room full of computers. Nobody will be there to hear it, and if somebody does hear it they will just think it is a problem.
    Perhaps you wanted to play a sound when the page is loaded in the browser? That's an HTML/Javascript/browser question that might get an answer in a forum about those topics.

  • How to play sound from a proprietary format

    I would like to convert a small java applet to flex as3
    The current applet connects  to a remote server to receive audio in a proprietry compressed and encrypted format using a tcp connection (the data is encoded as text)
    It then decrypts, decompresses the audio and uses java sound to play it.
    Looking at the as3 classes all I could find is a sound object that seems to only play mp3 audio and a urlrequest object that is used to download (what about streaming) mp3 audio from a server.
    I am looking for a simple sample that will incorporate retreving data from a server (perhaps using the http service) into e.g. a byte array, and playing pcm audio from a byte array.
    Ideally it would be a small set of files (1?) that I can compile using mxmlc; I am not good with IDEs, linux command line is my thing
    Thanks

    Maciek, many thanks!
    Here's sample code showing how to stream audio in arbitrary format and play it
    // File: Player.as
    // When running from local storage (during developement)
    // compile mxmlc -use-network=false Player.as
    // otherwise loading the local raw audio file fails with error 2148
    // The input audio format is 16 bit little endian 44.1Khz mono.
    package
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.Event;
        import flash.events.SampleDataEvent;
        import flash.net.URLRequest;
        import flash.net.URLStream;
        public class Player extends Sprite
            private var sourceUri:String = "audio.44.raw";
            private var sound:Sound = new Sound();
            private var soundChannel:SoundChannel = new SoundChannel();
            private var playing:Boolean;
            private var stream:URLStream;
            private var request:URLRequest;
            private var statusLine:TextField = new TextField();
            public function Player()
                statusLine.width = 400;
                statusLine.text = "Starting...";
                addChild(statusLine);
                getAudio();
                start();
            public function getAudio():void
                stream = new URLStream();
                request = new URLRequest(sourceUri);
                try {
                    stream.load(request);
                } catch (error:Error) {
                    statusLine.text = "Failed to load " + request.url + " : " + err!
            private function playCallback(event:SampleDataEvent):void
                var value:Number;
                var i:int, cnt:int;
                // Input is 16bit PCM, each sample occupies 2 bytes
                cnt = stream.bytesAvailable / 2;
                if (cnt >= 8192 || playing) {
                    playing = true;
                    statusLine.text = request.url + " : playing...";
                    if (cnt > 8192)
                        cnt = 8192;
                    for (i = 0; i < cnt; i++) {
                        // Convert 16bit little edndian pcm samples to numbers
                        value = stream.readUnsignedByte() + 256 * stream.readUnsign!
                        if (value > 32767)
                            value -= 65536;
                        value /= 10000; //Adjust the volume
                        // Input is mono, write to both channels
                        event.data.writeFloat(value);
                        event.data.writeFloat(value);
                    if (cnt < 2048)
                        statusLine.text = request.url + " : done...";              !
                else {
                    // Wait until enough data is bufferred
                    statusLine.text = request.url + " : buffering...";
                    for (i = 0; i < 8192; i++) {
                        event.data.writeFloat(0);
                        event.data.writeFloat(0);
            private function start():void
                soundChannel.stop();
                sound.removeEventListener(SampleDataEvent.SAMPLE_DATA,playCallback);
                playing = false;
                sound.addEventListener(SampleDataEvent.SAMPLE_DATA,playCallback);
                soundChannel = sound.play();

  • How to play sound after clicking on an object?

    Can anyone explain me how to play a sound in java when I click on a particular object? I have read lots of threads but couldn't find anything. All I want is a short sound(3,4 seconds) to be played each time I click on an object. I know I need to use Sound API but I cannot find anything helpful
    Thanks in advance

    flounder wrote:
    ProGenius wrote:
    I have read lots of threads but couldn't find anything.
    [I found lots of info|http://lmgtfy.com/?q=java+audioclip]
    that is knowing you can use audioclip. Even searching for "java sound tutorial" gives many good resources, including the sun trail:
    http://java.sun.com/docs/books/tutorial/sound/index.html

  • How to play sound in midlet midp1.0

    how to play a sound (wav format) in midp1.0?
    help needed regarding nokia api.

    well i think ur specified location might be wrong.
    also check out some other ways:
    i hope this might help u.
    1.
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import javax.microedition.media.control.*;
    import java.io.*;
    import java.util.*;
    public class mainsound {
    public Player player;
    public mainsound(String s){
    try{
    InputStream is = getClass().getResourceAsStream(s);
    player = Manager.createPlayer(is,"audio/AMR");
    player.addPlayerListener(new Listener());
    player.prefetch();
    catch(Exception e){System.out.println("Media Error" + e);}
    class Listener implements PlayerListener {
         public void playerUpdate(Player p, String event, Object eventData) {
              if (event == END_OF_MEDIA) {
              try {
              p.start();
              } catch (MediaException me) { }
    2.
    public void soundview()
    byte abyte0[]=a("024A3A45D0040029286185985504D04D06186987107107106185985504D0450710690610610000");
    Sound sound = new Sound(abyte0, 1);
    sound.init(abyte0, 1);
    sound.play(1);
    public static byte[] a(String s1)
    s1.toUpperCase();
    byte abyte0[] = new byte[s1.length() / 2];
    int i1 = 0;
    int j1 = 0;
    for(int l1 = s1.length() / 2; l1 > 0; l1--)
    int k1;
    if(s1.charAt(j1) >= '0' && s1.charAt(j1) <= '9')
    k1 = s1.charAt(j1) - 48;
    else
    k1 = (s1.charAt(j1) - 65) + 10;
    k1 *= 16;
    if(s1.charAt(j1 + 1) >= '0' && s1.charAt(j1 + 1) <= '9')
    k1 += s1.charAt(j1 + 1) - 48;
    else
    k1 += (s1.charAt(j1 + 1) - 65) + 10;
    abyte0[i1] = (byte)k1;
    j1 += 2;
    i1++;
    return abyte0;

  • How to play analog sound with PC input

    Hello,
    I have connected a pc to the pc input (VGA sub D15) in my TV 46TL933. I am looking to connect the analog audio output from the pc into the TV. I already tried to connect the audio signal to the component input, but the tv doesn't listen that input when switched to pc input. How to play sound from pc on the 46TL933 TV ?
    Thank you in advance for everyone who helps me.
    Kind regards
    John

    That doesn't appear to be a US model, and this is the forums for Toshiba USA. You may want to contact Toshiba in your region.
    - Peter

  • How to play infinite sound

    hi,
    how to play an (invisble) flashmovie containing a soundloop
    over several html-pages? (I use flash8 professional and I'm able to
    use script )
    thanks for any hints
    kesel2

    thanks Rafiq Elmansy,
    i found a solution which works fine and wasn't such much work
    to do, i thought before...
    the first call goes to a frameset, where one frame is filled
    with the startpage and the other frame (just 1row and color to
    background #fff, so it's not visible - don't set the visibility to
    hidden, then you get no sound too!).
    into the second frame i put the .swf file (width and heigth
    =1 px), with the looped sound, which now playes in all pages and
    even in the pageloading times...
    if nesseccary you could also add buttons to controll the
    sound, but they are outside the main window (frame 1) of your site.
    bye
    rainer kesel
    kesel2

  • How to Play a sample sound using Java

    Hi,
    I have an mp3 music files in database. When a user chooses a particular button, all the songs are fetched from the database.
    I have two buttons namely, 'Buy' and 'Play Sample'. If I click the 'Play Sample' button, a sample of the song has to be played (not the full song). If the user likes the sample, he can buy the full song.
    My question is how to achieve the 'Play Sample' using Java Swings and Sound. I have googled, but not find any solutions. Please provide me an example or link.
    Thanks in advance.

    HI
    Actually i am trying to create a JFrame which plays an mp3 music file
    with the help of play and stop buttons in it ...
    i splitted the frame into two
    i want a music file list in the first frame (JComboBox)
    and want to have play and stop button in the second frame .
    i had tried out some code in which the frame part is fine ,,,
    but i am not knowing how to play the file with those buttons ...
    here is the code and plz help me to move further ...
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSplitPane;
    public class AudioFile extends JFrame {
        public AudioFile() {
            setTitle("Music File");
            setSize(300, 400);
            JPanel jp1 = new JPanel();
            JPanel jp2 = new JPanel();
            JButton s= new JButton("STOP");
            JButton p= new JButton("PLAY");
            JLabel j1 = new JLabel("MusicFile");
            String[] musicfiles={"file:///home/swathi/Desktop/spot3.mp3","anitha.mp3"};
            JComboBox musiclist=new JComboBox(musicfiles);
            musiclist.setSelectedIndex(1);
            jp1.add(j1);
            jp1.add(musiclist);
            jp2.add(s);
            jp2.add(p);
            JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                    true, jp1, jp2);
            splitPane.setOneTouchExpandable(true);
            getContentPane().add(splitPane);
        public static void main(String[] args) {
          AudioFile sp = new AudioFile();
            sp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            sp.setVisible(true);
    }

  • How do I get Elements 13 64 bit to play .mts video files with sound as they do in Elements 11 32 bit?

    I have upgraded to Elements 13 64 bit from Elements 11 32 bit and .mts video files now play without sound - they still play perfectly with sound on Elements 11 32 bit.
    Is there something that needs to be changed to get Elements 13 to play them with sound or have Adope simply hooped .mts playback in Elements 13 64 bit?
    I am running on Windows 8.1 Professional with Media Centre on a Dell XPS15 and have Elements 13 64 bit and Elements 11 32 bit installed.
    Adobe, how do I get the support that is supposed to be available for 90 days after activation?

    Hello jl666,
    I have noticed the same issue having upgraded to PSE13 64bit from PSE9 on Windows 7.  This has been reported to Adobe in several forum threads and I have myself tried on three occasions to get Adobe Technical Support to acknowledge or respond to this issue, so far without any success. 
    Despite the fact that Adobe publically claims to support this format, I was told in my last chat with their technical support that I should buy Premiere Pro and that Elements has never and does not support any video data...
    Unterstützte Dateiformate | Premiere Elements, Photoshop Elements
    Here is my chat transcript which I attach in the hope that someone from Adobe will take this issue seriously and work towards providing a fix.
    Sanyogita: Hello. Welcome to Adobe Technical Support.
    Jon Barber: .MTS files no longer play with sound. .DV files no longer play at all.
    Jon Barber: Hello
    Sanyogita: One moment while I look up your customer record.
    Sanyogita: Please allow me a moment to search for the information.
    Jon Barber: ok
    Sanyogita: I can see you have PSE 13
    Jon Barber: Correct and previously PSE 9 where everything worked fine...
    Sanyogita: MAy I know which application are you using for >MTS files
    Sanyogita: .MTS files
    Jon Barber: This issue is mentioned in various threads in your forums as well, but no response or solution from adobe yet
    Jon Barber: Organiser just double clicking on the file to play it. They play, but with no sound. When I play them in Windows the sound is correctly played
    Sanyogita: In PSE 13 there is no provision of playing videos with sound
    Sanyogita: You need premiere pro to play videos with sound
    Jon Barber: Other formats are correctly played with sound. 
    Jon Barber: Please tell me why I have paid €80 to upgrade from PSE9 to get worse functionality then!
    Jon Barber: This is nonsense!
    Sanyogita: You should purchase Premiere pro for videos
    Sanyogita: PSE 13 is only for photos
    Jon Barber: Complete nonsense and not advertised in your documentation. Are you trying to tell me that no video files play with sound, because that is simply not true!
    Sanyogita: Please purchase Premiere elements for videos
    Jon Barber: Adobe sucks - I will pass your comments onto the appropriate forum threads and hope that other customers also let you know how they feel about this reduction in functionality from previous versions.
    Sanyogita: previous versions of PSE never supported video application
    Jon Barber: You are misinformed. These videos work fine on PSE 9 and most files still work on PSE13, just .MTS files have no sound
    Sanyogita: I am sorry ,I am not an expertise in this product
    Sanyogita: Let me connect you to that team
    Jon Barber: Yes,I can tell that - perhaps you could pass this open bug onto someone who does
    Jon Barber: Please do not close this bug - I am getting annoyed at having to reopen it
    Sanyogita: Please stay online I will transfer your chat now
    Jon Barber: ok thank you
    info: Please wait while I transfer the chat to the appropriate group.
    info: You are now chatting with Jayita Sen.
    Jayita Sen: Hello. Welcome to Adobe Technical Support.
    Jayita Sen: Please allow me a moment while I look into your account & verify the details.
    Jon Barber: Hello
    Jayita Sen: John we only support download &  first installation of PSE 13
    Jayita Sen: please contact the forums for further support
    Jon Barber: This issue is mentioned in several forums and no solution has so far been forthcoming from Adobe.
    Jon Barber: I paid €80 to upgrade from PSE9 and now have worse functionality than before and now you are telling me you cannot help. Is that what Adobe considers customer support?!
    Jon Barber: By the way I did recently download and initally install PSE13 so according to your rules you should provide support.
    Jayita Sen: Jon we don't support "Unexpected behaviours or how to issues"
    Jayita Sen: only forums support it
    Jon Barber: This is not a 'how to issue', it is a bug!
    Jon Barber: It is functionality that previously worked and no longer does. I am not requiring lessons in how to use the system, just trying to do something that already worked in previous versions.
    Jon Barber: Frankly I find these support responses from Adobe shocking. What I expect to hear from you is 'thank you for highlighting this issue, we will work on finding a solution and get back to you and others with the same problem in the customer forums" Not an extraordinary set of excuses for poor software.
    Jayita Sen: I am sorry Jon...but forums is where you can only get the support
    Jon Barber: Customers having to help customers since clearly no-one at Adobe has a clue about their own product. How many customers do you expect to have in 12 months with this service?
    Jon Barber: Goodbye - please contact me if you are geniunely interested in helping your customers rather than fobbing them off with excuses.

  • How to play sound file on HTML

    I have successfully able to record voice and save it into the database and replay it. Also able to store an external wave file and replay it using forms.
    I need to play the same soundfile from database on HTML using PL/SQL.
    Would appreciate if someone can support my problem. I need to know the package to read and play the database column storing sound.
    Thanks and Regards,
    Vipul

    Hi Vipul,
    Great to know that you could record a sound file and save it in Oracle and play it through Forms. We are having a similar requirment. Could you please list down the steps of exactly how did you achieve this ?
    It would be of great help to us if you can clear us the same. Thanks in Advance.
    Thanks,
    Karthik.

  • How can I record a Synth lead to sound exactly how I played it?

    For some reason when I record with the "Analog lead", it doesn't record exactly how I played it.

    Check the inspector on the left of the screen.  If it's not present, hit the "I" key.  Check the MIDI Thru setting.  It should be set to "off".  If it's set to a quantize value, it will alter the timing of the incoming MIDI notes.

  • How to play multiple CDs from Music list

    This may sound really dumb, but I can't figure out how to play multiple albums in the latest iTunes.  I have to drag them over to a Playlist then check all the individual songs.  Is there a way to gang up multiple albums and get them onto Up Next by just selecting from Music?  Sometimes only the first song will play when I double click an album.  This would be similar to playing three CDs from your home stereo, for instance.  Can this simple task be performed from ITunes, please??

    Basically right click the artits in that left column and select Add to Up Next.
    You can also select individual albums by right clicking the album cover a little to the right and choosing the same option.

  • How to play 5.1 audio with my Mac Book Pro Retina?

    I recently received several DVD's that have 6 channel LPCM 24/192 and 24/96 sound.  I have tried many alternatives  but to no success.  I will appreciate any suggestions...  Sincerely,  Joe Ray Skrha [email protected]

    How are you ripping the video and audio from the DVD?  You can't import stuff from a video DVD into an NLE without converting it to a workable format.  If you use something that will give you ProRes files, and the audio is surround sound, FCPX will edit surround sound natively.  As for playing it back in surround sound, you'd need a USB interface that connects to a surround sound system.

  • Looking for some info on how to play music files on IPAD2

    Hi and thanks for sharing.  Trying to figure out how to play sound files such as wavs or mp3s on my ipad2 while I browse the internet or use my computer.  I was trying to see if the music feature will play my songs or if I can import downloaded files from the net to itunes and if that will play in the background.  I have an audio program that can send sound files to email and was trying to figure out how, similarly, to get this play in the background while I do things too.  That and sound files downloaded from the internet.   Do these go to iCloud when you download them?  Can I import sounds into itunes with my iPad someway.  (It's the only computer or device I own).   Basically looking for a pathway to get music from my audio program that's sent to email, and clips I've DLed off sites on the internet, to play while I use the pad or browse the net.  Thanks for your intel on the mission.   Cheers!

    The only way to get content into the Music app is via iTunes store downloads or syncing with itunes on a computer. You will need to find a third party media player such as VLC (whick integrates with DropBox and GoogleDrive, if that appeals to you).

Maybe you are looking for