 |
Author |
Topic: sound and browser (Read 338 times) |
|
Dara

|
sound and browser
« on: Dec 15th, 2003, 5:53am » |
|
hi, this sounds totally different in browser and i don't know why... BSound X; int N = 12000; float notes[] = { 20.0, 19.0, 18.0, 23.0, 20.0, 19.0, 18.0, 22.3, 20.0, 19.0, 18.0, 23.0, 20.0, 19.0, 18.0, 23.0, 20.0, 19.0, 18.0, 23.0, 20.0, 16.5, 18.0, 23.0, 20.0, 19.0, 18.0, 23.0, 20.0, 19.0, 18.0, 6.0}; int note = 0; void setup() { size(400, 400); background(#FF6600); //why orange? X = new BSound(N); } void loop() { for (int n=0; n<N; n++) { X.samples[n] = int(64*sin((PI/N)*float(n))); //original signal X.samples[n] *= sin(float(n*PI/float(notes[note%notes.length]))); //add notes X.samples[(n*mouseX)%N] += 0.2*sin(PI/(mouseY/190)*n); // add noise } note++; repeat(X); } help!
|
« Last Edit: Dec 15th, 2003, 11:58pm by Dara » |
|
|
|
|
Dara

|
Re: sound and browser
« Reply #1 on: Dec 15th, 2003, 9:05pm » |
|
i have installed sun's java. now it works.
|
|
|
|
mm Guest

|
Re: sound and browser
« Reply #2 on: Mar 22nd, 2004, 3:17am » |
|
additional audio info western notation scale Code: String[] names = { "A", "Bb", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G" }; float[] frequencies = { 440, 466.16, 493.88, 523.25, 554.37, 587.33, 622.25, 659.26, 698.26, 739.99, 783.99 }; |
|
|
|
|
|
elvis Guest

|
Re: sound and browser
« Reply #3 on: Mar 23rd, 2004, 3:25am » |
|
more crap Code: // Western Music in a Nutshell // by Madmerv ; adaptation of original applet by Dara BSound X; int N = 44100; // 44.1khz String[] names = { "A", "Bb", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G" }; float[] freq = { 440, 466.16, 493.88, 523.25, 554.37, 587.33, 622.25, 659.26, 698.26, 739.99, 783.99 }; int note = 0; int octave = 1; void setup() { size(freq.length^2, freq.length^2); for ( int o = 1; o < freq.length; o++ ) { for ( int j = 0; j < freq.length; j++ ) { fill(50+j*(freq.length)); rect(j*freq.length,o*freq.length, j*freq.length+(freq.length), width); } } X = new BSound(N); } void mousePressed() { note = (mouseX/freq.length); octave = (mouseY/freq.length); println("Note: "+names[note]+" Octave: "+octave+"/" +freq.length+" Frequency: " +freq[note]*octave+" Mouse(x,y): "+mouseX+","+mouseY); for (int n=0; n<N; n++) { X.samples[n] = int(64*sin((PI/N)*float(n))); //original signal X.samples[n] *= sin(float(n*PI/float((freq[note]*octave)))); //add notes //X.samples[(n*mouseX)%N] += 0.2*sin(PI/(mouseY/190)*n); // add noise } play(X); } void loop() {} |
|
|
|
|
|
|