World: r3wp
[Sound] discussion about sound and audio implementation in REBOL
older newer | first last |
Rebolek 20-Apr-2009 [200x3] | I was also working on tracker-like program (not published). I had a simple format for notes there that was similar to sequencers - I was using tuple! for timing information, it may be better than having two blocks, one for notes and one for timing. |
so it looked like 1.1.1.1 C1 0.0.1.0 1.1.2.1 D1 0.0.1.0 etc | |
I think it was used in my demo pitch.green for Rebol demo contest | |
ICarii 20-Apr-2009 [203x2] | i intend to fully reproduce sheet music so the format is still a little in teh air at the moment |
the next version of synth is using a top/bottom stave block with separate timings | |
Rebolek 20-Apr-2009 [205] | Ah, OK |
ICarii 20-Apr-2009 [206x2] | i am also trying to make the R3 conversion as simple as possible by keeping most of it generic |
its taking me a little longer than i thought as im having to learn acoustic physics :P | |
Rebolek 20-Apr-2009 [208] | Yes it's better to have the generator totally separated from the UI. |
ICarii 20-Apr-2009 [209] | yes - i have an R3 synth version now that can build the wav files in the same manner as R2 |
Rebolek 20-Apr-2009 [210x2] | nice |
I should have a drumsynth for R3 somewhere, I'll try to find it. | |
ICarii 20-Apr-2009 [212x2] | heh :) |
wait ... for R3? can that do sound now? | |
Rebolek 20-Apr-2009 [214] | No, just save the sound as WAV or AIFF |
ICarii 20-Apr-2009 [215] | ahh ok |
Rebolek 20-Apr-2009 [216] | it uses vector! for storing sound data |
ICarii 20-Apr-2009 [217] | i thought vector was broken? - ive been avoiding it since i heard that |
Rebolek 20-Apr-2009 [218] | Well vector has its limitations but if you try hard enough, it's usable :) |
ICarii 20-Apr-2009 [219] | noticed an Endian bug in bitrates of 16+ when saving to wav files - will fix this in next release. |
ICarii 21-Apr-2009 [220] | ok - im trying to calc the optimal intersection point where 3 different frequency sine waves create the highest complex wave - w1: freq 440.0Hz w2: freq 530.0Hz w3: freq 720.0Hz i was using: sine (90 * w2 / w3) + sine (90 * w1 / w3) + 1.0 this was under the assumption that the greatest cumulative distance from 0 would be at the 90degree mark from the highest freq wave - unfortunately this is not the case :( does anyone have a nice (or not too nasty) formula that will find the optimum value? - i will post this in maths too |
Anton 21-Apr-2009 [221] | Do you mean you are trying to find the repeating period of the three sine waves, once they are combined ? I think that means finding the lowest common denominator. |
ICarii 21-Apr-2009 [222] | i am trying to find the maximum amplitude of the complex wave |
Anton 21-Apr-2009 [223] | Ok, different problem than I thought.. |
ICarii 21-Apr-2009 [224] | sorry - wasnt very clear in my original post |
Anton 21-Apr-2009 [225] | So you want to calculate it in advance. |
ICarii 21-Apr-2009 [226] | yes - it is a huge time save when i go to do loudness balancing |
Pekr 21-Apr-2009 [227] | just a note to Sound. Some time ago, when Cyphre tried to do media player in REBOL for us, he complained about some bugs in smooth playback. Carl released C code for the sound system in REBOL - this is some 2 - 3 pages of C code (mostly wrappers) IIRC? Maybe we could fix few things for next R2 release? |
ICarii 21-Apr-2009 [228] | sounds good - now all we need is a coding sound engineer ;) |
Geomol 21-Apr-2009 [229] | The max amplitude, you find, depends on how long you play the sound, doesn't it? If you play it long enough, you might get max for each of the sin added together, which is 3. |
Anton 21-Apr-2009 [230] | If your 3 waves happen to peak all at the same time, then the maximum amplitude is simply the addition of all three amplitudes. If not, then the max amplitude is some lesser value. Calculating this seems complicated to me.. |
ICarii 21-Apr-2009 [231x2] | i cheated and used the number of waves |
its not strictly correct though depending on the start phase etc | |
Anton 21-Apr-2009 [233] | As you add together a larger number of waves, you will find the maximum amplitude is typically much less than the total of all the wave amplitudes. It might be easier to generate all the samples of the complex wave (using decimal!/float), keeping track of the maximum value, then scaling it to 8 or 16 bit integers afterwards. It would be nice to have a precise mathematical way of calculating the maximum peak values in advance, though... |
ICarii 21-Apr-2009 [234] | yes - that would be nice. Ill have a hunt about see what i can find. I know a couple of sound engineers who might know |
Geomol 21-Apr-2009 [235] | It makes me think of something called Fourier Transformations: http://en.wikipedia.org/wiki/Fourier_transform |
ICarii 21-Apr-2009 [236] | yes - they are good for decomposing waves. very math/processor intensive though |
Steeve 21-Apr-2009 [237] | hey guys, I have somewhere an FFT implementation in Rebol, interested ? |
Anton 21-Apr-2009 [238] | Steeve, what did you use it for? Just experimenting? |
Steeve 21-Apr-2009 [239] | it shows frenquencies for a sample, but i don't remember how i did that, i can post the demo |
ICarii 21-Apr-2009 [240] | would be interesting to see one :) My next project is to decompose complex waves into sheet music :) |
Steeve 21-Apr-2009 [241] | FFT = Fast fourier transform |
ICarii 21-Apr-2009 [242] | of course - thats about a month away at the rate of my current project :) |
Anton 21-Apr-2009 [243] | Hoho! |
Steeve 21-Apr-2009 [244x3] | ok i upload the old demo |
*** UPLOAD at http://sites.google.com/site/rebolish/Home (see FFT.R at the end of the page) | |
you have to load a wav sample | |
Anton 21-Apr-2009 [247x2] | Wow - first use of CP (alias of COPY) I ever saw. I override CP to be a unixiod file copy function. |
long wave file .... crunch crunch... | |
Steeve 21-Apr-2009 [249] | it's an old script Anton |
older newer | first last |