0
0

How would one go about generating a tone for a given frequency? For example, given 1100, it would generate a tone at 1100hz. Thanks!

  • You must to post comments
0
0

You could use cooledit. I think even the demo version will let you do this and save as wavs.

If you are looking for something realtime, I dont know…

-Thorrin

  • You must to post comments
0
0

Yeah, I need to create it in real time.

  • You must to post comments
0
0

Possible to create a sequence, then write directly to it in memory? Might that work? If so, how?

  • You must to post comments
0
0

I was working on it with my tool, but because of other constraint I decided to create a sample in memory and play it after calculation.
but in my first attempt it was in realtime, you can check in your demo exemple of Fmod, there is a simple stream exemple. Just follow it and when inside the stream creator, calculate your sinus at the choosen frequency :smile:, it will play it realtime, and in loop.

regards
Lemon

  • You must to post comments
0
0

Hm, I don’t see any actual synthesis of a sound, just the loading. I could write to the buffer, I guess, but in what format is the data stored?

  • You must to post comments
0
0

Thanks!

  • You must to post comments
0
0

My code doesn’t work. :sad:
[code:eleveqng]

include <stdio.h>

include <math.h>

include <wincompat.h>

include <fmod.h>

include <fmod_errors.h>

include <conio.h>

signed char streamcallback(FSOUND_STREAM *stream, void *buff, int len, int param)
{
int count;
signed short *stereo16bitbuffer = (signed short *)buff;

for (count=0; count&lt;len&gt;&gt;2; count++)       // &gt;&gt;2 = 16bit stereo (4 bytes per sample)
{
    *stereo16bitbuffer++ = (signed short)(sin(1700));   // left channel
    *stereo16bitbuffer++ = (signed short)(sin(1700));   // right channel
}

return 1;

}

int main (int argc, char **argv) {
FSOUND_STREAM *stream;

FSOUND_SetOutput (FSOUND_OUTPUT_DSOUND);
FSOUND_SetDriver (2);

if (!FSOUND_Init(44100, 16, 0)) {
    printf (&quot;error w/ init()n&quot;);
}

stream = FSOUND_Stream_Create(streamcallback, 10000*2*2, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 22050, 12345);

if (!stream) {
    printf (&quot;error w/ streamn&quot;);
}

FSOUND_Stream_Play(FSOUND_FREE, stream);

getch ();

FSOUND_Stream_Close (stream);

FSOUND_Close ();

return 0;

}
[/code:eleveqng]
It should play a tone of 1700hz. It plays nothing.

<font size=-1>[ This Message was edited by: schnarf on 2002-03-06 19:16 ]</font>

  • You must to post comments
0
0

Hm, I still get no sound.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.