REBOL3 - Sound (discussion about sound and audio implementation in REBOL [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
265Maximah thanks.14-May-09 19:31
264HenrikMaxim, RAMBO #423914-May-09 19:28
263Maximit should just set its own volumn, not the system's wave volume..14-May-09 19:27
262Maximhas anyone noticed this side-effect with rebol before?14-May-09 19:27
261Maximwhen it pings, my sound driver's "WAVE" slider resets to 33% >:-(14-May-09 19:26
260Maximjust realized that altme (probably rebol itself..) fucks up my system volume :-(14-May-09 19:26
259ICariinew version of synth almost ready - added an oscilloscope so i can see where my complex waves are not behaving .. lol22-Apr-09 8:16
258AntonOldes, thanks. Do this load-thru/update http://anton.wildit.net.au/rebol/os/make-external-library-interface.r then try again.22-Apr-09 3:47
257SteeveAnton, you asked why i had an FFT implementation... Because, i made some tests to extract frequencies from wav sounds, to be able to play sounds on an old 8bit sound chip. And also, i wanted to use FFT to make an image compressor. Geez, so much projects vanished...21-Apr-09 20:45
256RebolekSteeve, thanks for the FFT, I'm really interested. I had only DFT running for my modular synth. And maybe iFFT also, I don't remember, I hope the sources are still somewhere in deeps of the Internets.21-Apr-09 20:18
255OldesAnton: ** Script Error: cv has no value ** Where: do-parse ** Near: cv mold type-converter/c-to-rebol-map21-Apr-09 20:11
254RebolekIcarii, calculate RMS of the sound.21-Apr-09 17:57
253AntonI've got an old script which uses FMOD library to show a spectrum window in rebol while a sound is playing. It's a Windows DLL but it works in wine. do-thru http://anton.wildit.net.au/rebol/audio/fmod/play-rebol-sound.r21-Apr-09 15:54
252Anton:)21-Apr-09 15:29
251Steeveyep, it show a graph with some frequencies, don't remember why...21-Apr-09 15:29
250AntonI see a little graph :)21-Apr-09 15:28
249Steeveit's an old script Anton21-Apr-09 15:28
248Antonlong wave file .... crunch crunch...21-Apr-09 15:28
247AntonWow - first use of CP (alias of COPY) I ever saw. I override CP to be a unixiod file copy function.21-Apr-09 15:27
246Steeveyou have to load a wav sample21-Apr-09 15:24
245Steeve*** UPLOAD at http://sites.google.com/site/rebolish/Home (see FFT.R at the end of the page)21-Apr-09 15:21
244Steeveok i upload the old demo21-Apr-09 15:17
243AntonHoho!21-Apr-09 15:15
242ICariiof course - thats about a month away at the rate of my current project :)21-Apr-09 15:14
241SteeveFFT = Fast fourier transform21-Apr-09 15:14
240ICariiwould be interesting to see one :) My next project is to decompose complex waves into sheet music :)21-Apr-09 15:14
239Steeveit shows frenquencies for a sample, but i don't remember how i did that, i can post the demo21-Apr-09 15:13
238AntonSteeve, what did you use it for? Just experimenting?21-Apr-09 15:13
237Steevehey guys, I have somewhere an FFT implementation in Rebol, interested ?21-Apr-09 15:08
236ICariiyes - they are good for decomposing waves. very math/processor intensive though21-Apr-09 14:51
235GeomolIt makes me think of something called Fourier Transformations: http://en.wikipedia.org/wiki/Fourier_transform21-Apr-09 14:43
234ICariiyes - that would be nice. Ill have a hunt about see what i can find. I know a couple of sound engineers who might know21-Apr-09 14:41
233AntonAs 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...21-Apr-09 14:40
232ICariiits not strictly correct though depending on the start phase etc21-Apr-09 14:34
231ICariii cheated and used the number of waves21-Apr-09 14:34
230AntonIf 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..21-Apr-09 14:33
229GeomolThe 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.21-Apr-09 14:33
228ICariisounds good - now all we need is a coding sound engineer ;)21-Apr-09 14:30
227Pekrjust 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?21-Apr-09 14:26
226ICariiyes - it is a huge time save when i go to do loudness balancing21-Apr-09 13:54
225AntonSo you want to calculate it in advance.21-Apr-09 13:54
224ICariisorry - wasnt very clear in my original post21-Apr-09 13:53
223AntonOk, different problem than I thought..21-Apr-09 13:53
222ICariii am trying to find the maximum amplitude of the complex wave21-Apr-09 13:52
221AntonDo 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.21-Apr-09 13:52
220ICariiok - 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 too21-Apr-09 13:24
219ICariinoticed an Endian bug in bitrates of 16+ when saving to wav files - will fix this in next release.20-Apr-09 23:58
218RebolekWell vector has its limitations but if you try hard enough, it's usable :)20-Apr-09 8:49
217ICariii thought vector was broken? - ive been avoiding it since i heard that20-Apr-09 8:48
216Rebolekit uses vector! for storing sound data20-Apr-09 8:47
215ICariiahh ok20-Apr-09 8:47
214RebolekNo, just save the sound as WAV or AIFF20-Apr-09 8:47
213ICariiwait ... for R3? can that do sound now?20-Apr-09 8:45
212ICariiheh :)20-Apr-09 8:44
211RebolekI should have a drumsynth for R3 somewhere, I'll try to find it.20-Apr-09 8:44
210Reboleknice20-Apr-09 8:43
209ICariiyes - i have an R3 synth version now that can build the wav files in the same manner as R220-Apr-09 8:41
208RebolekYes it's better to have the generator totally separated from the UI.20-Apr-09 8:41
207ICariiits taking me a little longer than i thought as im having to learn acoustic physics :P20-Apr-09 8:40
206ICariii am also trying to make the R3 conversion as simple as possible by keeping most of it generic20-Apr-09 8:37
205RebolekAh, OK20-Apr-09 8:36
204ICariithe next version of synth is using a top/bottom stave block with separate timings20-Apr-09 8:36
203ICariii intend to fully reproduce sheet music so the format is still a little in teh air at the moment20-Apr-09 8:35
202RebolekI think it was used in my demo pitch.green for Rebol demo contest20-Apr-09 8:35
201Rebolekso it looked like 1.1.1.1 C1 0.0.1.0 1.1.2.1 D1 0.0.1.0 etc20-Apr-09 8:35
200RebolekI 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.20-Apr-09 8:34
199ICariii was thinking of prebuilding and saving envelope shapes and modifying the tone like a mask20-Apr-09 8:32
198Rebolekhehe :)20-Apr-09 8:31
197ICariipm-101 reminds me of an aircraft console ;) once it stops scaring me ill look more closely :)20-Apr-09 8:31
196RebolekI 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.20-Apr-09 8:30
195ICariiwill do :) ive been looking at using piano waveforms but they require too much number crunching for rebol :(20-Apr-09 8:27
194RebolekI use 8-point free envelope there (ADSR can be easily emulated using just 3 points), maybe it will be of some use for you20-Apr-09 8:24
193RebolekICarii, have a look at my PM-101 http://www.rebol.org/view-script.r?script=pm-101.r20-Apr-09 8:23
192ICarii:) its getting there slowly - i really need to look at ADSR envelopes so 16bit samples dont sound so horrid :)20-Apr-09 7:50
191DockimbelJust tried synth2.r, nice work by the way.20-Apr-09 7:47
190ICariinext on the list of todo's is to separate top and bottom notes and timings and add in rests.20-Apr-09 3:32
189ICariiahh thx - re copy - that was an artifact from the first iteration of the function where i was using take in a loop.19-Apr-09 22:51
188DockimbelTry 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>.

