Re: [PD] Loading arrays with arbitrary wave forms

2014-04-10 Thread Alexandre Torres Porres
hey, I tried making mine a bit more understandable

it works with any table size. Just set the size as the argument in the
[table] object.

This means it works with [tabosc4~] if you'd like, and it makes the extra 3
guard points correctively.

The guard points thing and interpolation is a bit hard to grasp at first.
Say you have 0-96 points, you need extra 3 points (1 in the beggining, 2 at
the end) so it goes now from 0-99 and your original indexes are now from *1
to 97*. The first point (0) needs to be equal to the last one (97) and then
the extra two points (98-99) must be equal to (1-2).

What my patch does is get the table size and consider it has these extra
points, so it writes the table values like sinesum does.

In the example I'm doing a hann window and using it as an envelope, but you
could do whatever.

cheers


2014-04-10 8:45 GMT-03:00 IOhannes m zmölnig :

> On 04/09/2014 09:46 AM, IOhannes m zmoelnig wrote:
> > [sin]|
>
> ah, there is no [sin] object, use [cos] instead.
>
> anyhow, the patch was not really meant to be be copied to your Pd
> instance, but to show how easy it is to do what you want.
>
> it basically consists of two three parts:
> #1 generate numbers 0..1023; i'm using [until] and a counter for this.
> for simplicity, the counter is not reset at the beginning, so it will
> only generate the correct numbers once (the next time you click on
> [1024(, it will instead generate numbers 1024..2047); adding a reset is
> simple enough.
>
> #2 normalize the numbers 0..1023 to something more useful, e.g. to
> 0..2pi (my code is bogus here, as it incorporates a deg2rad conversion
> without ever seeing deg values) and use these values as input to a
> function (in my example sin(x)+0.1*random())
>
> #3 write the generated value into the table at the given index (the
> value from the counter)
>
>
> fgmrdsa
> IOhannes
>
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>


interpolation.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-10 Thread IOhannes m zmölnig
On 04/09/2014 09:46 AM, IOhannes m zmoelnig wrote:
> [sin]|

ah, there is no [sin] object, use [cos] instead.

anyhow, the patch was not really meant to be be copied to your Pd
instance, but to show how easy it is to do what you want.

it basically consists of two three parts:
#1 generate numbers 0..1023; i'm using [until] and a counter for this.
for simplicity, the counter is not reset at the beginning, so it will
only generate the correct numbers once (the next time you click on
[1024(, it will instead generate numbers 1024..2047); adding a reset is
simple enough.

#2 normalize the numbers 0..1023 to something more useful, e.g. to
0..2pi (my code is bogus here, as it incorporates a deg2rad conversion
without ever seeing deg values) and use these values as input to a
function (in my example sin(x)+0.1*random())

#3 write the generated value into the table at the given index (the
value from the counter)


fgmrdsa
IOhannes



signature.asc
Description: OpenPGP digital signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-10 Thread Alexandros Drymonitis
You can implement the same thing with Pd only. I've attached a patch that
creates the same waveform as the one you're loading, plus adds the three
guard points for the cubic interpolation.


On Thu, Apr 10, 2014 at 3:48 AM, David  wrote:

> Thanks again to everyone that replied. I looked at the examples, but to be
> honest I didn't really understand them completely, and I got a few error
> messages when I tried to run them. I have pd-extended installed, but maybe
> I'm missing some externals used by the examples. Anyway, I decided to go
> with plan B, and use another software package to generate sound files and
> then load them into PD. I'm using Octave, an open-source math program that
> is mostly compatible with Matlib. It has some built-in functions to read
> and write audio files (mono only), but I can generate audio files in just a
> few lines of code, like this:
>
>   x = linspace(0,2*pi,1024);
>   y = sin(cos(sin(x) * pi) * pi);
>   plot(x,y);
>   title('y = sin(cos(sin x) * pi) * pi)');
>   wavwrite(y,44100,16,'C:\\Data\\Octave\\sincossin.wav');
>
> The first two lines generate the data (1024 samples in length), the next
> two lines draw a graph in a separate window, and the last line writes the
> data to a file. I really recommend it if you want to generate audio samples
> using math functions.
>
> Then I load the file into PD with the attached patch. Since I know my
> files are 1024 samples long, I can just allocate an array of the correct
> size and not have to worry about complications.
>
> I attached my patch and a sample file (generated using the code above) if
> you're interested.
>
> David.
>
>
>
#N canvas 175 55 969 565 10;
#N canvas 0 22 450 278 (subpatch) 0;
#X array wave 1027 float 2;
#X coords 0 1 1027 -1 200 140 1;
#X restore 584 390 graph;
#X obj 36 138 until;
#X obj 36 181 f;
#X obj 63 181 + 1;
#X msg 51 160 0;
#X obj 114 302 pi;
#X obj 55 319 sin;
#X obj 55 341 *;
#X obj 114 324 t f f;
#X obj 55 363 cos;
#X obj 55 385 *;
#X obj 55 407 sin;
#X obj 55 429 tabwrite wave;
#X msg 266 267 resize \$1;
#X obj 251 311 until;
#X obj 251 353 f;
#X obj 345 425 + 1;
#X obj 251 375 t f f f;
#X msg 385 194 3;
#X obj 385 216 until;
#X obj 385 261 f;
#X obj 411 261 + 1;
#X msg 400 240 0;
#X obj 479 310 moses 1;
#X obj 518 387 +;
#X obj 404 340 +;
#X obj 266 245 + 3;
#X obj 278 353 - 1;
#X obj 266 332 - 1;
#X obj 385 168 sel 0;
#X obj 404 317 moses 1;
#X obj 251 223 t f f f f f b;
#X obj 251 196 arraysize wave;
#X obj 266 289 s wave;
#X obj 270 398 tabread wave;
#X obj 270 450 tabwrite wave;
#X obj 404 379 tabread wave;
#X obj 404 404 tabwrite wave;
#X floatatom 584 175 5 0 0 0 - - -;
#X obj 584 350 dac~;
#X obj 104 115 s wave;
#X obj 36 484 sel;
#X obj 36 116 t f b f;
#X obj 36 203 t f f f;
#X obj 51 461 - 1;
#X obj 584 328 tabread4~ wave;
#X obj 584 196 phasor~;
#X obj 584 282 *~ 1024;
#X obj 584 304 +~ 1;
#X msg 104 93 resize \$1;
#X obj 36 76 t f f f;
#X floatatom 36 41 5 0 0 0 - - -;
#X obj 623 240 arraysize wave;
#X obj 623 262 - 3;
#X obj 623 218 sel 2;
#X obj 385 293 t f f f;
#N canvas 405 223 696 526 divisor 0;
#X obj 56 346 / 8;
#X obj 56 368 t f f;
#X obj 83 390 / 4;
#X obj 56 429 +;
#X obj 212 285 f;
#X obj 238 285 + 1;
#X msg 227 263 1;
#X obj 212 97 until;
#X obj 212 141 f;
#X obj 238 141 + 1;
#X msg 227 119 1;
#X obj 212 163 swap 2;
#X obj 212 196 pow;
#X obj 212 218 ==;
#X obj 212 240 sel 0 1;
#X obj 212 72 t b b b f;
#X obj 212 307 + 1;
#X obj 56 33 inlet;
#X obj 56 55 t f f;
#X obj 56 451 outlet;
#X obj 212 351 swap 2;
#X obj 212 373 pow;
#X obj 212 395 * 3;
#X obj 212 329 - 10;
#X text 260 176 this loop determines what power 2 the table's size
is;
#X obj 83 412 +;
#X text 258 384 It seems to give the desired result;
#X text 259 329 and this algorithm makes sure we get the correct divisor.
e.g. for 1024 we need to divide by 163 \, which is ((1024 / 8) + 32)
+ 3 \, for 2048 we divide by 326 ((2048 / 8) + 64) + 6 etc.;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 1 1 2 0;
#X connect 2 0 25 0;
#X connect 3 0 19 0;
#X connect 4 0 5 0;
#X connect 4 0 16 0;
#X connect 5 0 4 1;
#X connect 6 0 4 1;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 8 0 11 0;
#X connect 9 0 8 1;
#X connect 10 0 8 1;
#X connect 11 0 12 0;
#X connect 11 1 12 1;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 14 0 4 0;
#X connect 14 1 7 1;
#X connect 15 0 7 0;
#X connect 15 1 10 0;
#X connect 15 2 6 0;
#X connect 15 3 13 1;
#X connect 16 0 23 0;
#X connect 17 0 18 0;
#X connect 18 0 0 0;
#X connect 18 1 15 0;
#X connect 20 0 21 0;
#X connect 20 1 21 1;
#X connect 21 0 22 0;
#X connect 22 0 25 1;
#X connect 23 0 20 0;
#X connect 25 0 3 1;
#X restore 90 181 pd divisor;
#X obj 55 227 /;
#X text 84 226 this is x;
#X text 81 351 this is y;
#X text 261 146 this algorithm creates the guard points;
#X text 580 60 we play the waveform with [tabread4~] instead of [tabosc4~]
cause when we create a new table size we first set it to a power of
(not a power of two plus three) and then add the three guard points

Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread Alexandros Drymonitis
And here's a patch that creates guard points. Your table should already
have a size of (2^x) + 3, which is taken care of in the patch.


On Wed, Apr 9, 2014 at 6:43 PM, Alexandre Torres Porres wrote:

> and I'm using it for an envelope...
>
>
> 2014-04-09 12:42 GMT-03:00 Alexandre Torres Porres :
>
> I made one that takes care of it, here you go
>>
>> it's just doing a hann window, but you tweak any way you want it :)
>>
>>
>> 2014-04-09 11:52 GMT-03:00 David :
>>
>> Right, I think 'sinesum' takes care of that for you. I don't know if
>>> Tim's example takes care of that or not.
>>>
>>> Thanks again.
>>>
>>>
>>> On Wed, Apr 9, 2014 at 10:36 AM, Alexandre Torres Porres <
>>> por...@gmail.com> wrote:
>>>
 the tricky detail you'd have to think of, if you're planing to use
 [tabread4~], is that you need 3 extra points that are copies of existing
 points. The help file will tell you that. [tabosc4~], in extent, needs a
 power of 2 plus the 3 extra points.


 2014-04-09 9:21 GMT-03:00 David :

>  Thanks to everyone who replied, I'll try your suggestions when I get
> home tonight.
>
> David.
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>

>>>
>>
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
#N canvas 140 252 867 401 10;
#N canvas 0 22 450 278 (subpatch) 0;
#X array guard_points 11 float 2;
#X coords 0 1 11 -1 200 140 1;
#X restore 471 193 graph;
#X msg -1 180 bang;
#X floatatom -1 58 5 0 0 0 - - -;
#X floatatom 472 95 5 0 0 0 - - -;
#X floatatom 472 143 5 0 0 0 - - -;
#X floatatom -1 103 5 0 0 0 - - -;
#X floatatom 703 143 5 0 0 0 - - -;
#X text 359 94 the value at index;
#X text 507 94 should be equal to the value of index;
#X text 509 142 <- these two should be equal ->;
#X obj -1 37 cnv 15 15 15 empty empty 1.Set_a_power_to_raise_2_to 0
8 0 14 -262144 -66577 0;
#N canvas 233 195 379 344 create-random-values 0;
#X obj 74 59 arraysize guard_points;
#X obj 74 103 until;
#X obj 74 145 f;
#X obj 101 145 + 1;
#X obj 74 167 t f b f;
#X obj 93 189 random 200;
#X obj 93 211 / 100;
#X obj 93 233 - 1;
#X obj 93 255 tabwrite guard_points;
#X obj 74 81 t f b f;
#X msg 89 124 1;
#X obj 74 38 inlet;
#X obj 74 277 outlet;
#X obj 113 103 outlet;
#X connect 0 0 9 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 4 0;
#X connect 3 0 2 1;
#X connect 4 0 12 0;
#X connect 4 1 5 0;
#X connect 4 2 8 1;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X connect 9 0 1 0;
#X connect 9 1 10 0;
#X connect 9 2 13 0;
#X connect 10 0 2 1;
#X connect 11 0 0 0;
#X restore -1 205 pd create-random-values;
#N canvas 222 238 428 437 set-guard-points 0;
#X msg 57 155 3;
#X obj 57 177 until;
#X obj 57 222 f;
#X obj 83 222 + 1;
#X msg 72 201 0;
#X obj 180 271 moses 1;
#X obj 219 348 +;
#X obj 57 254 t f f;
#X obj 57 301 +;
#X obj 57 278 moses 1;
#X obj 57 129 t b f f b;
#X obj 57 80 sel;
#X obj 57 104 f;
#X obj 72 56 t f f;
#X obj 57 340 tabread guard_points;
#X obj 57 365 tabwrite guard_points;
#X obj 99 87 - 3;
#X obj 57 9 inlet;
#X obj 72 32 inlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 7 0;
#X connect 3 0 2 1;
#X connect 4 0 2 1;
#X connect 5 0 15 1;
#X connect 5 1 6 0;
#X connect 6 0 15 1;
#X connect 7 0 9 0;
#X connect 7 1 5 0;
#X connect 8 0 14 0;
#X connect 9 0 8 0;
#X connect 9 1 14 0;
#X connect 10 0 0 0;
#X connect 10 1 8 1;
#X connect 10 2 6 1;
#X connect 10 3 4 0;
#X connect 11 0 12 0;
#X connect 12 0 10 0;
#X connect 13 0 11 1;
#X connect 13 1 16 0;
#X connect 14 0 15 0;
#X connect 16 0 12 1;
#X connect 17 0 11 0;
#X connect 18 0 13 0;
#X restore -1 230 pd set-guard-points;
#N canvas 94 174 377 304 set-array-size 0;
#X obj 54 81 swap 2;
#X obj 54 103 pow;
#X msg 81 169 resize \$1;
#X obj 81 191 s guard_points;
#X obj 54 125 + 3;
#X obj 54 147 t f f;
#X obj 54 57 inlet;
#X obj 54 216 outlet;
#X connect 0 0 1 0;
#X connect 0 1 1 1;
#X connect 1 0 4 0;
#X connect 2 0 3 0;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 5 1 2 0;
#X connect 6 0 0 0;
#X restore -1 80 pd set-array-size;
#X text 35 102 array size should (2^x) + 3;
#X obj -1 160 cnv 15 15 15 empty empty 2.create_random_values_and_guard_points
0 8 0 14 -262144 -66577 0;
#N canvas 516 156 564 378 check-the-values-of-the 0;
#X obj 67 296 tabread guard_points;
#X obj 292 182 %;
#X obj 288 88 arraysize guard_points;
#X obj 288 110 - 3;
#X obj 292 296 tabread guard_points;
#X obj 67 71 t f f b;
#X obj 273 156 +;
#X obj 292 206 sel 0;
#X obj 288 132 t f f f;
#X obj 292 228 f;
#X obj 292 250 t f f;
#X obj 319 272 s index;
#X obj 67 48 inlet;
#X obj 67 318 outlet;
#X obj 292 318 outlet;
#X connect 0 0 13 0;
#X connect 1 0 7 0;
#X connect 2 0 3 0;
#X connect 3 0 8 0;
#X connect 4 0 14 0;
#X connect 5 0 0 0

Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread Alexandre Torres Porres
and I'm using it for an envelope...


2014-04-09 12:42 GMT-03:00 Alexandre Torres Porres :

> I made one that takes care of it, here you go
>
> it's just doing a hann window, but you tweak any way you want it :)
>
>
> 2014-04-09 11:52 GMT-03:00 David :
>
> Right, I think 'sinesum' takes care of that for you. I don't know if Tim's
>> example takes care of that or not.
>>
>> Thanks again.
>>
>>
>> On Wed, Apr 9, 2014 at 10:36 AM, Alexandre Torres Porres <
>> por...@gmail.com> wrote:
>>
>>> the tricky detail you'd have to think of, if you're planing to use
>>> [tabread4~], is that you need 3 extra points that are copies of existing
>>> points. The help file will tell you that. [tabosc4~], in extent, needs a
>>> power of 2 plus the 3 extra points.
>>>
>>>
>>> 2014-04-09 9:21 GMT-03:00 David :
>>>
  Thanks to everyone who replied, I'll try your suggestions when I get
 home tonight.

 David.

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management ->
 http://lists.puredata.info/listinfo/pd-list


>>>
>>
>
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread Alexandre Torres Porres
I made one that takes care of it, here you go

it's just doing a hann window, but you tweak any way you want it :)


2014-04-09 11:52 GMT-03:00 David :

> Right, I think 'sinesum' takes care of that for you. I don't know if Tim's
> example takes care of that or not.
>
> Thanks again.
>
>
> On Wed, Apr 9, 2014 at 10:36 AM, Alexandre Torres Porres  > wrote:
>
>> the tricky detail you'd have to think of, if you're planing to use
>> [tabread4~], is that you need 3 extra points that are copies of existing
>> points. The help file will tell you that. [tabosc4~], in extent, needs a
>> power of 2 plus the 3 extra points.
>>
>>
>> 2014-04-09 9:21 GMT-03:00 David :
>>
>>>  Thanks to everyone who replied, I'll try your suggestions when I get
>>> home tonight.
>>>
>>> David.
>>>
>>> ___
>>> Pd-list@iem.at mailing list
>>> UNSUBSCRIBE and account-management ->
>>> http://lists.puredata.info/listinfo/pd-list
>>>
>>>
>>
>


Wavetables.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread Alexandre Torres Porres
the tricky detail you'd have to think of, if you're planing to use
[tabread4~], is that you need 3 extra points that are copies of existing
points. The help file will tell you that. [tabosc4~], in extent, needs a
power of 2 plus the 3 extra points.


2014-04-09 9:21 GMT-03:00 David :

> Thanks to everyone who replied, I'll try your suggestions when I get home
> tonight.
>
> David.
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread David
Right, I think 'sinesum' takes care of that for you. I don't know if Tim's
example takes care of that or not.

Thanks again.


On Wed, Apr 9, 2014 at 10:36 AM, Alexandre Torres Porres
wrote:

> the tricky detail you'd have to think of, if you're planing to use
> [tabread4~], is that you need 3 extra points that are copies of existing
> points. The help file will tell you that. [tabosc4~], in extent, needs a
> power of 2 plus the 3 extra points.
>
>
> 2014-04-09 9:21 GMT-03:00 David :
>
>> Thanks to everyone who replied, I'll try your suggestions when I get home
>> tonight.
>>
>> David.
>>
>> ___
>> Pd-list@iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>>
>>
>
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread David
Thanks to everyone who replied, I'll try your suggestions when I get home
tonight.

David.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread tim vets
I don't know if it's exactly what you had in mind,
but here's an example with expr
gr,
Tim


2014-04-09 9:46 GMT+02:00 IOhannes m zmoelnig :

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> On 2014-04-09 02:41, David wrote:
> > Any suggestions on how I could do that in Pure Data?
>
> [loadbang]
> |
> [1024(
> |
> [t f f|
> | [; mytable resize $1(
> |
> [until]
> |
> |+---+
> [i -1]   |
> [+ 1]|
> [t f f]  |
> | +--+
> |
> [t  f   f]
> ||
> [/ 1024] |
> [* 3.141592654]  |
> [/ 180]  |
> ||
> [sin]|
> ||
> [tb  f]  |
> | |  |
> [random 101]  |  |
> [- 50]|  |
> [/ 500]   |  |
> | |  |
> [+]  |
> ||
> [tabwrite mytable]
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
> Comment: Using GnuPG with Icedove - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTRPrVAAoJELZQGcR/ejb4ki8P/15TNi3xkzzFi9yQ6PGDq8ik
> EEgoQnDlLvr7yxuBe5+Cx3ZbgWiSN1bnHUnyjmbnz7xW3m8hdO0TjYH4q1OsZhGT
> ng7+HlWStgAzla5AMDC0zo7FOYPlOT6fh7CaugADoBg2yiFHLkj6e2Qo6XZxk+D6
> ktaBU0tnIHa2xVwc77zRHVr8zSqL5fRArPy9DUq6ElB3FeAw+L9kv9/Dz+AqvPeK
> hNWSqsIf2vJr4VeufAiAGlRfFRzWUtTQW4rntwktYDyz6u6BX7WowqA0cmDRfwce
> SmHNnl3kSTvZMfeMEcIbwh0NxZ0CkWbm6xULHkEN/vt2CPjjS5hhl7hk3Pf5YgtV
> VOjMCDr200FkDjepkjbzKAC8HbiHFZk1voe6v1AJhB2mo1GkL9KD1gKhzRMqnU4j
> VqCO3bK1+ikGQdWrVKs3vcIeYHlVtjWRGTdSmcGSCBJS+3JnHRWkMDhmE8xfpmbC
> VZnf6cJP/dU0joEypeH8Rklj8gWq3O/SO5go4els86xcxFG84uWB3Pux6e0SbNG3
> kZKx8zyUIonhMHamuGcVhfu617O9RYS8IEno2OFuaTUoOrM4mwEMKAekb0sRMVGM
> IWonEwNTPZIuErREhRB1sOsMGXE+LtVEj3LurS8D34fafXOxyFPjThC7bcYySkP9
> R4egh1HAlBIx+YteH7HZ
> =kKlk
> -END PGP SIGNATURE-
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
#N canvas 127 99 438 638 10;
#X obj 84 361 tabwrite wave;
#X obj 84 122 until;
#X obj 84 152 f;
#X obj 112 152 + 1;
#X obj 159 340 f;
#X obj 186 340 + 1;
#X obj 84 312 t f b;
#X msg 123 122 0;
#X obj 172 247 pi;
#X obj 111 209 expr ($f1*(1/$f2))/$f2;
#X obj 84 249 *;
#X obj 84 179 t f f;
#X obj 84 83 t f f b b;
#X obj 84 17 max 1024;
#X obj 87 -3 hsl 128 15 1024 4096 0 0 empty empty empty -2 -8 0 10
-262144 -1 -1 500 1;
#X obj 234 17 max 1;
#X obj 237 -2 hsl 128 15 0 500 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 1400 1;
#X obj 84 278 expr (sin($f3*sin($f1) * $f2));
#X obj 84 64 f;
#X obj 234 38 t b f;
#N canvas 0 0 450 300 (subpatch) 0;
#X array wave 1024 float 5;
#A 0 0 0.000132092 0.000528366 0.00118882 0.00211346 0.00330228 0.00475528
0.00647244 0.00845376 0.0106992 0.0132088 0.0159824 0.01902 0.0223216
0.0258871 0.0297162 0.033809 0.0381652 0.0427846 0.047667 0.0528121
0.0582194 0.063 0.0698196 0.0760114 0.0824635 0.0891753 0.096146
0.103375 0.110861 0.118603 0.126599 0.13485 0.143352 0.152105 0.161107
0.170356 0.179849 0.189586 0.199562 0.209777 0.220226 0.230907 0.241816
0.252951 0.264307 0.275881 0.287667 0.299662 0.311862 0.324259 0.336851
0.349629 0.362589 0.375725 0.389028 0.402493 0.416112 0.429876 0.443778
0.457809 0.47196 0.48622 0.500582 0.515033 0.529563 0.544162 0.558816
0.573515 0.588245 0.602993 0.617745 0.632488 0.647206 0.661886 0.67651
0.691063 0.705528 0.719889 0.734127 0.748225 0.762164 0.775925 0.789488
0.802834 0.815942 0.828791 0.841361 0.853628 0.865572 0.877169 0.888398
0.899234 0.909655 0.919636 0.929154 0.938184 0.946702 0.954684 0.962104
0.968939 0.975162 0.98075 0.985677 0.989919 0.993452 0.99625 0.998289
0.999547 0.99 0.999622 0.998394 0.996293 0.993296 0.989385 0.984537
0.978735 0.971959 0.964193 0.95542 0.945625 0.934795 0.922915 0.909975
0.895965 0.880877 0.864703 0.847438 0.82908 0.809627 0.789078 0.767437
0.744708 0.720897 0.696014 0.670068 0.643076 0.615051 0.586013 0.555982
0.524983 0.49304 0.460185 0.426448 0.391864 0.35647 0.320306 0.283417
0.245847 0.207646 0.168865 0.129559 0.089786 0.0496052 0.00907972 -0.0317242
-0.0727388 -0.113893 -0.155113 -0.196324 -0.237447 -0.278401 -0.319107
-0.359478 -0.399428 -0.438871 -0.477718 -0.515877 -0.553259 -0.589772
-0.625323 -0.659818 -0.693166 -0.725274 -0.75605 -0.785401 -0.813238
-0.839472 -0.864014 -0.88678 -0.907687 -0.926653 -0.943601 -0.958456
-0.971149 -0.981612 -0.989782 -0.995601 -0.999018 -0.85 -0.99846
-0.994406 -0.987796 -0.978605 -0.966819 -0.952429 -0.935433 -0.915839
-0.893661 -0.868923 -0.841656 -0.811899 -0.779703 -0.745124 -0.708228
-0.669093 -0.627802 -0.584449 -0.539137 -0.491978 -0.443093 -0.392609
-0.340665 -0.287408 -0.232989 -0.177571 -0.121323 -0.0644179 -0.00704074
0.0506239 0.10838 0.166034 0.223382 0.280218 0.336336 0.391525 0.445575
0.498275 0.549414 0.598783 0.646176 0.691387 0.734218 0.774475 0.811969
0.84652 0.877955 0.90611 0.930832 0.951977 0.969416 0.983032 0.992719
0.99839 0.72 0.997406 0.990653 0.97969 0.964514 0.945139 0.9216
0.893949 0.86226 0.826628 0.787165 0.744006 0.697305 0.647237 0.593993
0.537787 0.47885 0

Re: [PD] Loading arrays with arbitrary wave forms

2014-04-09 Thread IOhannes m zmoelnig
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 2014-04-09 02:41, David wrote:
> Any suggestions on how I could do that in Pure Data?

[loadbang]
|
[1024(
|
[t f f|
| [; mytable resize $1(
|
[until]
|
|+---+
[i -1]   |
[+ 1]|
[t f f]  |
| +--+
|
[t  f   f]
||
[/ 1024] |
[* 3.141592654]  |
[/ 180]  |
||
[sin]|
||
[tb  f]  |
| |  |
[random 101]  |  |
[- 50]|  |
[/ 500]   |  |
| |  |
[+]  |
||
[tabwrite mytable]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBCAAGBQJTRPrVAAoJELZQGcR/ejb4ki8P/15TNi3xkzzFi9yQ6PGDq8ik
EEgoQnDlLvr7yxuBe5+Cx3ZbgWiSN1bnHUnyjmbnz7xW3m8hdO0TjYH4q1OsZhGT
ng7+HlWStgAzla5AMDC0zo7FOYPlOT6fh7CaugADoBg2yiFHLkj6e2Qo6XZxk+D6
ktaBU0tnIHa2xVwc77zRHVr8zSqL5fRArPy9DUq6ElB3FeAw+L9kv9/Dz+AqvPeK
hNWSqsIf2vJr4VeufAiAGlRfFRzWUtTQW4rntwktYDyz6u6BX7WowqA0cmDRfwce
SmHNnl3kSTvZMfeMEcIbwh0NxZ0CkWbm6xULHkEN/vt2CPjjS5hhl7hk3Pf5YgtV
VOjMCDr200FkDjepkjbzKAC8HbiHFZk1voe6v1AJhB2mo1GkL9KD1gKhzRMqnU4j
VqCO3bK1+ikGQdWrVKs3vcIeYHlVtjWRGTdSmcGSCBJS+3JnHRWkMDhmE8xfpmbC
VZnf6cJP/dU0joEypeH8Rklj8gWq3O/SO5go4els86xcxFG84uWB3Pux6e0SbNG3
kZKx8zyUIonhMHamuGcVhfu617O9RYS8IEno2OFuaTUoOrM4mwEMKAekb0sRMVGM
IWonEwNTPZIuErREhRB1sOsMGXE+LtVEj3LurS8D34fafXOxyFPjThC7bcYySkP9
R4egh1HAlBIx+YteH7HZ
=kKlk
-END PGP SIGNATURE-

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Loading arrays with arbitrary wave forms

2014-04-08 Thread Alexandre Torres Porres
just

- think of the table size you want.

- get its period in seconds, or better, its frequency, according to the
sample rate

- use this frequency as the frequency of [phasor~], going from 0 to 1 (be
careful to set the starting phase as zero, as well)

- make [phasor~] feed whatever crazy idea and mathematical function you bum
into, like sin(sin(x) * pi) or sin(x) ^ 3, put that into an [expr~]

there you go



2014-04-08 21:41 GMT-03:00 David :

> Hi!
>
> Is there some way to fill an array (table) with an arbitrary wave form
> programatically? I know I can use sinesum or cosinesum to generate sums of
> sinusoidal wave forms, and in theory any periodic waveform can be generated
> this way. But I want to generate wave forms using more complicated
> trigonometric expressions, for example sin(sin(x) * pi) or sin(x) ^ 3. I'm
> not sure what they would sound like (which is what motivates me to try), or
> if there's some way to transform these expressions to use only sinesum or
> cosinesum (my knowledge of math is somewhat limited).
>
> Any suggestions on how I could do that in Pure Data? I could create an
> audio file using some other software tool and then load it into Pure Data,
> but I'd like to know if there's some way to do it directly in PD.
>
> Thanks.
>
>
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


[PD] Loading arrays with arbitrary wave forms

2014-04-08 Thread David
Hi!

Is there some way to fill an array (table) with an arbitrary wave form
programatically? I know I can use sinesum or cosinesum to generate sums of
sinusoidal wave forms, and in theory any periodic waveform can be generated
this way. But I want to generate wave forms using more complicated
trigonometric expressions, for example sin(sin(x) * pi) or sin(x) ^ 3. I'm
not sure what they would sound like (which is what motivates me to try), or
if there's some way to transform these expressions to use only sinesum or
cosinesum (my knowledge of math is somewhat limited).

Any suggestions on how I could do that in Pure Data? I could create an
audio file using some other software tool and then load it into Pure Data,
but I'd like to know if there's some way to do it directly in PD.

Thanks.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list