But these examples are either not very well documented, or I just dont understand enough it.

I am working on a project at the university, where we are designing a framework to use SunSPOTS to send data from the built-in accelerometer to control frequencies by hand movement (the SunSPOTS being placed ont he user's hands) and thereby changing the fequency. But I need to start off somewhere, and that would be to actually make a JAVA Sine Wave Oscillator.

I have also been looking at the jmusic page a lot, but it seems that they are working from a lot of classes that you need to download and install before you can use their examples, and for some reason I cannot get those installations to work on my computer. Do you know if there are any ways to make a similar oscillator using the javax.sound library? Or is that pretty much what they did in the other example I linked to?

May I know what do you mean by "make a similar oscillator "?Do you want to generate sound output dynamically at run time?I did something like that more than 10 years ago (before javax.sound was available), please check out Fourier Synthesis. I learned it from some code available on the web at that time.The source code for that applet I have created is available,too! But I did not work on similar topic for a long time.Your links provide a lot of useful information. (I checked out those pagaes, but I did not have time to study or test it).

The oscillator I want to make, should be able to change frequencies when the program is running.

Combined with the SunSPOTS, we want to use the built-in accelerometer to measure how far the users hand has traveled on the x-direction for example, and that number will be fed into the oscillator and then play the frequency of that number. So if the users movements totals a value of 560, then the program and the oscillator will play a continuous note at 560 Hz untill the user again moves the hand.

I saw this topic a while ago, when I tried to create my function generator from the scratch. Now I finally managed to output some noise on the PC soundcard output.. Thanks a lot, I surely couldn't have managed without this thread, as I found this description the best among the tutorials on the web in the topic. Yet I have a final issue that I can't really solve:How can you ensure, that the audio buffer receives continuos stream? There's this cruicial part in the code: Stop(); calc(); Play(); with which the playback is highly fragmented. I use a 2000 sample buffer, tried with 20.000 samples, same results, only the continuos parts were longer...Any help would be highly appreciated!

Instead of using only some methods of yours I used the whole class, so that I heard the sound continuously Great! ^^Now I am just wondering why the physical limit of it is around 2660 Hz? Not sure of which of its properties limiting it at that certain value. Is it because of its digital resolution?I tried to double "UNIT" and half the frequency, and I could raise the higher limit a tiny bit, but I couldn't succeed in the end.. I could see that in your example the top frequency is 1000Hz. Was it because of the same reason?

I think I could find the problem As we know it, increasing a wave's frequency means decreasing in wavelength. As lambda=1/frequency, when reaching 2kHz the wave's period shortens to the size of only 4 samples, which I think can not be considered as a sine wave anymore, but more like a triangular wave or so... This phenomenon occured, because of the small size of the sampling rate. You chose 8000 samples for sample rate.I've been looking for the sun.audio & sun.audio.AudioPlayer APIs but could not find my way to change it to 44kHz. May I ask you, why you chose 8000 samples? How did you know, that this should be the exact sample rate? Or what documentation have you followed when creating your code?