473,765 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

music player

How can I design a simple sound player in C.I also don't know the
structre of music files format.Please help me.

Nov 15 '05 #1
7 2510
pa****@gmail.co m wrote on 21/08/05 :
How can I design a simple sound player in C.I also don't know the
structre of music files format.Please help me.


The use of the '\a' caracter may produce a sound (actually, it's
system-dependent), but it might be probably unsufficient to produce any
music of interst.

There is no alternative in standard C. You want systm calls or third
party more or less portable libraries like fmod.

It's not a C question.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair
Nov 15 '05 #2
Hi!

if you are using windows, refer to the mmio and waveout function in
your msdn, If you are on a mac os x try using auhal,

http://developer.apple.com/technotes/tn2002/tn2091.html

try the above link for it. Its for recording but interchanging the
scopes and using kAudioOutputUni tProperty_SetRe nderCallback instead of
kAudioOutputUni tProperty_SetIn putCallback would get it done.

if you are on linux try alsa sound programming. For alsa the following
link might be of help to you:
http://www.linuxjournal.com/article/6735

I would suggest that you start with uncompressed linear pcm data files
like Wave files.
try
http://www.borg.com/~jglatt/tech/wave.htm

for wave format. Its pretty straight forward.

Hope this helps

Thanks and regards
--Himanshu

Nov 15 '05 #3
<pa****@gmail.c om> wrote

How can I design a simple sound player in C.I also don't know the
structre of music files format.Please help me.

C doesn't have any standard sound facilities. However every compiler will
offer some sort of interface to the sound system.
Audio is difficult because it is usually asynchronous. Only rarely will you
want to play a sound, wait until it has finished, and then resume execution.
This means that C or most other languages are not ideal, and you are
frequently messing about with threads and flags and suchlike annoyances.
Nov 15 '05 #4
On Sun, 21 Aug 2005 21:19:55 +0000 (UTC), "Malcolm"
<re*******@btin ternet.com> wrote in comp.lang.c:
<pa****@gmail.c om> wrote

How can I design a simple sound player in C.I also don't know the
structre of music files format.Please help me.
C doesn't have any standard sound facilities. However every compiler will
offer some sort of interface to the sound system.


That's a bit of an overstatement, don't you think? I just double
checked, and the Keil C compiler for the 8051 microcontroller doesn't
seem to offer an interface to "the sound system". Probably a good
thing, since most systems using a member of the 8051 family don't have
a sound system to interface to.
Audio is difficult because it is usually asynchronous. Only rarely will you
want to play a sound, wait until it has finished, and then resume execution.
This means that C or most other languages are not ideal, and you are
frequently messing about with threads and flags and suchlike annoyances.


You just can't resist straying more and more off topic, can you?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 15 '05 #5

Malcolm wrote:
<pa****@gmail.c om> wrote

How can I design a simple sound player in C.I also don't know the
structre of music files format.Please help me.

C doesn't have any standard sound facilities. However every compiler will
offer some sort of interface to the sound system.
Audio is difficult because it is usually asynchronous. Only rarely will you
want to play a sound, wait until it has finished, and then resume execution.
This means that C or most other languages are not ideal, and you are
frequently messing about with threads and flags and suchlike annoyances.


Just curious, but what language would meet you exacting criterion for
playing sounds?

Nov 15 '05 #6
Pramod Subramanyan wrote on 22/08/05 :
Just curious, but what language would meet you exacting criterion for
playing sounds?


It's not a language question but a hardware and system issue.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"C is a sharp tool"
Nov 15 '05 #7

"Emmanuel Delahaye" <em***@YOURBRAn oos.fr> wrote
Just curious, but what language would meet you exacting criterion for
playing sounds?


It's not a language question but a hardware and system issue.

No, you need a language with good support for multithreading, which C hasn't
got - threads are a common extension but raise problems, such as trampling
over global variables and not having any easy way of scheduling.
You do of course need a sound board attached to the computer to physically
produce the sounds. Not too long ago, computers like games consoles would
produce sounds of a quality the CPU wasn't really capable of managing, by
using DMA engines and the like to feed samples to the card. So you get CD
quality audio, but as soon as you try to stray away from playing little
snatches mixed together in the specified way, you quickly find that the
system cannot cope. Nowaday that is less of an issue - a decent PC can
decompress an MPEG file, manipulate the audio data, and send to the the card
in real time.
Trying to do it in C is however a real nuisance - I don't know what language
you would use for prefenence.
Nov 15 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1595
by: TonyJeffs | last post by:
This isn't really a Javascript question - apologies if inappropriate- I don't know where to ask. This code in my website works fine on some pcs - it automatically loads media player and plays the music file when the page opens. But on others, media player opens but the music file won't download. As far as I can tell the setup of my laptop & desktop are similar (W98 2ed) Why won't the following code work correctly on my laptop - and...
1
1802
by: chitara | last post by:
code.poet Group: Members Joined: 16 Dec, 2005 Posts: 64 My Contributions
14
4016
by: gnarl | last post by:
Hello all, I'm developing a site in PHP4 for a music artist, who wants music to play across all their pages. I have loaded a simple flash applet to play the music, but every time the visitor to the site moves to a different page the music starts again. The artist would like the music to play continuously. I can only think of three possible ways to solve this, and I am not happy with any of them.
2
2301
Monolux
by: Monolux | last post by:
Are there amy Python based music player? That are simple to use? Because i'm thinking of learning a little about it. txs for the time...
2
3925
by: FlashForumKB | last post by:
Here is a chance for you to make my developers look bad. I have hired these guys to development my website which, in part, has music demos available to my users. These demos must include the entire piece with a spoiler in the background so users can not record them freely. The files must be secure! My original request was to have them build an application that merged the two files (spoiler and original music) into a single mp3 file and have...
2
4618
pbmods
by: pbmods | last post by:
At the request from MacMan247, I am hereby posting the 'how I did it' to get the music from ShadowWraith. Here's what I did. Turns out that the music is stored in MOD format inside the ShadowWraith Music file's resource fork. You can download a copy of ShadowWraith here: http://mac.the-underdogs.info/index.php?show=game&id=1282 What you'll want to do is open the music file using a resource fork editor, such as Rezilla. You'll know...
2
3156
by: Suresh P | last post by:
Hi All, Is there any way other than frames to play music in the background of the website without restart while navigating to different pages of the website. Because, frames will affect the SEO. Is it possible to achieve it via cookies/sessions?
11
2183
by: sniperelite | last post by:
i had to create a program for a programming class final, it breaks dow like this. i have 2 textboxes for user input, a drivelistbox which is linked to a dirlistbox which is also linked to a filelistbox so the user can choose the drive his music is on then find the folder the music is in and if others are like me you have so much music it takes for ever to find the artist or song you are looking for so i made a button that searchs the filelistbox...
7
2906
hsriat
by: hsriat | last post by:
Please suggest me a decent music player. My requirements are: JavaScript is able to add songs to the playlist dynamically. JavaScript can select which song to play. I don't care for 'music not being able to download'. Player doesn't have to have visible controls. Just a Play button is enough (that too controlled by JS) Not a solution then some pointer towards how to start with?
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.