[PD] Newbie with some questions (notably [block~ 1])

Claudius Maximus gloriousclaudiusmaximus at yahoo.co.uk
Wed Oct 22 17:52:56 CEST 2003


 --- Frank Barknecht <fbar at footils.org> wrote: >
Hallo,
> Claudius Maximus hat gesagt: // Claudius Maximus
> wrote:
> 
> > 1. [block~ 1] doesn't work
> > 
> > The block size is set to 64 instead.  Moreover:
> 
> block~ can not be used in the patch with the
> adc~/dac~, you need a
> subpatch then. Block also does not change the lowest
> message speed in
> objects like [del], which is limited below by 64
> samples.

Is there a list of objects which do not behave in a
continuous way as you decrease the block size below
64?  I'd hate to run into trouble again when I least
expect it.  Perhaps [bang~] or [timer] are some of 
these objects, which would break the [block~ 1] tests
I detailed below.



> > 3. How do I read bytes from a binary file into an
> > array?
> > 
> > Treating them as integers from 0 to 255.
> 
> I don't know an object that opens files in bin-mode,
> but it could be
> written as an external.

I do not have a Windows C compiler.  I need to 
investigate whether there are any freely available,
can you recommend one?



> > 4. How do I build messages out of symbol
arguments?
> > 
> > |set $1(  doesn't work as expected when I send it
> a
> > symbol.
> 
> What did you expect it to work like?

Well, as I describe below it wasn't a symbol I was
sending
it anyway, but an identifier.  I expected it to
replace $1
with the identifier name that was input.



> > 5. How do I send messages to $0-name arrays?
> > 
> > |;$0-name x y z(  doesn't work.
> 
> There is no $0 in messages, you just invented this. 
> ;)
> To send to local variable, need to make a message
> that accepts a
> variable: 
> 
>   [; $1-name x y z(
> 
> and send $0 as first argument to that: 
> 
>   [f $0]
>    |
>    |
>   [; $1-name x y z(
> 
> you also could use [symbol $0-name] directly.
> Example attached.

Many thanks, that's exactly what I needed.

> Frank Barknecht                               _



--- zmoelnig at iem.at wrote: 
>
> Zitiere Claudius Maximus
<gloriousclaudiusmaximus at yahoo.co.uk>:
> 
> > 1. [block~ 1] doesn't work
>
> it does. (at least in pd-0.36; i'll have to make the
> pc i am sitting at compile
> first, before i can try 0.37)
> 
> > The block size is set to 64 instead.  Moreover:
>
> how do you know ?
> i tested it with [pack~].

I tried 3 methods of getting [block ~1] to work, all
failed.

1: block1test1.pd
Window with a [block~ 1] and objects to display the
block size.
Doesn't work, block size is actually 64.

2: block1test2.pd
Window with a [pd ...] subpatch, subpatch contains a
[block~ 1] 
and objects to display the block size.
Doesn't work, block size is actually 64.

3: block1test3a.pd, block1test3b.pd
3a is a window with a [block1test3b] use of an
abstraction 
and a number box to display the block size coming from
the 
outlet.  3b is a window with a [block~ 1] and objects
to 
display the block size, together with an outlet
outputting 
the block size.
Doesn't work, block size is actually 64.

I first noticed this bug trying to output audio (sound
was
way lower in pitch than it should have been with
mid-freq
aliasing noise), but I've since modified those patches
to
use a workaround so I'm afraid I can't post them here.



> > C:\>pd -blocksize 1
>
> i don't think that this is a working setting.
> pd's dac/adc-blocksize used to be somewhat hardcoded
> to 64 samples (but this
> might have changed with 0.37; i'm a little bit
> behind in that matters)
> and of course your soundcard/driver would have to
> support such small blocksizes.

I see.  A friendly error message would have been nicer
;-)



> > 3. How do I read bytes from a binary file into an
> > array?
> > 
> > Treating them as integers from 0 to 255.
> 
> there was something like [read16
> /path/to/my/file.dat(

I guess I could use [soundfiler] to read the data as a
raw 8-bit sound file, and then calculate the real byte
values.  Not very elegant though ;-)



> > 4. How do I build messages out of symbol
arguments?
> > 
> > |set $1(  doesn't work as expected when I send it
a
> > symbol.
> 
> depends on what you expect.
> you might argue, that when setting a message with
> [set $1( where $1 is a symbol
> the set message should output a symbol when
> banged/clicked. However you easily
> acchieve this by using [set symbol $1(. 
>
> It is often quite hard to distinguish between
> "symbols" and so called anythings 
> , especially for newbies.
> There is really a difference between [hallo( (being
> an identifier "hallo") and
> [symbol hallo( (being the symbol (identified by
> "symbol") "hallo")

I think I understand now: [sawtooth( is sent as an
identifier rather than a symbol, so I need to put
it through a [symbol] object to turn it into a real
symbol.  After that, routing it into a [set $1( 
works as I expected, outputting "set sawtooth".  As
a diagram:

[sawtooth(
 |
 | "sawtooth"
 |
[symbol]
 |
 | "symbol sawtooth"
 |
[set $1(
 |
 | "set sawtooth"
 v



> > 5. How do I send messages to $0-name arrays?
> > 
> > |;$0-name x y z(  doesn't work.
>
> to send something to your array named "$0-name" use:
> 
> [x y z(
> |
> [send $0-name]

Thanks, I've got that working :)



> mfg.as.dr
> IOhannes 



What I am trying to do is create an oscillator with 
switchable waveforms, and the ability to synchronize
the oscillators (osc2 restarts when osc1 restarts, 
need better resolution than 64 samples for this).

I want the subpatch to be able 
to receive messages like [waveform square( or 
[waveform sawtooth(, which it converts to messages 
like [set X( where X is the name of a local array like
$0-sawtooth or $0-square.  The [set X( message is then

sent to a [tabosc4~].  See symboltest1*.pd - it uses
$1 from the abstraction arguments because $0 was 
invisible and I wanted to see what was happening).

I was doing it wrong when I first tried, but now I 
think I've found a bug in the message box:

[set $1 $2( -> "set aardvark sawtooth" when I feed it 
a pair of symbols "aardvark sawtooth".  But when I 
try to put a "-" instead of the space between the 
variables:

[set $1-$2( -> "set aardvark-$2" instead of 
"set aardvark-sawtooth".  A problem.

Are there prizes awarded for finding bugs?  I would 
like my prize to be an umbrella - I need to go to 
the post office but it's raining.

A solution to the waveform selection problem is:

[route sawtooth square ...]
 |       |       ...     |   
 |
[trigger bang]
 |
 |
[symbol $0-sawtooth]
 |
 |
[set $1(
 |
 |
[whatever wants to read the array]

which would mean more work when adding new waveforms
(need to create new waveform array, modify route and
create a new trigger-symbol-message trio, instead of 
just creating the new waveform array), but has the 
advantage that I can add a sensible error message 
for unrecognised waveform names.

Many thanks to both of you for your swift and helpful
replies.


Claude
-- 
http://www.claudiusmaximus.tk
Each unsolicited commercial email received is subject
to a US$50 handling fee.

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk




More information about the Pd-list mailing list