World: r3wp
[Sound] discussion about sound and audio implementation in REBOL
older newer | first last |
amacleod 16-Mar-2009 [177x2] | How can you test if the sound port is already open? |
Never mind just used an "if error? try [" statement.. | |
Anton 19-Apr-2009 [179] | ICarii, I just quickly tried your synth2.r. It plays the song here on Linux, and matches the score. I wonder, though, how you are going to scale the program. Rebol's sound port is currently underpowered, and Rebol isn't fast at number crunching which is necessary for audio work. I don't like the idea of waiting for hours for a full song to render.. I would be looking for an audio processing system to hook into rebol. |
ICarii 19-Apr-2009 [180x2] | im going to port it to R3 tomorrow and rely on Call to play sounds |
but yes it is horribly slow. | |
Anton 19-Apr-2009 [182] | Well, I've been fiddling with Tiny C Compiler - maybe it can eventually be used for fast crunching. |
ICarii 19-Apr-2009 [183x5] | R3 build-song speed (without optimization) plus write to disk is 1810ms vs R2 of 2862ms. So even without optimizing in R3 there is a large difference in performance. |
added an interpolate function for dual channel sound and works fine :) still slow on initial build though :( interpolate: func [series1 series2 chunksize /local ts1 ts2 c][ ts1: copy series1 ts2: copy series2 c: copy #{} forall ts1 [ insert tail c copy/part ts1 chunksize insert tail c copy/part at ts2 index? ts1 chunksize take/part ts1 chunksize - 1 ] c ] | |
hmm that works with the take/part in the forall but: loop chunksize - 1 [next ts1] may be safer? | |
ahh.. i should have used forskip .. never used that before | |
interpolate: func [series1 series2 chunksize /local ts1 ts2 c][ ts1: copy series1 ts2: copy series2 c: copy #{} forskip ts1 chunksize [ insert tail c copy/part ts1 chunksize insert tail c copy/part at ts2 index? ts1 chunksize ] ] | |
Dockimbel 19-Apr-2009 [188] | Try with : interpolate: func [series1 series2 chunksize /local ts1 ts2 c][ ts1: copy series1 ts2: copy series2 c: copy #{} forskip ts1 chunksize [ insert/part tail c ts1 chunksize insert/part tail c at ts2 index? ts1 chunksize ] ] Why do you copy the 2 series? It's not required here, you're not modifying them. You should also pre-allocate the 'c buffer : c: make binary! <max-size>. |
ICarii 19-Apr-2009 [189x2] | ahh thx - re copy - that was an artifact from the first iteration of the function where i was using take in a loop. |
next on the list of todo's is to separate top and bottom notes and timings and add in rests. | |
Dockimbel 20-Apr-2009 [191] | Just tried synth2.r, nice work by the way. |
ICarii 20-Apr-2009 [192] | :) its getting there slowly - i really need to look at ADSR envelopes so 16bit samples dont sound so horrid :) |
Rebolek 20-Apr-2009 [193x2] | ICarii, have a look at my PM-101 http://www.rebol.org/view-script.r?script=pm-101.r |
I use 8-point free envelope there (ADSR can be easily emulated using just 3 points), maybe it will be of some use for you | |
ICarii 20-Apr-2009 [195] | will do :) ive been looking at using piano waveforms but they require too much number crunching for rebol :( |
Rebolek 20-Apr-2009 [196] | I was compiling the math functions to C and the result was about 5-10x faster (not optimalized), but I cannot find that code right now. |
ICarii 20-Apr-2009 [197] | pm-101 reminds me of an aircraft console ;) once it stops scaring me ill look more closely :) |
Rebolek 20-Apr-2009 [198] | hehe :) |
ICarii 20-Apr-2009 [199] | i was thinking of prebuilding and saving envelope shapes and modifying the tone like a mask |
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 |
older newer | first last |