Trance Forum | Stats | Register | Search | Parties | Advertise | Login

There are 0 trance users currently browsing this page and 1 guest
Trance Forum » » Forum  Production & Music Making - Sound programming in C
Share on facebook Share on twitter Share on StumbleUpon
Author

Sound programming in C

Amygdala
Amygdala

Started Topics :  12
Posts :  175
Posted : May 26, 2005 12:35
Hello all,

I'm looking for an easy way to output single samples (or maybe buffers of say 512 samples) to the soundcard from a C-program.

The coolest way, would be to have a library that specifies an audio callback function, that is run everytime a sample (or buffer of samples) is needed - so for instance, I can calculate the samples for output in one thread, and then send them to the soundcard, by tapping the output in the callback function...

Do you have any experience with this, and know of any usefull libraries...?

Thanks in advance

-A
slyman604
IsraTrance Junior Member

Started Topics :  11
Posts :  263
Posted : May 26, 2005 17:09
this can do everything but its in C++
http://www.nuim.ie/academic/music/musictec/SndObj/

you might be able to find a decent library on this page though in C. Its for linux but probly most the libraries are text and just tar/gziped
http://linux-sound.org/tools.html
thockin


Started Topics :  1
Posts :  114
Posted : May 26, 2005 18:40
portaudio should do what you want
Amygdala
Amygdala

Started Topics :  12
Posts :  175
Posted : May 26, 2005 21:49
Thanks guys, I'll get on it
fregle
IsraTrance Junior Member

Started Topics :  11
Posts :  982
Posted : May 26, 2005 21:57
directX man... Everything is in directX... but it's probably not low-level enough for u, cuz directX can handle all the things u want to do urself with it's tools. It's complex, but it's the library most people use for audiovisual programming. Most of the time u make urself an engine that runs on top of directX to make life easier... And then u build ur programme around the engine so u can use ur own classes.
Hayez


Started Topics :  8
Posts :  393
Posted : May 27, 2005 00:37
Quote:

On 2005-05-26 21:57, FREGLE wrote:
directX man...


you're not talking about direct show plug-ins are you ?, cause that's a nightmare.

@ Amygdala, I think the easiest way is to write a VST plug-in. if you start with their example, the only thing you will have to write is a process function, but then it's c++           "a new art came into my mind which only you can create, the Art of Noises, the logical consequence of your marvelous innovations." Russolo, 1913
fregle
IsraTrance Junior Member

