Built simple audio player without gui

This is a discussion on Built simple audio player without gui within the C++ Programming forums, part of the General Programming Boards category; I've been trying to write this simple app. The idea is to call it from command line with a mp3 ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Build simple audio player without gui

    I've been trying to write this simple app. The idea is to call it from command line with a mp3 file as parameter and get the track to play. Nothing more, nothing less. I would write this to be run from Linux. I've got no clue on how to start. If anyone can point me to some tutorial (I've looked, but they involve messing with GUI and working with Windows), or be of other help, I'll appreciate it. Thanks
    Last edited by sauronnikko; 01-31-2011 at 03:55 PM.

  2. #2
    The Dragon Reborn
    Join Date
    Nov 2009
    Location
    Dublin, Ireland
    Posts
    629
    ooh..from the title I actually thought you did it
    cool idea though..
    You ended that sentence with a preposition...Bastard!

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Yeah, sorry. My mistake

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Figure out the requirements, design it, code it, fail, and come back here with a specific question.

  5. #5
    Registered User
    Join Date
    Aug 2010
    Location
    Rochester, NY
    Posts
    196
    Quote Originally Posted by Bubba View Post
    Figure out the requirements, design it, code it, fail, and come back here with a specific question.
    Yup.

    @ OP:
    Look into the mp3 format, figure out how it's laid out in a byte-level. After that, it's just reading in the file, dealing with the parts as you get them.

    After that you just need to look at the audio API for your OS. My guess is it'd be pulse-audio for Linux, but I'm not sure on that, figure out how to get sounds to it (just byte sequences).

    Then it's basically just an array. Simple formula, read in sequence, determine what the hell it means, and throw it to the audio API.

    In concept it's simple.

    Only thing I'm not sure about is how to tell it the rate at which it's playing...or else the song will play as quickly as the processor can parse the file...lol.

    --------

    OS's like Linux have lots of OSS utilities for parsing stuff. I'd suggest looking for an MP3 decoding library, and using that. No need to re-invent the wheel every time you write a program...unless you're trying to sell it.

  6. #6
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    Or just use a multimedia API like SDL. (SDL_mixer to be exact)

    Load the file using argv[1] for the file path. Done in fewer than 10 lines.

  7. #7
    Registered User
    Join Date
    Aug 2010
    Location
    Rochester, NY
    Posts
    196
    Quote Originally Posted by \007 View Post
    Or just use a multimedia API like SDL. (SDL_mixer to be exact)

    Load the file using argv[1] for the file path. Done in fewer than 10 lines.
    Yeah, good approach if you're just getting the job done, I'm not sure if the OP just wanted to have a proof of concept, or he wanted to do the actual gory work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 11-03-2008, 08:48 PM
  2. GUI Scripting
    By QuestionC in forum Tech Board
    Replies: 5
    Last Post: 08-21-2007, 08:31 AM
  3. Simple C++ GUI programme does'nt run from dos
    By Shadowhunt in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2003, 05:30 AM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. Simple GUI for console app (How?)
    By Bill 101 in forum C Programming
    Replies: 3
    Last Post: 11-15-2002, 02:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21