2 questions

Hello forum,

I am kinda new to of and to C++ and to this forum…
but I have some serious experience programming with supercollider, scheme and other languages - so I wouldn’ t say I am exactly newbie… at least I am not having with C++ the moment

anyway,

I am working on a project with of to see if that’ s what I need - and I seem I like it !

I have 2 questions,
how can I build a stand alone application with Xcode ??

I tried to do so but the terminal responds there is some app missing…

then,

I am particularly interesting in sound,
of seems to lack basic DSP classes (like sinewaves or noise, etc)
is there some other easy to use library I can use instead with of ???

thx !

m

  1. Did you try compiling the example projects that come in the 006 download?
    These apps are standalone apps.

  2. You could try the ofxSndObj addon here: http://addons.openframeworks.cc/projects/show/ofxsndobj

It is based off of the same library that PD uses for sound.

Hope that helps,
Theo

Hi,

I developped a cmake build infrastructure to ease build on my mac boxes and linux ones.
You can try it if it can help you generate correct Xcode project files (tested on ubuntu 9.04, osx Tiger and Leopard). I use it to produce standalone app.

http://github.com/dopuskh3/ofx-cmake-build/

Regards

I am not sure if I do things right

I builded an example with Xcode both in debug and release mode,

in the debug build I can’ t see any executable file,
in the release one, I can locate an executable in a directory and when I run it on the terminal I get

/Users/marinosk/Documents/C:objC:C++/of_preRelease_v0.06_xcode/apps/examples/fontsExample/build/openFrameworks.build/Release/openFrameworks.build/Objects-normal/i386/openFrameworks ; exit;
unknown-00-26-bb-09-16-09:~ marinosk$ /Users/marinosk/Documents/C:objC:C++/of_preRelease_v0.06_xcode/apps/examples/fontsExample/build/openFrameworks.build/Release/openFrameworks.build/Objects-normal/i386/openFrameworks ; exit;
dyld: Library not loaded: ./libfmodex.dylib
Referenced from: /Users/marinosk/Documents/C:objC:C++/of_preRelease_v0.06_xcode/apps/examples/fontsExample/build/openFrameworks.build/Release/openFrameworks.build/Objects-normal/i386/openFrameworks
Reason: image not found
Trace/BPT trap
logout

[Process completed]

now I am gonna check the cmake way,

about the sound library,
I downloaded it,
what am I supposed to do with it ??
where should I copy the files ??

thx and sorry for asking silly things but I am a bit new with C++ …

Why, may I ask, are you trying to run from terminal? If you are building/compiling in Xcode on a mac, you will get a .app that will run like any normal mac application by double clicking it. Usually it is named something like openframeworksdebug.app, (not in front of my box at the moment.

As for the addon, place the source in your addons folder, drop the source into the project you want to use it in, include the header, and use as documented. There should have been an addon example folder if you downloaded the FAT version of OF with some apps that use addons if you wanna check out an example. If you have any trouble hit me up, I do mainly sound work, and have used that particular addon in a few projects.

Arick’s

I don’ t …

I just a folder named openframeworks.build and inside it several files and a folder named objects-normal with several files insde it and a command line executble that I try to run…

Actually I was wandering why I don’ t get any executable… but I am not that familiar with xcode, so I may do sth wrong

you’re lookin in the wrong spot there chief. When you do a “Build and Go” command, it creates the executable into the /bin/ directory of the particular projects folder… for example if I compile one of the provided examples, there will be a executable in:

/Volumes/Development Drive/OF0.06/apps/examples/advancedGraphicsExample/bin

with the name of:

openFrameworksDebug.app

You may not see the .app extension, depending on how you have your finder settings, but it will have the icon of two white sheets of paper with a the little “pencil, ruler, brush” A icon on it…

great !

I found it

thx

I think I need some more help on how to get started with sound…

I can’ t find any documentation for the sndObj on line - at least no useful one :slight_smile:

I coppied all the sources in my project,

say I just want a to playback sinetone
could I have an example code ?

You should try all of the examples that come with OF first. The audioOutputExample plays a sine wave through your soundcard.

well

I am not sure but I constantly do not get the results I want…

I attach the whole project I’ ve been working on for example,

I just created 11 instances of sine tones that should be played back in different frequencies and slide
I used the code from the audiooutput example and copied it 11 times,

yeah I know it’ s not the best thing to do
I could have done this with iteration

anyway,
what I hear is completely irrelevant…

is it my fault or sth I do not understand ?

is it my fault or sth I do not understand ?

without seeing any code, it’s hard to offer any advice about this. feel free to post up source code.

by the way, in some of the early weeks of this class, there’s code that does audio synthesis. they might not be 0.06 projects, but you can plug the src code into a 0.06 project just fine:

http://visiblevisible.org/teaching/avsys/blog/?cat=4

there’s an example of additive synthesis and some of my students have made projects with additive synthesis (see their homeworks pages)

hope that helps!

take care,
zach

oh,

I though I attached the code…

anyway I uploaded here :

http://rapidshare.com/files/285857997/prj2.zip.html

Well, for starters you should only have one audioRequested() function.
This function passes the audio onto the hardware, which you only do once.

To play multiple sines waves you need to:

  • generate samples for the individual sine tones
  • add them together
  • normalized them to avoid clipping
  • then assign them to the output[] array

At the sample level, mixing is done by adding samples together, not multiplying. This may be counter intuitive to begin with.

So to mix 2 sines you would do something like this:

  
  
float numSines = 2.0;  
	for (int i = 0; i < bufferSize; i++){  
  
		phase += phaseAdder;  
  
		phase2 += phaseAdder2;  
  
		float sample = sin(phase);  
  
		float sample2 = sin(phase2);  
  
		lAudio[i] = output[i*nChannels    ] = sample * sample2 * 1.0/numSines * volume;  
  
		rAudio[i] = output[i*nChannels + 1] = sample * sample2 * 1.0/numSines * volume;  
  
	}  
  

This would get messy though with lots of sines, so you might want to encapsulate some of the sine tone generation stuff in an additional class.

hi there!
why not try compiling your projects from 006 download?

as far as i know, it is standalone apps…