Started Topics :  11
Posts :  982
Posted : May 27, 2005 15:17
no i'm not hayez directX is one of the most important libraries of windows, every 3D-game uses it, because it's the fastest library u have for 3D visuals and audio on the pc (openGL is slower, but crossplatform, and doesn't have anything for audio). Why do u think games always ask u if u have the right version of directX on ur system it's like win32.dll and such, one of those essential parts of windows... And as a programmer (in C++) u can use every dll in the system as a resource for building ur program. What i meant is that directX is the best 'toolbox' inside windows for working with audio and video. It is in fact the buffer between the programmer and the hardware... The people who write directX make sure that every new piece of hardware is supported by it, so the programmer just has to worry about the program, not about which hardware everybody is gonna use to run the program... he only has to make sure the user has the right version of directX installed.

This is the simple explanation, and there are things that aren't explained quite right, but i don't have the time, nor the inclination to explain all this right now, and i'm not a directX programmer, i only worked with openGL (easier and crossplatform), and even with openGL i don't have enough experience to explain all this in detail...

anyway, i think this is the most usefull library for audio u have in windows...

this was on the mickeysoft website:

Microsoft® DirectX® is an advanced suite of multimedia application programming interfaces (APIs) built into Microsoft Windows® operating systems. DirectX provides a standard development platform for Windows-based PCs by enabling software developers to access specialized hardware features without having to write hardware-specific code.
Hayez


Started Topics :  8
Posts :  393
Posted : May 27, 2005 20:32
nice explnation FREGLE
I was afraid you're talking about DX plug-ins (or DirectShow as I called them).
If I was writing a game, I'll definitly use DX, but it won't be my first choice for a simple audio process. VST makes it very easy to program new audio plug-ins, so I still think it's the best way, plus you'll get potability and flexiblity for free.
http://www.steinberg.de/Steinberg/Developers8b99.html?Langue_ID=2&loc=lMen1449

          "a new art came into my mind which only you can create, the Art of Noises, the logical consequence of your marvelous innovations." Russolo, 1913
ZilDoggo


Started Topics :  4
Posts :  663
Posted : May 28, 2005 14:21
DirectX faster than openGL??
is this true?

i was under the impression that this depeneds mostly on the cards drivers.,no?
i mean, why would openGL be slower when it has much less management stuff running on top of it compared to directX?

afaik directX forces you to fill in huge unspeakable arrays bewfore it lets you do the simplest of things.

but then again, opengl doesnt do sound, does it?

anyway,
please awnser,
make brain happy

greets,.
aka.
fregle
IsraTrance Junior Member

Started Topics :  11
Posts :  982
Posted : May 28, 2005 15:51
well, the fact that u have to do unspeakable things to do the simplest things should prove to you that directX is faster (it's like C++ and java, U have to do much more urself in C++, but it's endlessly faster the java, there are more reasons for this, but it's one of the reasons), in fact, it does the least possible (that's why u have to do so much stuff that u wouldn't have to do in openGL) to keep the performance slick, the less code that's inside directX the more performant it is... It's only an interface between the coder and the hardware, the rest u have to do urself. OpenGL is a toolkit ideal for people who can't handle 3D or are starting out in 3D but that results in a less slick code on the whole. (openGl contains maths, premade vectors, etc... all things that have nothing to do with hardware, but more to do with programming 3D, directX doesn't care about the coder, it just provides an interface with the hardware, not all kinds of fancy classes that have nothing to do with hardware but everything to do with programming 3D)

Also, because of the fact that openGL is crossplatform it contains lot's of code that's superfluous, just to handle the diferent platforms it can run on...

directX works with ALL graphics cards, openGL works with ALL graphics cards...

openGL is handy if u want to programme a game or 3D animation that can be played on every OS, without having to rewrite ur entire code for every platform. And because it makes life easy for 3D programmers... But if u really want the easy life, then use java to program 3D, it is by far the easiest, best documented way to program in 3D. The resulting program however is so slow that a java-3D game with the visual quality of quake1 would have trouble running on a modern pc...
ZilDoggo


Started Topics :  4
Posts :  663
Posted : May 28, 2005 17:32
fregle,

" well, the fact that u have to do unspeakable things to do the simplest things should prove to you that directX is faster"

this just proves that you have to do a lot of stuff by hand. (which also uses up cpu cycles)
this does not prove it will be faster ...

"in fact, it does the least possible (that's why u have to do so much stuff that u wouldn't have to do in openGL) "

so, in other words, they let the programmers figure out how to get the best performance (instead of letting the library take care of that.,)
thereby increasing the chance for programmers to make slower code.,.,

" it [directx] just provides an interface with the hardware"

no it doesnt, it provides an interface to the HAL, which may or may not use the HEL and still has to call the vidcard driver .,.,
the video card driver does the actual hardware calls to the card.
what you write in your code has absolutely nothing to do with how a vidcard is addressed by the driver.
the stuff you get back from the directx api (hardware capabilities) are produced by the DRIVER, not the card.

so basically i still dont see the difference speedwise.
it depends on how fast/easy the driver can translate between the api and the actual hardware calls.

"Also, because of the fact that openGL is crossplatform it contains lot's of code that's superfluous, just to handle the diferent platforms it can run on... "

never heared of #IFDEF ??

we dont have superfluos pieces of code for years now., it gets kicked out even before compilation.,
and then, in case of windows, it is totally optimized for the platform
actually, vidcard manufacturers usually make their own special opengl drivers which dont contain anything that's useless.

in any case, crossplatformabillity is not an issue.
otherwise why would Sony be so stupid to implement OpenGL as the standard graphics library for the PS3 ?., i mean, shouldnt they write their own custom libraries specially for the RSX?

anyway, i'd like to see some proof,.
you know any sites with benchmark infos?.,

greets.,
aka.,
Boobytrip
IsraTrance Junior Member

Started Topics :  39
Posts :  988
Posted : May 30, 2005 16:26
Check out Reaktor 5's Core Technology if you're into hacking your own stuff. NICE

http://www.native-instruments.com/index.php?id=reaktor5_us&ftu=4a45376a65
ZilDoggo


Started Topics :  4
Posts :  663
Posted : May 30, 2005 20:22
amygdala,
you may also want to take a look at SDL:

http://www.libsdl.org/index.php

greets.,
aka.,
Trance Forum » » Forum  Production & Music Making - Sound programming in C
 
Share on facebook Share on twitter Share on StumbleUpon


Copyright © 1997-2025 IsraTrance