19-Apr-09 22:47
187ICariiinterpolate: 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 ] ]19-Apr-09 22:03
186ICariiahh.. i should have used forskip .. never used that before19-Apr-09 21:45
185ICariihmm that works with the take/part in the forall but: loop chunksize - 1 [next ts1] may be safer?19-Apr-09 21:42
184ICariiadded 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 ]19-Apr-09 21:38
183ICariiR3 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.19-Apr-09 19:53
182AntonWell, I've been fiddling with Tiny C Compiler - maybe it can eventually be used for fast crunching.19-Apr-09 13:23
181ICariibut yes it is horribly slow.19-Apr-09 13:22
180ICariiim going to port it to R3 tomorrow and rely on Call to play sounds19-Apr-09 13:19
179AntonICarii, 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.19-Apr-09 13:18
178amacleodNever mind just used an "if error? try [" statement..16-Mar-09 19:36
177amacleodHow can you test if the sound port is already open?16-Mar-09 19:20
176amacleodMaxim, It works...Thank you very much!16-Mar-09 18:20
175amacleodgot it thanks16-Mar-09 18:16
174Maximdoh... its audacity... stupid me.16-Mar-09 18:16
173amacleodIs there a web site? or an other name?16-Mar-09 18:12
172amacleodI do not see it..keep getting references to a sound blaster card..16-Mar-09 18:11
171amacleodthanks16-Mar-09 18:09
170Maximdoesn't even need an install :-) and it works the same on mac and linux.16-Mar-09 18:09
169Maximits the best freeware multi platform recording/editing software16-Mar-09 18:08
168amacleodno I'll have a look..16-Mar-09 18:08
167Maximdid you try using audigy?16-Mar-09 18:08
166amacleodI read that you could start it from teh command line and get it save in .wav but I could not get it to work..

