Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #3118

Re: how to play mp3 using c programing

From "BartC" <bc@freeuk.com>
Newsgroups comp.programming
Subject Re: how to play mp3 using c programing
Date 2013-02-28 20:34 +0000
Organization A noiseless patient Spider
Message-ID <kgoev7$a7b$1@dont-email.me> (permalink)
References <1e24a734-bde9-4fe4-aa70-8a741904c2f5@googlegroups.com>

Show all headers | View raw


<achu.hegde19@gmail.com> wrote in message
news:1e24a734-bde9-4fe4-aa70-8a741904c2f5@googlegroups.com...
> i mean if i press number 1 then enter it should play a mp3 tone.

This seems to work under Windows:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main (void) {

printf("Press key:\n");

switch (getch()) {
case '1':
 system("file.mp3");
 break;
}
}

Provided it can find file.mp3 (which contains your tone). However the file
is played using an application chosen by the OS (eg. WMP).

If you want to get involved in audio file formats (MP3 is complex),
sound-card drivers and whatever, then there's a bit more to it. If you want
it portable, then there are even more things to take into account.

(Strangely, this is one of those things that were completely trivial 30
years ago on a home computer, that now seem, to me, next to impossible to do
for yourself on a modern PC.)

-- 
Bartc 

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to play mp3 using c programing achu.hegde19@gmail.com - 2013-02-28 07:34 -0800
  Re: how to play mp3 using c programing Noob <root@127.0.0.1> - 2013-02-28 16:52 +0100
  Re: how to play mp3 using c programing "osmium" <r124c4u102@comcast.net> - 2013-02-28 12:12 -0600
  Re: how to play mp3 using c programing "BartC" <bc@freeuk.com> - 2013-02-28 20:34 +0000
    Re: how to play mp3 using c programing Robert Wessel <robertwessel2@yahoo.com> - 2013-03-01 02:33 -0600

csiph-web