[Csnd] Another newbie question regarding random read of table
Date | 2022-08-24 21:14 |
From | Scott Daughtrey |
Subject | [Csnd] Another newbie question regarding random read of table |
I'm going thru Chapter 3 of the FLOSS manual, working on 03D (Function Tables). I decided to revisit a previous ex. from the manual (01D13) as I have a little better understanding now. Line 26 reads: iNote table rnd(1),giNotes,1 I understand that the table index is being read as normalized due to the final "1" being the index data mode. If it is altered to 0 it now reads as raw, however when played that way the note never changes, but I don't understand why. Below is a slightly modified csd: |
Date | 2022-08-24 21:32 |
From | "Jeanette C." |
Subject | Re: [Csnd] Another newbie question regarding random read of table |
Hi Scott! Aug 24 2022, Scott Daughtrey has written: ... > I understand that the table index is being read as normalized due to the final "1" being the index data mode. > If it is altered to 0 it now reads as raw, however when played that way the note never changes, but I don't understand why. Because you still retain rnd(1), which will generate a random number between 0 and 1. To get different notes use a range of 99 and to make sure you get only exact values as stored in the table round the number or use the int opcode to only get an integral place and not something like the 17.57th note: iNote = table(round(rnd(99)), giNotes, 0) If you use the int opcode, I sugest a range of 99.9 or something, because int will return the integral part of the number, the part before the decimal point. With 99.9 you'll get a fair chance of reading the last note as well. Why 99? Because in raw mode indices are counted from 0. So if 0 is the first note, then 99 is the 100th note. Btw. in the example below you still appear to use the original normalised index. ... > iNote table rnd(1),giNotes,1 ; read a random value from the function table ... HTH, best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c All you people look at me like I'm a little girl. Well did you ever think it be okay for me to step into this world. <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2022-08-24 22:00 |
From | ST Music |
Subject | Re: [Csnd] Another newbie question regarding random read of table |
Thank you for the explanation Jeanette, that makes complete sense now. In this particular case it appears it's not necessary to use round or the int opcode as the table being read is Gen17 which states "This subroutine creates a step function of x-y pairs whose y-values are held to the right." . It doesn't appear that integers have any effect, however I'll try to keep that suggestion in mind for the future. And yes, I left the index normalised so anyone playing the file would hear it correctly and could then alter the index mode to 0 to hear the difference. Good catch! Thanks again. On Wed, Aug 24, 2022, 4:34 PM Jeanette C., <julien@mail.upb.de> wrote: Hi Scott! |
Date | 2022-08-24 22:17 |
From | "Jeanette C." |
Subject | Re: [Csnd] Another newbie question regarding random read of table |
Aug 24 2022, ST Music has written: ... > In this particular case it appears it's not necessary to use round or the int > opcode as the table being read is Gen17 which states "This subroutine > creates a step function of x-y pairs whose y-values are held to the right." ... The cases where it makes a difference are rare, depending on the number of steps. You will encounter them at each border, where adjecent values are different. So not very important here, but you might get a surprise now and then. :) Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c All you people look at me like I'm a little girl. Well did you ever think it be okay for me to step into this world. <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2022-09-07 16:35 |
From | John ff |
Subject | Re: [Csnd] Another newbie question regarding random read of table |
On 24 Aug 2022, at 21:35, "Jeanette C." <julien@mail.upb.de> wrote: Hi Scott! |