THere are a lot of annyoing things about vista...but I have it on my wife's laptop and I'm forced to use it now and again..

16-Mar-09 18:08
165Maximlast month... after more than a year of using it.16-Mar-09 18:06
164Maximsuch a bunch of idiots. I removed Vista... after it corrupted itself on bootup.16-Mar-09 18:05
163amacleodyes16-Mar-09 18:04
162Maximoh, for the little mic recorder?16-Mar-09 18:04
161amacleodwma only16-Mar-09 18:03
160amacleodYou can no longer save in .wav16-Mar-09 18:03
159Maximwhat do you mean they removed .wav format?16-Mar-09 18:03
158amacleodI'm using windows sound recorder on XP (Ofcourse, they removed .wav format in VIsta) I just used "cd" quaity which is 44.1khz stereo Converted to 8bit also.... same problem.16-Mar-09 18:01
157GreggHow are you creating them Alan, and what specs? Try generic 44.1Khz stereo.16-Mar-09 15:17
156amacleodTried changing the sample rates, channels etc...no difference. I know you should not use compression but I'm pretty sure I'm not.16-Mar-09 3:39
155amacleodi've tried several .wav recording/converting software...no change.16-Mar-09 3:39
154amacleodAny reason I can play pre-recorded .wav files but if try to make my own they do not work:

** Access Error: Bad image data ** Where: narrate ** Near: insert sound-port load talk

16-Mar-09 3:38
153SteeveI got the data using a free MSX emulator (openMSX). The music come from the game "Auf wiedersehen Monty". You can use a "dump PSG" functionality in openMSX to get the raw data (values of the registers of the PSG). You can find lot of roms (games) for the msx wich contain cool musics and effects for the AY PSG on www.planetemu.net Beware, these roms are not freeware even if you can download them freely.

Another way (i have not tried), is to use VortexTracker at http://bulba.at.kz/ (see http://www.youtube.com/watch?v=lYdIqcqgkPM for a demo) wich is well designed to compose an manipulate raw data for the AY-* PSG. I think many samples are given too.

