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
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 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 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