11 Replies - 21036 Views - Last Post: 15 May 2010 - 10:49 PM Rate Topic: -----

#1 TheMagnitude  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 144
  • Joined: 12-January 08

Sound library

Posted 04 March 2008 - 02:55 PM

I am looking for a library to use to output sound through the speakers. This does not mean load a wav sound or whatever, it means generate a sound based on amplitude, frequency, etc. Ive looked around alot and Ive played around with:
#include <windows.h>

using namespace std;

int main()
{
	Beep(768,500);
	return 0;
}

But it doesnt output the sound through the speakers. Anyone know of such a library

Is This A Good Question/Topic? 0
  • +

Replies To: Sound library

#2 bhandari  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 9
  • View blog
  • Posts: 754
  • Joined: 31-January 08

Re: Sound library

Posted 04 March 2008 - 11:41 PM

I think the above code produces sound through internal speakers only. The one having custom output to speakers will be very hard to find!!! :(
Was This Post Helpful? 0
  • +
  • -

#3 TheMagnitude  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 144
  • Joined: 12-January 08

Re: Sound library

Posted 05 March 2008 - 12:13 AM

I know, and I need it aswell for this music band that Im part of
Was This Post Helpful? 0
  • +
  • -

#4 TheMagnitude  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 144
  • Joined: 12-January 08

Re: Sound library

Posted 05 March 2008 - 01:15 PM

So does anyone know of one?
Was This Post Helpful? 0
  • +
  • -

#5 captainhampton  Icon User is offline

  • Jawsome++;
  • member icon

Reputation: 13
  • View blog
  • Posts: 548
  • Joined: 17-October 07

Re: Sound library

Posted 05 March 2008 - 01:20 PM

The only thing I can really think of that would output some kind of sound at all would sadly be internally as such.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    
    cout << '\07' <<endl;
    
    system("PAUSE");
    return EXIT_SUCCESS;
}



However, I would assume that utilization of the windows library and knowledge of the innerworkings of it should prove useful for speaker configurations and utilizing different aspects of sound via code.
Was This Post Helpful? 0
  • +
  • -

#6 TheMagnitude  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 144
  • Joined: 12-January 08

Re: Sound library

Posted 07 March 2008 - 10:32 AM

View Postcaptainhampton, on 5 Mar, 2008 - 01:20 PM, said:

The only thing I can really think of that would output some kind of sound at all would sadly be internally as such.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    
    cout << '\07' <<endl;
    
    system("PAUSE");
    return EXIT_SUCCESS;
}



However, I would assume that utilization of the windows library and knowledge of the innerworkings of it should prove useful for speaker configurations and utilizing different aspects of sound via code.

So, basically, C++ cannot communicate with the speakers? Thats ridiculus! Someone must of made a C++ sound library, how do game creators produce sound!?
Was This Post Helpful? 0
  • +
  • -

#7 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Sound library

Posted 07 March 2008 - 12:26 PM

What platform are you working with? the PlaySound() function (and related functions) from the win32 API can access external speakers, to my knowledge.
Was This Post Helpful? 0
  • +
  • -

#8 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: Sound library

Posted 07 March 2008 - 01:00 PM

View PostTheMagnitude, on 7 Mar, 2008 - 11:32 AM, said:

View Postcaptainhampton, on 5 Mar, 2008 - 01:20 PM, said:

The only thing I can really think of that would output some kind of sound at all would sadly be internally as such.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    
    cout << '\07' <<endl;
    
    system("PAUSE");
    return EXIT_SUCCESS;
}



However, I would assume that utilization of the windows library and knowledge of the innerworkings of it should prove useful for speaker configurations and utilizing different aspects of sound via code.

So, basically, C++ cannot communicate with the speakers? Thats ridiculus! Someone must of made a C++ sound library, how do game creators produce sound!?

Yeah. DirectX (XACT), OpenAL, Windows API... There's nothing in vanilla C++ that can communicate with the sound card, unless you get pretty low-level, but if you use one of the many libraries out there, then you're in business.

EDIT:
Here's the link to the MSDN Library: http://msdn2.microso...ry/default.aspx
It has stuff for playing stuff via DirectX (XACT), and Windows API. Knock yourself out.

This post has been edited by MorphiusFaydal: 07 March 2008 - 01:02 PM

Was This Post Helpful? 0
  • +
  • -

#9 asdf.dic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-May 10

Re: Sound library

Posted 14 May 2010 - 12:31 AM

View PostTheMagnitude, on 04 March 2008 - 01:55 PM, said:

I am looking for a library to use to output sound through the speakers. This does not mean load a wav sound or whatever, it means generate a sound based on amplitude, frequency, etc. Ive looked around alot and Ive played around with:
#include <windows.h>

using namespace std;

int main()
{
	Beep(768,500);
	return 0;
}

But it doesnt output the sound through the speakers. Anyone know of such a library



I'm not sure if I understand exactly what you want. Simply play speaker sounds from a C - C++ program?
I can't understand why doesn't Beep works to you, I actually use it and it uses the speaker. I use Dev-C++, maybe that is the reason.
Sorry if this isn't what you needed.

Now here goes my question: what I want is to play another type of sound, I mean mp3 or wav, into a simple c++ program, I mean a basic one, with console interface. Is there any library that makes this possible?

Hope to help with my suggestion, and hope someone knows about what I need. Thanks after all.
Was This Post Helpful? 0
  • +
  • -

#10 snoopy11  Icon User is online

  • Engineering ● Software
  • member icon

Reputation: 762
  • View blog
  • Posts: 2,218
  • Joined: 20-March 10

Re: Sound library

Posted 14 May 2010 - 02:05 AM

The SDL library can play sounds.
through SDL_mixer
It can also play .wav or.mp3

the docs for it are here

http://www.libsdl.or...s/SDL_mixer.pdf

hope this helps.
Was This Post Helpful? 0
  • +
  • -

#11 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: Sound library

Posted 15 May 2010 - 02:07 AM

also, one I use is "Irrklang" you might google it, it's made by Ambiera.
Was This Post Helpful? 0
  • +
  • -

#12 Guest_Guest*


Reputation:

Re: Sound library

Posted 15 May 2010 - 10:49 PM

try this one

ALSA http://www.alsa-proj...x.php/Main_Page
SOX http://sox.sourceforge.net/
Was This Post Helpful? 0

Page 1 of 1