17-Jun-08 22:10
152SunandaCan any one help me reply to this question (received via REBOL.org's feedback form)? Thanks! << Where can I find more Hex Code like in psg-ay-3-8910-study.r Please point me to a tool that I can use for development of Sound Code for the AY-3-8910 where I end up with Hex Code that I can then load into EPROMs which would drive the AY-3-8910. Thanks for any help. http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=psg-ay-3-8910-study.r >>17-Jun-08 15:56
151AntonJosh, recording ? There are only OS specific ways so far.24-Jun-06 9:28
150james_nakNice Rebolek!23-Jun-06 20:06
149JoshThere isn't a way to do sound input directly from rebol is there?23-Jun-06 19:02
148Thør.4-Apr-06 19:01
147RebolekOh, and the Melody button does not work too.2-Feb-06 20:47
146RebolekThere's also some unfinished documentation included. Things that does not work: init sound (first button), LFO (black square button right to envelope button) and playing empty sound. That's what I remember for sure. But editing sound, creating, saving to own format and exporting to WAV works. Have fun.2-Feb-06 20:47
145RebolekYou can change waves, adjust modulation, filter, envelopes, wave shaper, bit crusher and so on...2-Feb-06 20:45
144RebolekThen press fifth button (compute sound) and wait. Press last button (play sound, looks like triangle) and it should play a sound.2-Feb-06 20:44
143RebolekAnyway, it works. In the bottom row, there are six buttons. Press second button (load sound) and go to %sounds/ directory. Select a sound and open it.2-Feb-06 20:43
142RebolekIt's pretty sub-alpha version. Some buttons do not work, some buttons crash the application. I know that so you do not have to report bugs, it's full of them.2-Feb-06 20:42
141RebolekI said I'll release Sintezar after Competition. Compo is over, so, I'm releasing it :) Download it from http://krutek.info/rebol/SintezarPM101.ZIP . Unpack it somewhere and run %sintezar_pm-101.r I hope it should work.2-Feb-06 20:41
140Rebolek:)18-Sep-05 20:37
139KajThat which we call a siren, by any other name would sound as sweet?18-Sep-05 19:45
138Rebolek(don't expect that 'bell' sounds like bell, 'violin' like violin and so on. it's just a name :-)18-Sep-05 18:22
137Rebolek14 demo sounds - http://krutek.info/rebol/sounds1.zip18-Sep-05 18:19
136RebolekI've got some demo-sounds ready, I'll post them today or tomorrow.17-Sep-05 17:30
135RebolekI said that REBOL plays sound in 22kHz/8bit, but that's not true. At least here, after some tests I'm pretty sure that it's 11kHz/8bit.17-Sep-05 17:30
134Volkerseems you could post some sounds now? :)15-Sep-05 20:25
133Rebolekhttp://krutek.info/pix/PM101.png (work in progress)15-Sep-05 19:05
132RebolekBTW, WAV saver is ready, so I'll do some demo-sounds and fixes and release it ASAP ;)15-Sep-05 18:58
131RebolekIt's really problem, but on the other hand, I can hear that Sintezar is much much better with sound than I thought on listening test done in REBOL :)15-Sep-05 18:57
130RebolekI've got some Intel chipset soundcard in work, but here at home I've got M-Audio Delta 1010LT and the results are same (sound results, sample/data looks different).15-Sep-05 18:55
129RebolekREBOL does definitely play sounds in 22kHz/8bit. You can hear the quantisation noise in low volume and everything sounds so filtered.15-Sep-05 18:54
128RebolekRomano I think it does not depend on system version but on soundcard (or drivers probably)15-Sep-05 17:08
127RomanoHere under XP and REBOL/View 1.3.1.3.1, both example (mono and stereo) work, 2 sample/data is not changed after insert.15-Sep-05 17:06
126IngoWell, whatever, sound in Rebol seems to be more or less unusable.15-Sep-05 16:59
125IngoYes, that may be the case.15-Sep-05 16:59
124RebolekAnyway, I think it's bad behaviour. The data should remain same (the can be changed internaly when playing but users must see same data).15-Sep-05 16:50
123RebolekProbably depends on sound hardware, because I've testing this previously and I was getting different results on my home computer and my work computer15-Sep-05 16:48
122IngoBtw, I get different values, and the stereo version plays a sound for me15-Sep-05 16:47
121IngoIt seems sound data is only changed on first insert, though.15-Sep-05 16:47
120Pekrthe question is - AGG for vectors, is one of two best free libraries - Cairo and AGG ... so - how is fmod quality wise? Is there any better, smaller library to have?15-Sep-05 14:06
119PekrRT's investor? :-) First I would try to talk to those folks, then to speculate about how much it will be. Maybe there is some amigan inside the group :-)15-Sep-05 14:05
118Rebolekfmod? why not. but who's going to pay the license?15-Sep-05 13:53
117Pekrnow let's convince Carl, that as AGG was good choice for vectors, we should find another library for sound. Maybe fmod?15-Sep-05 13:40
116Pekrsimply put, rebol sound quality and buggy behavior deserves to be put into trashcan ;-)15-Sep-05 13:40
115RebolekAnother thing - REBOL sounds different compared to other players. It's noisy and dull. I've got 44100Hz/16bit sound and it sound's more like 22050/8bit to my ear.15-Sep-05 12:54
114Rebolek>> insert sound-port sample == 115000 >> sample/data == #{ 80808080808080808080808080808080808080808080807F7F7F7F7F7F7F7F7F 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F...15-Sep-05 9:56
113Rebolek>> sample/data == #{ 827EA55BC53BDF21F30DFD03FE02F40CE21EC838A957867A649C43BD27D911EF 05FB02FE08F818E831CF4FB1718F817EA45BC43BDE21F20DFC03FD02F30C...15-Sep-05 9:56
112Rebolekif you look at sample/data after inserting sample to sound:// they're changed15-Sep-05 9:49
111RebolekThis is stereo example - plays nothing15-Sep-05 9:48
110Rebolekprint "Play a ping sound..." ; (init event system too)

