# | User | Message | Date |
265 | Maxim | ah thanks. | 14-May-09 19:31 |
264 | Henrik | Maxim, RAMBO #4239 | 14-May-09 19:28 |
263 | Maxim | it should just set its own volumn, not the system's wave volume.. | 14-May-09 19:27 |
262 | Maxim | has anyone noticed this side-effect with rebol before? | 14-May-09 19:27 |
261 | Maxim | when it pings, my sound driver's "WAVE" slider resets to 33% >:-( | 14-May-09 19:26 |
260 | Maxim | just realized that altme (probably rebol itself..) fucks up my system volume :-( | 14-May-09 19:26 |
259 | ICarii | new version of synth almost ready - added an oscilloscope so i can see where my complex waves are not behaving .. lol | 22-Apr-09 8:16 |
258 | Anton | Oldes, 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 |
257 | Steeve | Anton, 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 |
256 | Rebolek | Steeve, 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 |
255 | Oldes | Anton: ** Script Error: cv has no value ** Where: do-parse ** Near: cv mold type-converter/c-to-rebol-map | 21-Apr-09 20:11 |
254 | Rebolek | Icarii, calculate RMS of the sound. | 21-Apr-09 17:57 |
253 | Anton | I'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.r | 21-Apr-09 15:54 |
252 | Anton | :) | 21-Apr-09 15:29 |
251 | Steeve | yep, it show a graph with some frequencies, don't remember why... | 21-Apr-09 15:29 |
250 | Anton | I see a little graph :) | 21-Apr-09 15:28 |
249 | Steeve | it's an old script Anton | 21-Apr-09 15:28 |
248 | Anton | long wave file .... crunch crunch... | 21-Apr-09 15:28 |
247 | Anton | Wow - 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 |
246 | Steeve | you have to load a wav sample | 21-Apr-09 15:24 |
245 | Steeve | *** UPLOAD at http://sites.google.com/site/rebolish/Home (see FFT.R at the end of the page) | 21-Apr-09 15:21 |
244 | Steeve | ok i upload the old demo | 21-Apr-09 15:17 |
243 | Anton | Hoho! | 21-Apr-09 15:15 |
242 | ICarii | of course - thats about a month away at the rate of my current project :) | 21-Apr-09 15:14 |
241 | Steeve | FFT = Fast fourier transform | 21-Apr-09 15:14 |
240 | ICarii | would be interesting to see one :) My next project is to decompose complex waves into sheet music :) | 21-Apr-09 15:14 |
239 | Steeve | it shows frenquencies for a sample, but i don't remember how i did that, i can post the demo | 21-Apr-09 15:13 |
238 | Anton | Steeve, what did you use it for? Just experimenting? | 21-Apr-09 15:13 |
237 | Steeve | hey guys, I have somewhere an FFT implementation in Rebol, interested ? | 21-Apr-09 15:08 |
236 | ICarii | yes - they are good for decomposing waves. very math/processor intensive though | 21-Apr-09 14:51 |
235 | Geomol | It makes me think of something called Fourier Transformations: http://en.wikipedia.org/wiki/Fourier_transform | 21-Apr-09 14:43 |
234 | ICarii | 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 | 21-Apr-09 14:41 |
233 | Anton | 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... | 21-Apr-09 14:40 |
232 | ICarii | its not strictly correct though depending on the start phase etc | 21-Apr-09 14:34 |
231 | ICarii | i cheated and used the number of waves | 21-Apr-09 14:34 |
230 | Anton | 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.. | 21-Apr-09 14:33 |
229 | Geomol | 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. | 21-Apr-09 14:33 |
228 | ICarii | sounds good - now all we need is a coding sound engineer ;) | 21-Apr-09 14:30 |
227 | Pekr | 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? | 21-Apr-09 14:26 |
226 | ICarii | yes - it is a huge time save when i go to do loudness balancing | 21-Apr-09 13:54 |
225 | Anton | So you want to calculate it in advance. | 21-Apr-09 13:54 |
224 | ICarii | sorry - wasnt very clear in my original post | 21-Apr-09 13:53 |
223 | Anton | Ok, different problem than I thought.. | 21-Apr-09 13:53 |
222 | ICarii | i am trying to find the maximum amplitude of the complex wave | 21-Apr-09 13:52 |
221 | Anton | 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. | 21-Apr-09 13:52 |
220 | ICarii | 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 | 21-Apr-09 13:24 |
219 | ICarii | noticed an Endian bug in bitrates of 16+ when saving to wav files - will fix this in next release. | 20-Apr-09 23:58 |
218 | Rebolek | Well vector has its limitations but if you try hard enough, it's usable :) | 20-Apr-09 8:49 |
217 | ICarii | i thought vector was broken? - ive been avoiding it since i heard that | 20-Apr-09 8:48 |
216 | Rebolek | it uses vector! for storing sound data | 20-Apr-09 8:47 |
215 | ICarii | ahh ok | 20-Apr-09 8:47 |
214 | Rebolek | No, just save the sound as WAV or AIFF | 20-Apr-09 8:47 |
213 | ICarii | wait ... for R3? can that do sound now? | 20-Apr-09 8:45 |
212 | ICarii | heh :) | 20-Apr-09 8:44 |
211 | Rebolek | I should have a drumsynth for R3 somewhere, I'll try to find it. | 20-Apr-09 8:44 |
210 | Rebolek | nice | 20-Apr-09 8:43 |
209 | ICarii | yes - i have an R3 synth version now that can build the wav files in the same manner as R2 | 20-Apr-09 8:41 |
208 | Rebolek | Yes it's better to have the generator totally separated from the UI. | 20-Apr-09 8:41 |
207 | ICarii | its taking me a little longer than i thought as im having to learn acoustic physics :P | 20-Apr-09 8:40 |
206 | ICarii | i am also trying to make the R3 conversion as simple as possible by keeping most of it generic | 20-Apr-09 8:37 |
205 | Rebolek | Ah, OK | 20-Apr-09 8:36 |
204 | ICarii | the next version of synth is using a top/bottom stave block with separate timings | 20-Apr-09 8:36 |
203 | ICarii | i intend to fully reproduce sheet music so the format is still a little in teh air at the moment | 20-Apr-09 8:35 |
202 | Rebolek | I think it was used in my demo pitch.green for Rebol demo contest | 20-Apr-09 8:35 |
201 | Rebolek | so it looked like 1.1.1.1 C1 0.0.1.0 1.1.2.1 D1 0.0.1.0 etc | 20-Apr-09 8:35 |
200 | Rebolek | 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. | 20-Apr-09 8:34 |
199 | ICarii | i was thinking of prebuilding and saving envelope shapes and modifying the tone like a mask | 20-Apr-09 8:32 |
198 | Rebolek | hehe :) | 20-Apr-09 8:31 |
197 | ICarii | pm-101 reminds me of an aircraft console ;) once it stops scaring me ill look more closely :) | 20-Apr-09 8:31 |
196 | Rebolek | 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. | 20-Apr-09 8:30 |
195 | ICarii | will do :) ive been looking at using piano waveforms but they require too much number crunching for rebol :( | 20-Apr-09 8:27 |
194 | Rebolek | 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 | 20-Apr-09 8:24 |
193 | Rebolek | ICarii, have a look at my PM-101 http://www.rebol.org/view-script.r?script=pm-101.r | 20-Apr-09 8:23 |
192 | ICarii | :) its getting there slowly - i really need to look at ADSR envelopes so 16bit samples dont sound so horrid :) | 20-Apr-09 7:50 |
191 | Dockimbel | Just tried synth2.r, nice work by the way. | 20-Apr-09 7:47 |
190 | ICarii | next on the list of todo's is to separate top and bottom notes and timings and add in rests. | 20-Apr-09 3:32 |
189 | ICarii | ahh 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 |
188 | Dockimbel | 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>. | 19-Apr-09 22:47 |
187 | ICarii | 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 ] ] | 19-Apr-09 22:03 |
186 | ICarii | ahh.. i should have used forskip .. never used that before | 19-Apr-09 21:45 |
185 | ICarii | hmm that works with the take/part in the forall but: loop chunksize - 1 [next ts1] may be safer? | 19-Apr-09 21:42 |
184 | ICarii | 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 ] | 19-Apr-09 21:38 |
183 | ICarii | 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. | 19-Apr-09 19:53 |
182 | Anton | Well, I've been fiddling with Tiny C Compiler - maybe it can eventually be used for fast crunching. | 19-Apr-09 13:23 |
181 | ICarii | but yes it is horribly slow. | 19-Apr-09 13:22 |
180 | ICarii | im going to port it to R3 tomorrow and rely on Call to play sounds | 19-Apr-09 13:19 |
179 | Anton | 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. | 19-Apr-09 13:18 |
178 | amacleod | Never mind just used an "if error? try [" statement.. | 16-Mar-09 19:36 |
177 | amacleod | How can you test if the sound port is already open? | 16-Mar-09 19:20 |
176 | amacleod | Maxim, It works...Thank you very much! | 16-Mar-09 18:20 |
175 | amacleod | got it thanks | 16-Mar-09 18:16 |
174 | Maxim | doh... its audacity... stupid me. | 16-Mar-09 18:16 |
173 | amacleod | Is there a web site? or an other name? | 16-Mar-09 18:12 |
172 | amacleod | I do not see it..keep getting references to a sound blaster card.. | 16-Mar-09 18:11 |
171 | amacleod | thanks | 16-Mar-09 18:09 |
170 | Maxim | doesn't even need an install :-) and it works the same on mac and linux. | 16-Mar-09 18:09 |
169 | Maxim | its the best freeware multi platform recording/editing software | 16-Mar-09 18:08 |
168 | amacleod | no I'll have a look.. | 16-Mar-09 18:08 |
167 | Maxim | did you try using audigy? | 16-Mar-09 18:08 |
166 | amacleod | I 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 |
165 | Maxim | last month... after more than a year of using it. | 16-Mar-09 18:06 |
164 | Maxim | such a bunch of idiots. I removed Vista... after it corrupted itself on bootup. | 16-Mar-09 18:05 |
163 | amacleod | yes | 16-Mar-09 18:04 |
162 | Maxim | oh, for the little mic recorder? | 16-Mar-09 18:04 |
161 | amacleod | wma only | 16-Mar-09 18:03 |
160 | amacleod | You can no longer save in .wav | 16-Mar-09 18:03 |
159 | Maxim | what do you mean they removed .wav format? | 16-Mar-09 18:03 |
158 | amacleod | I'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 |
157 | Gregg | How are you creating them Alan, and what specs? Try generic 44.1Khz stereo. | 16-Mar-09 15:17 |
156 | amacleod | Tried 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 |
155 | amacleod | i've tried several .wav recording/converting software...no change. | 16-Mar-09 3:39 |
154 | amacleod | Any 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 |
153 | Steeve | I 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 |
152 | Sunanda | Can 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 |
151 | Anton | Josh, recording ? There are only OS specific ways so far. | 24-Jun-06 9:28 |
150 | james_nak | Nice Rebolek! | 23-Jun-06 20:06 |
149 | Josh | There isn't a way to do sound input directly from rebol is there? | 23-Jun-06 19:02 |
148 | Thør | . | 4-Apr-06 19:01 |
147 | Rebolek | Oh, and the Melody button does not work too. | 2-Feb-06 20:47 |
146 | Rebolek | There'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 |
145 | Rebolek | You can change waves, adjust modulation, filter, envelopes, wave shaper, bit crusher and so on... | 2-Feb-06 20:45 |
144 | Rebolek | Then 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 |
143 | Rebolek | Anyway, 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 |
142 | Rebolek | It'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 |
141 | Rebolek | I 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 |
140 | Rebolek | :) | 18-Sep-05 20:37 |
139 | Kaj | That which we call a siren, by any other name would sound as sweet? | 18-Sep-05 19:45 |
138 | Rebolek | (don't expect that 'bell' sounds like bell, 'violin' like violin and so on. it's just a name :-) | 18-Sep-05 18:22 |
137 | Rebolek | 14 demo sounds - http://krutek.info/rebol/sounds1.zip | 18-Sep-05 18:19 |
136 | Rebolek | I've got some demo-sounds ready, I'll post them today or tomorrow. | 17-Sep-05 17:30 |
135 | Rebolek | I 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 |
134 | Volker | seems you could post some sounds now? :) | 15-Sep-05 20:25 |
133 | Rebolek | http://krutek.info/pix/PM101.png (work in progress) | 15-Sep-05 19:05 |
132 | Rebolek | BTW, WAV saver is ready, so I'll do some demo-sounds and fixes and release it ASAP ;) | 15-Sep-05 18:58 |
131 | Rebolek | It'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 |
130 | Rebolek | I'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 |
129 | Rebolek | REBOL 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 |
128 | Rebolek | Romano I think it does not depend on system version but on soundcard (or drivers probably) | 15-Sep-05 17:08 |
127 | Romano | Here 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 |
126 | Ingo | Well, whatever, sound in Rebol seems to be more or less unusable. | 15-Sep-05 16:59 |
125 | Ingo | Yes, that may be the case. | 15-Sep-05 16:59 |
124 | Rebolek | Anyway, 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 |
123 | Rebolek | Probably depends on sound hardware, because I've testing this previously and I was getting different results on my home computer and my work computer | 15-Sep-05 16:48 |
122 | Ingo | Btw, I get different values, and the stereo version plays a sound for me | 15-Sep-05 16:47 |
121 | Ingo | It seems sound data is only changed on first insert, though. | 15-Sep-05 16:47 |
120 | Pekr | the 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 |
119 | Pekr | RT'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 |
118 | Rebolek | fmod? why not. but who's going to pay the license? | 15-Sep-05 13:53 |
117 | Pekr | now 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 |
116 | Pekr | simply put, rebol sound quality and buggy behavior deserves to be put into trashcan ;-) | 15-Sep-05 13:40 |
115 | Rebolek | Another 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 |
114 | Rebolek | >> insert sound-port sample == 115000 >> sample/data == #{ 80808080808080808080808080808080808080808080807F7F7F7F7F7F7F7F7F 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F... | 15-Sep-05 9:56 |
113 | Rebolek | >> sample/data == #{ 827EA55BC53BDF21F30DFD03FE02F40CE21EC838A957867A649C43BD27D911EF 05FB02FE08F818E831CF4FB1718F817EA45BC43BDE21F20DFC03FD02F30C... | 15-Sep-05 9:56 |
112 | Rebolek | if you look at sample/data after inserting sample to sound:// they're changed | 15-Sep-05 9:49 |
111 | Rebolek | This is stereo example - plays nothing | 15-Sep-05 9:48 |
110 | Rebolek | print "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 |
109 | Rebolek | this is mono example - plays ping sound | 15-Sep-05 9:47 |
108 | Rebolek | print "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 |
107 | Rebolek | OK | 15-Sep-05 9:47 |
106 | Rebolek | Wait a minute, I'll post fixed version | 15-Sep-05 9:43 |
105 | Rebolek | I didn't test it before pasting it here | 15-Sep-05 9:43 |
104 | Rebolek | Ingo: yes there are some bugs ;) | 15-Sep-05 9:35 |
103 | Ingo | Now 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 |
102 | Ingo | Thanks Kru, I reread that part, and actually found Carl's explanation. | 15-Sep-05 9:11 |
101 | Rebolek | Ah there's bug in example, it should be "128 - val" instead of "400 - val" but that's not the problem | 15-Sep-05 8:05 |
100 | Pekr | RAMBO it! | 15-Sep-05 8:03 |
99 | Rebolek | Sound is buggy as something really buggy. | 15-Sep-05 8:02 |
98 | Rebolek | There's some strange conversion always when you play a sound. | 15-Sep-05 8:02 |
97 | Rebolek | >> sample/channels == 1 >> sample/channels: 2 == 2 >> insert sound-port sample == 199 >> sample/channels == 1 | 15-Sep-05 8:02 |
96 | Rebolek | And here's why: | 15-Sep-05 8:02 |
95 | Rebolek | The problem is that it does not work (at least here). | 15-Sep-05 8:01 |
94 | Rebolek | print "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 |
93 | Rebolek | Example based on example in Carl's sound guide: | 15-Sep-05 8:00 |
92 | Rebolek | For sound samples with two channels both channels are interleaved, i.e. samples for each channel alternate within the binary. | 15-Sep-05 7:55 |
91 | Rebolek | http://www.rebol.com/docs/sound.html#section-7 | 15-Sep-05 7:55 |
90 | Ingo | OK, is there an example anywhere that shows how to create stereo sound? So far I haven't found one. | 15-Sep-05 7:43 |
89 | Rebolek | You 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 |
88 | Ingo | When 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 |
87 | Henrik | uploaded. 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 group | 8-Sep-05 20:45 |
86 | Henrik | will see if I can upload it in a few mins. | 8-Sep-05 18:40 |
85 | Rebolek | Henrik 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 |
84 | Henrik | kru, would you mind if we use this as a VID showcase in the Wikibook? | 8-Sep-05 15:31 |
83 | Anton | Mmm.. nice picture... | 8-Sep-05 15:17 |
82 | Volker | Thanks :) 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 |
81 | Rebolek | Volker 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 |
80 | Volker | if you have something to translate to c, tell me. | 8-Sep-05 13:28 |
79 | Rebolek | But it's slow. rebcode! will be great for this | 8-Sep-05 13:27 |
78 | Rebolek | Sounds very green ;)) | 8-Sep-05 13:26 |
77 | Rebolek | two 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 |
76 | Volker | Does the sound sound "green" like this? :) | 8-Sep-05 13:24 |
75 | Geomol | That is soo cool! :-) | 8-Sep-05 13:22 |
74 | Rebolek | Volker 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 |
73 | Geomol | Moog producs: http://www.moogmusic.com/detail.php Amazing! | 23-Aug-05 10:18 |
72 | Rebolek | Bob Moog, inventor of famous synthesizers, died at age 71. Sad day for electronic music. http://www.moogmusic.com | 23-Aug-05 7:24 |
71 | Luca | Thank you, it is exactly what I was looking for. | 22-Aug-05 7:40 |
70 | Rebolek | luca: 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 |
69 | Luca | I 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 |
68 | Rebolek | If floating point is fast enough today, it's better to use FP because of resolution | 16-Aug-05 13:04 |
67 | Rebolek | I'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 |
66 | Volker | math with fpu should be comparable in speed today. i try it. | 16-Aug-05 13:03 |
65 | Rebolek | sou=so | 16-Aug-05 13:02 |
64 | Rebolek | but 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 integer | 16-Aug-05 13:01 |
63 | Rebolek | then just >>insert tail sound buffer/data | 16-Aug-05 13:00 |
62 | Rebolek | buffer: 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 |
61 | Rebolek | I'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 |
60 | Rebolek | yes there's a loop | 16-Aug-05 12:58 |
59 | Volker | Is there a loop around that? | 16-Aug-05 12:41 |
58 | Rebolek | switch-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 |
57 | Rebolek | it's just support function | 16-Aug-05 12:34 |
56 | Volker | where does switch-range come from? | 16-Aug-05 12:34 |
55 | Rebolek | with DCW you control shape of waveform. DCW-0 is sine waveform, DCW-1 is (square, saw, triangle) | 16-Aug-05 12:34 |
54 | Rebolek | and wave function - produces actual sound | 16-Aug-05 12:33 |
53 | Rebolek | basics are 'phaser function - updates oscillator phase | 16-Aug-05 12:33 |
52 | Rebolek | it supprots three different waveform (still six missing to recreate my CasioCZ ;) | 16-Aug-05 12:32 |
51 | Rebolek | PWM should be always 0.5 (it's from some older version) | 16-Aug-05 12:32 |
50 | Volker | Thats the right size to refresh my knowledge :) | 16-Aug-05 12:32 |
49 | Rebolek | right here ') | 16-Aug-05 12:31 |
48 | Rebolek | osc: 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 |
47 | Volker | where do i find it? | 16-Aug-05 12:31 |
46 | Rebolek | you can try this Phase Distortion I wrote yesterday | 16-Aug-05 12:31 |
45 | Volker | Where to start? | 16-Aug-05 12:29 |
44 | Rebolek | That should be great | 16-Aug-05 12:29 |
43 | Volker | Can i try t translate that? | 16-Aug-05 12:28 |
42 | Rebolek | I'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 REBOL | 16-Aug-05 12:28 |
41 | Rebolek | No I probably have to rewrite all my routines to C. I haven't started working on FFT at all. | 16-Aug-05 12:27 |
40 | Rebolek | but I haven't tried it yet. | 16-Aug-05 12:27 |
39 | Volker | so you only need stubs? | 16-Aug-05 12:26 |
38 | Rebolek | there's fft C library, http://www.fftw.org/ | 16-Aug-05 12:26 |
37 | Volker | i don't know the math, but i may be able to translate rebol to c. | 16-Aug-05 12:23 |
36 | Volker | that needed c-part, fft. | 16-Aug-05 12:22 |
35 | Pekr | Syntezar's? | 16-Aug-05 12:21 |
34 | Rebolek | sorry, what prototype? | 16-Aug-05 12:21 |
33 | Volker | Can you write prototype in rebol, and i try my c-skills? | 16-Aug-05 11:58 |
32 | Pekr | I 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 |
31 | Rebolek | Pekr 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 |
30 | Pekr | JIT (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 |
29 | Pekr | first 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 |
28 | Anton | (He he he....) | 16-Aug-05 7:00 |
27 | Rebolek | fast 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 |
26 | Benjamin | i 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 |
25 | Anton | But very good. Inspirational, indeed. | 15-Aug-05 16:07 |
24 | Anton | Very 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 |
23 | Rebolek | Antor if you're interested, here's a screenshot of work in progress - http://krutek.info/pix/sintezar.jpg | 15-Aug-05 15:40 |
22 | Anton | Sounds good Kru, would like to look at it when you're ready. | 15-Aug-05 15:30 |
21 | Rebolek | unfortunately 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 |
20 | Jean-François | By way of Christian's site | 15-Aug-05 2:56 |
19 | Jean-François | Here an article that could be usefull someday http://dafx04.na.infn.it/WebProc/Proc/P_201.pdf | 15-Aug-05 2:41 |
18 | Gregg | This 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 |
17 | Rebolek | yes, it's modified randomly, I've done some test but the results were different all the time so I felt lost | 27-Jun-05 10:56 |
16 | Anton | The 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 |
15 | Rebolek | coz it's really confusing me | 27-Jun-05 10:35 |
14 | Rebolek | IMO this modification - if it's needed - should be invisible to user | 27-Jun-05 10:35 |
13 | Anton | Yes, I have already found this "modification" problem. | 27-Jun-05 10:34 |
12 | Vincent | sound 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 |
11 | Rebolek | it still changes resolution to 8bit and channels to 2 | 27-Jun-05 9:03 |
10 | Rebolek | print "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 |
9 | Rebolek | I've changed example from documentation to produce 16bit sound instead of 8bit | 27-Jun-05 9:03 |
8 | Rebolek | bug probably? | 27-Jun-05 7:58 |
7 | Rebolek | I really don't understand why | 27-Jun-05 7:58 |
6 | Rebolek | wav does change after inserting into sound port | 27-Jun-05 7:58 |
5 | Rebolek | and look at debug output in console | 27-Jun-05 7:57 |
4 | Rebolek | snd: 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 |
3 | Rebolek | try following code | 27-Jun-05 7:57 |
2 | Rebolek | And here is my first problem | 27-Jun-05 7:57 |
1 | Rebolek | I've started this groub to discuss sound in REBOL | 27-Jun-05 7:57 |