How to play a part of audio file?

Hi all

How to write the code to play a small part of the audio file.

myPlayer = Manager.createPlayer("file:///store/home/audio.mp3");
myPlayer.realize();
myPlayer.prefetch();
vc = (VolumeControl) myPlayer.getControl("VolumeControl");
vc.setLevel(80);
myPlayer.start();

I want to play a small part of the file music.MP3 (example: start 3rd second game).

Thank you!

Check the documentation for the classes:

Thread, timer, TimerTask - I'm sure some of them will do the job. You can implement a thread that waits for a while, then stops the player.

You will start this thread when the player starts (you can get the starting player event using PlayerListener).

I do not have this code, but it should not be difficult to implement.

Tags: BlackBerry Developers

Similar Questions

  • How to remove missing references and audio files or instruments that popup at launch I need is no longer?

    How to remove missing references and audio files or instruments that popup at launch I need is no longer?

    For audfio missing files: go to the Project Audio Bin, mouse control select unused , and then press DELETE. And then click Save.

    Missing instruments or plugins, go to your mixer and remove/Exchange any plugins that have a '!"in all of their slot. And then click Save.

  • How can I get a 'protected audio file' playing on Sonos?

    How can I play music from iTunes on a Sonos system?  Some of them will not play.  says that it is protected.

    If it's really a protected iTunes file you can play by using the Apple software.  Apple discontinued the element of political upgrade and you can pass only to unprotected by subscribing to the game for a year. Either that or burn the element on a CD and it rip (with possible additional quality loss).

  • How to download and save an audio file?

    I am trying to download audio (MP3) files that have been sent to me in zip files. Once I click on the link to download provided by the sender, the link download and I can then open it on my computer and unzip the file, showing the different MP3 files. But when I click on the file, there are no options that allow me to save on my computer. I just get an audio square, and then he just started playing. Any suggestions?

    Thank you

    Keith

    Drag and drop one of your regular files, or even on your desktop?

    But why are you asking in a help forum for an email client?

  • How to play a series of mp3 files short?

    I have a series of short mp3 files that I want to play in order.  I create each one as it is own InputStream, but how can I concatenate the input stream for use in the javax.microedition.media.Manager.createPlayer method?

    I found a similar announcement the following location, but I did not understand the suggestion:

    Add the 2 input streams

    Any ideas?  A short code snippet would be useful.

    Thank you...

    Once I deleted the supply line and exchanged files wav of mp3 files it started working.  It looks like you can not combine wav files.

  • How to play vob on ps3 streaming files

    My goal is to transfer my dvd collection on a 1.5 TB external harddrive and play through my xbox. I can get the DVD to the hard drive without problem, I can see them on the ps3, but they are in one. VOB format and I can get them to play on the ps3, but only files so I don't get that watching 15 minutes of the film then it ends and I have to manually have to go menu, and then select the following file and pick up where I left of to. any body knows a way have to play continuously throughout the movie?

    Nick,

    You need an app for that. Windows will not Vobs post them together and then do a full dvd.

    PlayStation plays everything just the way it is. It comes to be able to play on the xbox... xbox is quite fussy about what he likes to listen to, you can stream xvid, divx and wmv files and that's it. I think that there are also programs that will take the Vobs and compiles them into a somesort avi file which will be playable on the xbox.

    As for this program, I don't know, when I want to do things like that I usually google what I'm trying to make, download the demo of some app, if it works, then I'll buy it, its usually only $ 10 or more. Also check sourceforge.

    Shawn MCP. MCDST. LVL 80

  • How to play XVID MPEG - 4 (XVID) files

    Hi, im having problems trying to run the videos and I still get this codec problem, can anyone help? see you soon

    Might be interesting to try to download and install the Xvid Codec:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    XviD Codec
    http://www.xvidmovies.com/codec/

    XviD FAQ
    http://www.xvidmovies.com/FAQ/

  • Windows media player does not automatically open a video file on a Web site but I save it and open the file with Windows media player to play the video or audio recording.

    Windows media player does not automatically open a video file on a Web site but I save it and open the file with Windows media player to play the video or audio recording. I used to be able to play any video or audio file in any site!

    Hello

    Try resetting the default associations for WMP and IE.

    How to set default Associations for a program under Vista
    http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.html
    How to associate a file Type of Extension to a program under Vista
    http://www.Vistax64.com/tutorials/69758-default-programs.html

    If necessary:

    How Unassociate a Type of Extension file in Vista - and a utility to help
    http://www.Vistax64.com/tutorials/91920-unassociate-file-extention-type.html
    Restore the Type Associations by default Vista file extensions
    http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html
    How to view and change an Extension of filename on Vista
    http://www.Vistax64.com/tutorials/103171-file-name-extension.html

    ====================================

    Also follow these steps:

    Follow these steps to remove corruption and missing/damaged file system repair or replacement.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Then, run checkdisk - schedule it to run at next boot, then apply OK your way out, then restart.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    ------------------------------------------------------------

    Then, if necessary:

    Have you recently installed another player?

    Reset your associations for WMP and IE.

    How to set default Associations for a program under Vista
    http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.html
    How to associate a file Type of Extension to a program under Vista
    http://www.Vistax64.com/tutorials/69758-default-programs.html

    ---------------------------------------------

    Do this to reregister the Jscript.dll and Vbscript.dll files.

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    type or copy and paste-> regsvr32 jscript.dll
    Press enter

    type or copy and paste-> regsvr32 vbscript.dll
    Press enter

    Restart and if all goes well, it will run now.

    --------------------------------------------------------------

    Have you recently added stores or ANY application from Stardock?

    Using 64-bit Vista?

    Can you think of recent things you did in WMP which could be the cause? You added another
    reader recently or an add-on for WMP?

    When I try to use Windows Media Player 11, the program does not start, or some UI elements
    are empty - a Mr Fixit
    http://support.Microsoft.com/kb/925704/en-us

    Maybe something here
    http://msmvps.com/blogs/chrisl/articles/17315.aspx
    and here
    http://msmvps.com/blogs/chrisl/Archive/2004/10/30/17399.aspx

    Check here the news of WMP11
    http://zachd.com/PSS/PSS.html

    I hope this helps.

    I hope this helps.

    Rob - bicycle - Mark Twain said it is good.

  • How to play .asx files in Windows Media Player

    original title; Can I play a video file of .asx with WMP? or if not, how to play with this extension .asx files?

    Can I play a video file of .asx with WMP? or if not, how to play with this extension .asx files?

    When I try to play the file, WMP shows error then update says "video codec".

    How then can I get this update for the video codec?

    Thank you, Michael Phelps 907

    Hi Mike,.

    an .asx file is not a media file. It is a file that contains a pointer to a content online. So if you are unable to read a .asx file and are able to play other files using Windows Media Player so the best thing is to open the .asx, a Notepad file. When you open the .asx using Notepad, you will see a link that starts by http: and so on. Please copy this link and go to Windows Media Player. On the Windows Media Player window, press the Alt key on the keyboard and click file and Open url. Paste the link and check if Windows Media Player is able to open the link. If she opens the link this is a problem with the formatting of the .asx file and if it does not open the link then it is a problem with the server online of the .asx file. It could be that it is deleted from the server.

    Hope this information helps. Keep us informed on the status of the issue.

  • Satellite M50 - big echo during playback of any audio file type

    My M50 developed a problem with its sound just now.

    When you play ANY type of audio file (music/MP3, internet/YouTube, Windows Media Player, no matter), sounds are played with a great echo.

    Opening the window of TOSHIBA Virtual Sound Settings and settings, don't change anything. In fact, I can't change anything - if I set the speaker type (say 'built in speaker' on 'closed type headphones', the sounds are the same.)

    I don't remember when the problem arises, but it seems to coincide with the upgrade to SP3 of XP. (I'm under XP Home).

    Any ideas?
    Thank you

    Hello

    I believe that no one will be able to say with certainty what the problem is here. I can imagine that Sp3 installed something and now there's this strange sound question.
    But I guess it's because of the sound settings. I don't know what player you use but check it please equalizer. Maybe there's something you can change and have good sound back.

  • Keynote on iCloud plays not video or audio

    I dragged and filed my Keynote (Version 6.2.2) presentation in Keynote presentations folder to iCloud by following the instructions. The download is successful. But doesn't play any audio or video. (Yes, the option ' copy assets in this document "is enabled in the preferences of the Keynote). What Miss me?

    Thanks for the wisdom.

    There

    the sound file shows on the slide or on the Soundtrack?

    can you click on the play button on the audio file and see the progress indicator to move?

    system Preferences > sound for the correct audio device?

  • How to play several audio files at the same time and mute toggle some voices?

    Hi all

    Forgive me if this is mentioned elsewhere and kindly point me in the right direction.  I'm a kid with flash and action script so if you are in doubt, error on the side of more specific in your response, there is a lot of vocabulary I still don't know.

    The goal:

    I have 4 audio files which are Soprano, Alto, tenor and low voice of a musical example.  The result should allow the user to play all 4 voices at once and dumb voice specific to hear all the possible combinations of voices playing together or solo.  I imagined a check box at the beginning of each rated musical line that puts that voice muted when checked.

    It would be ideal to have the game, interrupt and stop reproduction choices where 'Stop' resets playback at the start and 'Pause' maintains the current place in time and takes over from there, once playback is started again.

    I am able to get the simple audio files to play from a single button, but I am struggling to find how to link multiple audio files to start at the same time by a single button.  I found this link: https://forums.adobe.com/thread/1069107?start=0 & tstart = 0

    where the last message mentions the use of tables, but being a complete beginner, I don't completely understand what they are doing.

    I know it's a big piece of questions at once, but if you could meet any part of it, or direct me to a tutorial/instructions, I would really appreciate it.

    Thank you for taking the time to help others

    use:

    kglad wrote:

    use:

    import flash.events.MouseEvent;

    import flash.media.SoundTransform;

    var soprano: Sound = new Soprano();

    Var high: Sound = new Alto();

    var tenor: Sound = new Tenor();

    var bass: Sound = new Bass();

    Ash var: Array = [soprano, alto, tenor, low];

    var offsetA:Array =]

    var st: SoundTransform = new SoundTransform();

    play_btn.addEventListener (MouseEvent.CLICK, playF);

    pause_btn.addEventListener (MouseEvent.CLICK, pauseF);

    stop_btn.addEventListener (MouseEvent.CLICK, stopF);

    playF function (e: MouseEvent): void {}

    for (var i: int = 0; i)< sounda.length;="" i++)="">

    This ["sc_" + i] = [i] Sunda () .play;

    }

    }

    function pauseF (e: MouseEvent): void {}

    for (var i: int = 0; i)< sounda.length;="" i++)="">

    offsetA [i] = this ["sc_" + i] .position;

    This ["sc_" + i]. Stop();

    }

    }

    function stopF (e: MouseEvent): void {}

    for (var i: int = 0; i)< sounda.length;="" i++)="">

    offsetA [i] = 0;

    This ["sc_" + i]. Stop();

    }

    }

    function unpauseF(e:MouseEvent):void {}

    for (var i: int = 0; i)< sounda.length;="" i++)="">

    This ["sc_" + i] = Sunda [i] .play (offsetA [i]);

    }

    }

    function muteF(i:int):void {}

    St.volume = 0;

    This ["sc_" + i] .soundTransform = m;

    }

    function unmuteF(i:int):void {}

    St.volume = 1;

    This ["sc_" + i] .soundTransform = m;

    }

  • How can I play flac Audio files with extension on windows media player

    How can I play flac Audio files with extension on windows media player

    Hello jesskenneth,

    Thank you for visiting the Microsoft answers Site.

    The extension Flac is not a type of supported Windows Media Player file. However, you can user your favorite search engine to search for a solution that can convert the file in a supported file type Windows Media Player.

    For more information on the types of files supported by Windows Media Player, you can also view the following link:

    Information on the types of media files that supports Windows Media Player

    Thank you

     

    Mary
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to play audio files, one after the other?

    Hi, I try to create an application that tries to read audio files a few one after the other. I've created a loop for playing audio files. But only the first track is played and the second song is playing only about 5 seconds while the rest do not get played at all and the two files that have played, pieces overlap, which is not supposed to be. Can you guys help me? I need urgent assistance that I need to finish it tonight.

    Here are my codes I created for the application:

    package mypackage;
    
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import java.lang.Class;
    import javax.microedition.rms.RecordStore;
    import java.io.InputStream;
    import java.io.ByteArrayInputStream;
    import net.rim.device.api.media.protocol.ByteArrayInputStreamDataSource;
    import net.rim.device.api.system.*;
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.extension.container.*;
    import net.rim.device.api.ui.UiApplication;
    import java.io.IOException;
    
    public class PlayMedia extends UiApplication{
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args){
    
            PlayMedia theApp = new PlayMedia();
            theApp.enterEventDispatcher();
        }
    
        public PlayMedia()
        {
    
            pushScreen(new PlayMediaScreen());
    
        }
        /**
         * A class extending the MainScreen class, which provides default standard
         * behavior for BlackBerry GUI applications.
         */
        final class PlayMediaScreen extends MainScreen
        {
            /**
             * Creates a new PlayMediaScreen object
             */
            public Player p = null;
            PlayMediaScreen()
            {
                String test3 = "Test(2seconds).mp3";
                String test5 = "Test(2seconds)2.mp3";
                //String test6 = "Test(2seconds)3.mp3";
                String test4 = "Test(2seconds)4.mp3";
                String test1 = "blind_willie.mp3";
                String test2 = "blind_willie.mp3";
                String mp3 = null;
    
                for(int i=0;i<5;i++){
                    if(i == 0){
                        mp3 = test1;
                    }
                    else if(i == 1){
                        mp3 = test2;
                    }
                    else if(i == 2){
                        mp3 = test3;
                    }
                    else if(i == 3){
                        mp3 = test4;
                    }
                    else if(i == 4){
                        mp3 = test5;
                    }
                    //testing
                    System.out.println("Song is "+ mp3 + "???????????????????????????????????????");
    
                    play(mp3);
    
                    System.out.println("Song is "+ mp3 + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                }
            }
    
            private void play(String mp3){
    
            InputStream stream = (InputStream)this.getClass().getResourceAsStream("/" + mp3);
    
                try {
                    //p = Manager.createPlayer(source);
                    p = Manager.createPlayer(stream, "audio/mpeg");
                    p.realize();
                    p.prefetch();
    
                    //testing
                    System.out.println("Creating Players!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                    System.out.println("The mp3 is " + mp3 + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
    
                    //testing
                    System.out.println("IO Exeception!!!!!!!!!!!!!!!!1 " + e);
    
                    //testing
                    System.out.println(p);
    
                } catch (MediaException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
    
                //testing
                System.out.println("Media Exeception!!!!!!!!!!!!!!!!1" + e);
    
                //testing
                System.out.println(p);
                }
                /*
                 * Best practice is to invoke realize(), then prefetch(), then start().
                 * Following this sequence reduces delays in starting media playback.
                 *
                 * Invoking start() as shown below will cause start() to invoke  prefetch(0),
                 * which invokes realize() before media playback is started.
                 */
                try {
                    p.start();
                } catch (MediaException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
    
                    //testing
                    System.out.println("Media Exeception for starting!!!!!!!!!!!!!!!!1" + e);
    
                    //testing
                    System.out.println(p);
                }
                /*
                try {
                    p.stop();
                } catch (MediaException e) {
                // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                p.deallocate();
                p.close();
                */
    
            }
        }
    }
    

    Please help me! Thanks in advance!

    What you will do, is add the PlayerListener and / if you have in your loop code would go in the treatment of the END_OF_MEDIA event. Once that noise has stopped you will start the next sound and add the listener of player.

    //Declarations
    PlayerListener pListen;
    String mp3 = "";
    
    ..........
    ..........
    
    pListen = new PlayerListener(){
       public void playerUpdate(Player player, String event, Object eventData) {
          if (event.equals(PlayerListener.END_OF_MEDIA)) {
             if( mp3.equals(test1) ) mp3 = test;
             else if( mp3.equals(test2) ) mp3 = test3;
             else if( mp3.equals(test3) ) mp3 = test4;
             .........
    
             InputStream stream = (InputStream)this.getClass().getResourceAsStream("/" + mp3);
             p = Manager.createPlayer(stream, "audio/mpeg");
             p.realize();
             p.prefetch();
             p.addPlayerListener(pListen);
             p.start();
          }
       }
    }
    
    InputStream stream = (InputStream)this.getClass().getResourceAsStream("/" + mp3);
    p = Manager.createPlayer(stream, "audio/mpeg");
    p.realize();
    p.prefetch();
    p.addPlayerListener(pListen);
    p.start();
    

    So, add the try-catch blocks.

  • How can you add 3 audio files to movie maker to play both?

    I do something and I passed the age trying to figure out how to make 3 audio file crash at the same time. It isn't working and I really need help as soon as possible. Thank you.

    It is not possible in Windows Movie Maker.  You will need a program like Adobe Premier, Sony Vegas or Camtasia.

Maybe you are looking for

  • How to make photos the camera chip to the computer?

    How to get pictures from the camera to the computer chip

  • a wifi connection time-out

    I have a Compaq 8510w running Windows XP. He has trouble establishing a connection wifi to my router. I get a message that it has limited connectivity because the network has not assigned an address. I have run the routine repair several times withou

  • Headset

    I have a problem with the headphones supplied with the Sansa Fuze that I bought a year ago. I can't get sound from the atria. My cousin tried his helmet, which came with his Ipud, and she said she had the same thing coming not earbud, and that it mus

  • can I use Microsoft Home and Student 2010 - Windows with vista

    I have had a problem with my computer and had to strip and reformatting, but lost all of my Microsoft Office 2007 and the disc program, I had cannot be reused. Can I replace it with 2010? Is - this compatiable?

  • WAP54G - Repeater mode

    Hi all! I tried to "repeat" a Lynksys WRT120N Router(ver. 1.0.01 G-mode only) using WAP54G Access Point(ver. 3.04) as repeaters. Is it possible in general because I had no luck so far? Thank you in advance! Momchil