; Generate a ping waveform as a binary value: ping: #{} for amplitude 500 1 -1 [ for phase 1 360 16 [ val: 128 + to-integer 127 * sine phase val: amplitude * val / 500 append ping to-char val append ping to-char 256 - val ] ]

; Set up the sound sample parameters: sample: make sound [ rate: 44100 / 2 channels: 2 bits: 8 volume: 0.5 data: #{} ]

; Make the ping sound 10 times: loop 10 [append sample/data ping]

; Play the sound now: sound-port: open sound:// insert sound-port sample wait sound-port close sound-port

15-Sep-05 9:47
109Rebolekthis is mono example - plays ping sound15-Sep-05 9:47
108Rebolekprint "Play a ping sound..." ; (init event system too)

; Generate a ping waveform as a binary value: ping: #{} for amplitude 500 1 -1 [ for phase 1 360 16 [ val: 128 + to-integer 127 * sine phase val: amplitude * val / 500 append ping to-char val ;append ping to-char 256 - val ] ]

; Set up the sound sample parameters: sample: make sound [ rate: 44100 / 2 channels: 1 bits: 8 volume: 0.5 data: #{} ]

; Make the ping sound 10 times: loop 10 [append sample/data ping]

; Play the sound now: sound-port: open sound:// insert sound-port sample wait sound-port close sound-port

15-Sep-05 9:47
107RebolekOK15-Sep-05 9:47
106RebolekWait a minute, I'll post fixed version15-Sep-05 9:43
105RebolekI didn't test it before pasting it here15-Sep-05 9:43
104RebolekIngo: yes there are some bugs ;)15-Sep-05 9:35
103IngoNow that's interesting ... if I paste your example into a console, I get a very short high beep if I paste it into a script and do the script, I get a math error! (Math or number overflow)15-Sep-05 9:14
102IngoThanks Kru, I reread that part, and actually found Carl's explanation.15-Sep-05 9:11
101RebolekAh there's bug in example, it should be "128 - val" instead of "400 - val" but that's not the problem15-Sep-05 8:05
100PekrRAMBO it!15-Sep-05 8:03
99RebolekSound is buggy as something really buggy.15-Sep-05 8:02
98RebolekThere's some strange conversion always when you play a sound.15-Sep-05 8:02
97Rebolek>> sample/channels == 1 >> sample/channels: 2 == 2 >> insert sound-port sample == 199 >> sample/channels == 115-Sep-05 8:02
96RebolekAnd here's why:15-Sep-05 8:02
95RebolekThe problem is that it does not work (at least here).15-Sep-05 8:01
94Rebolekprint "Generating sound..." bounceL: #{} bounceR: #{} repeat modulate 20 [ delta: negate log-2 modulate for amplitude 400 1 delta [ for phase 1 360 16 [ val: 128 + to-integer 127 * sine phase val: amplitude * val / 400 append bounceL to-char val append bounceL to-char 400 - val ] ] ]

bounce: #{} repeat i 400 [ insert tail bounce bounceL/:i insert tail bounce bounceR/:i ]

; Set up the sound sample parameters: sample: make sound [ rate: 44100 / 2 channels: 2 bits: 8 volume: 0.5 data: bounce ]

; Play the sound now: sound-port: open sound:// insert sound-port sample wait sound-port close sound-port

15-Sep-05 8:00
93RebolekExample based on example in Carl's sound guide:15-Sep-05 8:00
92RebolekFor sound samples with two channels both channels are interleaved, i.e. samples for each channel alternate within the binary.15-Sep-05 7:55
91Rebolekhttp://www.rebol.com/docs/sound.html#section-715-Sep-05 7:55
90IngoOK, is there an example anywhere that shows how to create stereo sound? So far I haven't found one.15-Sep-05 7:43
89RebolekYou must create sound with stereo effect. Once you insert something to sound:// you lost control and cannot change even the volume.15-Sep-05 6:44
88IngoWhen I create a sound using Rebol, with 2 channels, is it possible to access the to channels independently? So as to create a stereo effect?14-Sep-05 22:07
87Henrikuploaded. if you get a new version with a new screenshot, you can upload it yourself, but you need an account to upload images... otherwise throw the link in the wikibook group8-Sep-05 20:45
86Henrikwill see if I can upload it in a few mins.8-Sep-05 18:40
85RebolekHenrik why not. But the GUI is not 100% finished so I hope it can be later replaced with better picture.8-Sep-05 18:38
84Henrikkru, would you mind if we use this as a VID showcase in the Wikibook?8-Sep-05 15:31
83AntonMmm.. nice picture...8-Sep-05 15:17
82VolkerThanks :) maybe if you make it ready for c, i could do the rest. means make it use structures, not relying on contexts etc. for the time-critical things.8-Sep-05 13:31
81RebolekVolker lot of things, really :) I'd like to finish features mentioned above and then translate all computations to C. I'll let you now, thank you.8-Sep-05 13:29
80Volkerif you have something to translate to c, tell me.8-Sep-05 13:28
79RebolekBut it's slow. rebcode! will be great for this8-Sep-05 13:27
78RebolekSounds very green ;))8-Sep-05 13:26
77Rebolektwo or three things still missing: WAV saver, Vibrato and probably something else. At least WAV saver must be finished before release.8-Sep-05 13:26
76VolkerDoes the sound sound "green" like this? :)8-Sep-05 13:24
75GeomolThat is soo cool! :-)8-Sep-05 13:22
74RebolekVolker so you're interested what's possible with better sound? Me too. But I can tell you, what is possible with today's sound. This - http://krutek.info/pix/pdsynth.png ;)))8-Sep-05 13:17
73GeomolMoog producs: http://www.moogmusic.com/detail.php Amazing!23-Aug-05 10:18
72RebolekBob Moog, inventor of famous synthesizers, died at age 71. Sad day for electronic music. http://www.moogmusic.com23-Aug-05 7:24
71LucaThank you, it is exactly what I was looking for.22-Aug-05 7:40
70Rebolekluca: take a look at http://www.rebol.com/docs/sound.html , it's googd start. there are examples how to synthetize simple sine wavew and how to apply some envelope on it.22-Aug-05 6:12
69LucaI know Rebol quite well but I don't know music. Can anybody point me to a white paper/tutorial/newbie docs/samples that explains how to valorize sound/data to play some notes? Thank you.21-Aug-05 20:05
68RebolekIf floating point is fast enough today, it's better to use FP because of resolution16-Aug-05 13:04
67RebolekI'm using this code (and I really hope there's some better solution): >> insert tail sample do rejoin ["#{" skip to-hex to integer! (sample-value + 1) * 32767.5 4 "}"]16-Aug-05 13:03
66Volkermath with fpu should be comparable in speed today. i try it.16-Aug-05 13:03
65Reboleksou=so16-Aug-05 13:02
64Rebolekbut because there's no difference in speed of integer and FP math in REBOL, everything is done in FP sou it's needed to convert FP to 16-bit integer16-Aug-05 13:01
63Rebolekthen just >>insert tail sound buffer/data16-Aug-05 13:00
62Rebolekbuffer: context [ length: 256 data: make block! length init: does [ data: make block! length ] fill: func [fnc][ init loop length [ insert tail data do fnc data ] ] ]16-Aug-05 13:00
61RebolekI'm filling a buffer of 256 bytes so I can change parametres in realtime (buffer is filled, GUI works again, I can fiddle with knobs) and then I add buffer's content to some sound [block!]16-Aug-05 13:00
60Rebolekyes there's a loop16-Aug-05 12:58
59VolkerIs there a loop around that?16-Aug-05 12:41
58Rebolekswitch-range: func [number blk][ foreach [rfrom rto action] blk [ if not number? rfrom [rfrom: get rfrom] if not number? rto [rto: get rto] if all [number >= rfrom number < rto][return do action] ] ]16-Aug-05 12:35
57Rebolekit's just support function16-Aug-05 12:34
56Volkerwhere does switch-range come from?16-Aug-05 12:34
55Rebolekwith DCW you control shape of waveform. DCW-0 is sine waveform, DCW-1 is (square, saw, triangle)16-Aug-05 12:34
54Rebolekand wave function - produces actual sound16-Aug-05 12:33
53Rebolekbasics are 'phaser function - updates oscillator phase16-Aug-05 12:33
52Rebolekit supprots three different waveform (still six missing to recreate my CasioCZ ;)16-Aug-05 12:32
51RebolekPWM should be always 0.5 (it's from some older version)16-Aug-05 12:32
50VolkerThats the right size to refresh my knowledge :)16-Aug-05 12:32
49Rebolekright here ')16-Aug-05 12:31
48Rebolekosc: context [ phase: 0 AM: 1 ;Amplitude modulation PWM: 0.5 ;Pulse width modulation DCW: .5 ; phase transition between sine and other wave [0 - 1] wave-length: 400 ;wave-length is sample-rate / frequency - don't wanna have samplerate here algorithms: [ saw [ d: (1 - dcw) / 2 cosine 360 * switch-range ph [ 0 d [ph * (pwm / d)] d 1 [(ph - d / (1 - d)) * pwm + pwm] ] ] square [ d: 1 / max 1e-50 (1 - dcw) cosine 360 * switch-range ph reduce [ 0 .25 [ph * 4 ** d / 4] .25 .5 [(abs ph - .5) * 4 ** d / 4 + .5] .5 .75 [ph * 4 - 2 ** d / 4 + .5] .75 1 [(abs ph - 1) * 4 ** d / 4 + 1] ] ] triangle [ ;triangle is d~.588888 d: 1 - (dcw * .41111) ;1 / max 1e-50 (1 - dcw) cosine 360 * switch-range ph reduce [ 0 .25 [ph * 4 ** d / 4] .25 .5 [(abs ph - .5) * 4 ** d / 4 + .5] .5 .75 [ph * 4 - 2 ** d / 4 + .5] .75 1 [(abs ph - 1) * 4 ** d / 4 + 1] ] ] ] algorithm: 'saw curves: copy [] forskip algorithms 2 [append curves to string! algorithms/1] phaser: func [][ phase-per-byte: 1 / wave-length phase: phase + phase-per-byte if phase > 1 [phase: phase - 1] phase ] wave: func [ ][ ph: phaser do select algorithms algorithm ]16-Aug-05 12:31
47Volkerwhere do i find it?16-Aug-05 12:31
46Rebolekyou can try this Phase Distortion I wrote yesterday16-Aug-05 12:31
45VolkerWhere to start?16-Aug-05 12:29
44RebolekThat should be great16-Aug-05 12:29
43VolkerCan i try t translate that?16-Aug-05 12:28
42RebolekI've got phase-distortion oscillator, FM oscillator, wavetable oscillator and my exponential oscillaor plus four types of filters and it's really time consuming in REBOL16-Aug-05 12:28
41RebolekNo I probably have to rewrite all my routines to C. I haven't started working on FFT at all.16-Aug-05 12:27
40Rebolekbut I haven't tried it yet.16-Aug-05 12:27
39Volkerso you only need stubs?16-Aug-05 12:26
38Rebolekthere's fft C library, http://www.fftw.org/16-Aug-05 12:26
37Volkeri don't know the math, but i may be able to translate rebol to c.16-Aug-05 12:23
36Volkerthat needed c-part, fft.16-Aug-05 12:22
35PekrSyntezar's?16-Aug-05 12:21
34Reboleksorry, what prototype?16-Aug-05 12:21
33VolkerCan you write prototype in rebol, and i try my c-skills?16-Aug-05 11:58
32PekrI worked with image data in external library, was not all that difficult. Forget C ++, use C. But then - image data is just repetitive pattern of RGBA values, so maybe working with sound data will be much more difficult ...16-Aug-05 8:13
31RebolekPekr yes, external library call can solve it (partially). I have to install some C/C++ SDK and start to learn it again...16-Aug-05 8:00
30PekrJIT (VM) for some specific tasks could be sufficient too, but we can only hope here. The only realistical thing is to use what we have now - other tool than REBOL ;-), or library calls ....16-Aug-05 7:31
29Pekrfirst comes faster CPUs :-) What about producing language extension? Ah, we did not get any yet, sorry, I forgot, it is long time we were promissed to get those ;-) Hmm, but what about external library calls? Could do the trick, no? If you use gcc, you should be able to compile for main platforms at least ...16-Aug-05 7:30
28Anton(He he he....)16-Aug-05 7:00
27Rebolekfast fourier transformation. no way in current rebol (to much computations). On my Athlon XP 1700+ can REBOL do some 3milions computations in second (this is very aproximate number, some computaions are more time-consuming than other ). May sound like a big number, but if sound's sample rate is 44100Hz, there's only some 70 computations for each sample. And this is the ideal situation (no GUI and other CPU-demanding stuff). So there are two possibilities. 1) Some faster math, or JIT REBOL compiler and 2) wait for faster CPU's. Let's see what comes first.16-Aug-05 6:45
26Benjamini love those fancy bars from winamp or wmp how they do that ? how they get the khz and hz and all that from the wav file ? suposing it is a wav ... (raw or pcm)16-Aug-05 3:34
25AntonBut very good. Inspirational, indeed.15-Aug-05 16:07
24AntonVery nice looking ! May I criticise your knobs though ? They are a bit big. Before long, you won't have any room left ! :) I suggest make them half the size in width and height.15-Aug-05 16:05
23RebolekAntor if you're interested, here's a screenshot of work in progress - http://krutek.info/pix/sintezar.jpg15-Aug-05 15:40
22AntonSounds good Kru, would like to look at it when you're ready.15-Aug-05 15:30
21Rebolekunfortunately there's missing page 2 in the document. however if anybody is interested in synthesis, next version of sintezar is going to have five different oscilators, four filters, three waveshapers (these units are ready now) plus some other units (phaser is ready, i'm working on delay). I wrote some basic sequencer last week, so only some preset management system is missing and some work on GUI (drag and drop for connecting modules is ready, but I still have to rewrite all modules to support it)15-Aug-05 13:58
20Jean-FrançoisBy way of Christian's site15-Aug-05 2:56
19Jean-FrançoisHere an article that could be usefull someday http://dafx04.na.infn.it/WebProc/Proc/P_201.pdf15-Aug-05 2:41
18GreggThis is a known issue. RT wants to address sound at some point, but I'm not sure where it falls in the priority queue.27-Jun-05 19:54
17Rebolekyes, it's modified randomly, I've done some test but the results were different all the time so I felt lost27-Jun-05 10:56
16AntonThe modification keeps happening, if you play different samples alternately, each sample is modified randomly, converted to a random mode. Gradually the sample becomes noisy due to rounding errors in the conversions.27-Jun-05 10:40
15Rebolekcoz it's really confusing me27-Jun-05 10:35
14RebolekIMO this modification - if it's needed - should be invisible to user27-Jun-05 10:35
13AntonYes, I have already found this "modification" problem.27-Jun-05 10:34
12Vincentsound has a lot of problems: the .wav data source is modified at loading a low-q sample seems to force a permanent low-q to all successive samples samples are adapted (=modified) to audio capabilities at first use, if 'rate or 'bits are not the default values.

the only way to play samples without these problems is to: - open the sound port - insert a copy of the sample/sound object - close the port for each sound.

27-Jun-05 10:23
11Rebolekit still changes resolution to 8bit and channels to 227-Jun-05 9:03
10Rebolekprint "Play a simple tone..." ; (init event system too)

; Generate a sine wave tone (1 cycle of the wave): tone: #{} for phase 1 360 6 [ val: 32768 + to-integer 32767 * sine phase repend tone [to char! to integer! val / 256 to char! to integer! val // 256] ]

; Set up the sound sample parameters: sample: make sound [ rate: 44100 channels: 1 bits: 16 volume: 0.5 data: #{} ]

; Repeat the sine wave for 1000 cycles: loop 1000 [append sample/data tone]

; Play the tone now: ? sample sound-port: open sound:// insert sound-port sample ? sample wait sound-port close sound-port

27-Jun-05 9:03
9RebolekI've changed example from documentation to produce 16bit sound instead of 8bit27-Jun-05 9:03
8Rebolekbug probably?27-Jun-05 7:58
7RebolekI really don't understand why27-Jun-05 7:58
6Rebolekwav does change after inserting into sound port27-Jun-05 7:58
5Rebolekand look at debug output in console27-Jun-05 7:57
4Reboleksnd: load http://krutek.info/rebol/sound.r

view layout [ button "play" [ wav: make sound [rate: 22050 data: snd] print "make wav" ? wav sndport: open sound:// insert sndport wav print "insert sound" ? wav close sndport ] ]

27-Jun-05 7:57
3Rebolektry following code27-Jun-05 7:57
2RebolekAnd here is my first problem27-Jun-05 7:57
1RebolekI've started this groub to discuss sound in REBOL27-Jun-05 7:57

Return to Index Page