A Csound widget?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

A Csound widget?

Jonathan Sorge
So I was daydreaming today about a Dashboard widget that would serve as a
calculator for Csound. I spend alot of time calculating audio loops into
ftables, for example. It would be fun (and useful) if all I had to do was
punch in how many seconds the file was, with its basic properties and BOOM
-- There's the optimal ftable length I need.
I think it would be amazing if there was Csound Calculator widget sitting on
my dashboard so whenever I need to do some number crunching for a GEN I can
just jump right to it. The best part though would be to copy & paste the
results right into the score. Every Csounder using Mac OS 10.4 could benefit
from a tool like this. (Or am I the only one who thinks Widgets are cool?)
All I'm saying is I'd like to press "F12" on my keyboard and see a
tricked-out Csound Calculator standing by to aid my workflow.
Sincerely,
Jonathan


--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Pat Pagano
or why not csound itself? and the widget could search the net looking
for .csds, render them and playlist them for you...

lets do it.

right after i get my darn soundcard working with 5...LOL




On Jun 28, 2005, at 9:59 PM, Jonathan Sorge wrote:

> So I was daydreaming today about a Dashboard widget that would serve
> as a calculator for Csound. I spend alot of time calculating audio
> loops into ftables, for example. It would be fun (and useful) if all I
> had to do was punch in how many seconds the file was, with its basic
> properties and BOOM -- There's the optimal ftable length I need.
> I think it would be amazing if there was Csound Calculator widget
> sitting on my dashboard so whenever I need to do some number crunching
> for a GEN I can just jump right to it. The best part though would be
> to copy & paste the results right into the score. Every Csounder using
> Mac OS 10.4 could benefit from a tool like this. (Or am I the only one
> who thinks Widgets are cool?) All I'm saying is I'd like to press
> "F12" on my keyboard and see a tricked-out Csound Calculator standing
> by to aid my workflow.
> Sincerely,
> Jonathan
>
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to [hidden email]
>

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Anthony Kozar
In reply to this post by Jonathan Sorge
How about a macro instead.  Something like:

#define  TABLEN(x)  # [ @@ (x * 44100) ] #

Just replace 44100 with the sampling rate. (@@ rounds up to the next largest
power of 2).

Then

f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file

Anthony Kozar
[hidden email]
http://akozar.spymac.net/


On 6/28/05 9:59 PM, Jonathan Sorge <[hidden email]> etched in
stone:

> So I was daydreaming today about a Dashboard widget that would serve as a
> calculator for Csound. I spend alot of time calculating audio loops into
> ftables, for example.

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

David Akbari

On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:

> How about a macro instead.  Something like:
>
> #define  TABLEN(x)  # [ @@ (x * 44100) ] #
>
> Just replace 44100 with the sampling rate. (@@ rounds up to the next
> largest
> power of 2).
>
> Then
>
> f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file

Thanks!! This is much better than those VRAM eating widgets.

Power of 2 is where it's at... especially with samples!! Much better
than deferred alloc, imho.  Just pick a power of 2 even... i tend to
prefer (2^18) for most samples <shrug>.


-David

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Steven Yi
There's a UDO I wrote sometime back that you could use with ftgen:

http://www.csounds.com/udo/displayOpcode.php?opcode_id=19

steven

On 6/28/05, David Akbari <[hidden email]> wrote:

>
> On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:
>
> > How about a macro instead.  Something like:
> >
> > #define  TABLEN(x)  # [ @@ (x * 44100) ] #
> >
> > Just replace 44100 with the sampling rate. (@@ rounds up to the next
> > largest
> > power of 2).
> >
> > Then
> >
> > f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file
>
> Thanks!! This is much better than those VRAM eating widgets.
>
> Power of 2 is where it's at... especially with samples!! Much better
> than deferred alloc, imho.  Just pick a power of 2 even... i tend to
> prefer (2^18) for most samples <shrug>.
>
>
> -David
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to [hidden email]
>
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Doctor B
In reply to this post by Anthony Kozar
Anthony,

A very useful macro - Thanks!

-dr.B.

On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:

> How about a macro instead.  Something like:
>
> #define  TABLEN(x)  # [ @@ (x * 44100) ] #
>
> Just replace 44100 with the sampling rate. (@@ rounds up to the  
> next largest
> power of 2).
>
> Then
>
> f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file
>
> Anthony Kozar
> [hidden email]
> http://akozar.spymac.net/
>
>
> On 6/28/05 9:59 PM, Jonathan Sorge <[hidden email]>  
> etched in
> stone:
>
>
>> So I was daydreaming today about a Dashboard widget that would  
>> serve as a
>> calculator for Csound. I spend alot of time calculating audio  
>> loops into
>> ftables, for example.
>>
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to [hidden email]
>

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Pat Pagano
In reply to this post by Anthony Kozar
nice

On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:

> How about a macro instead.  Something like:
>
> #define  TABLEN(x)  # [ @@ (x * 44100) ] #
>
> Just replace 44100 with the sampling rate. (@@ rounds up to the next
> largest
> power of 2).
>
> Then
>
> f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file
>
> Anthony Kozar
> [hidden email]
> http://akozar.spymac.net/
>
>
> On 6/28/05 9:59 PM, Jonathan Sorge <[hidden email]> etched
> in
> stone:
>
>> So I was daydreaming today about a Dashboard widget that would serve
>> as a
>> calculator for Csound. I spend alot of time calculating audio loops
>> into
>> ftables, for example.
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to [hidden email]
>
>
Patrick Pagano, B.S., M.F.A
Digital Media Specialist
University of Floirda
Digital Worlds Institute
352-294-2082

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

John Harrison-2
In reply to this post by Steven Yi
If it is helpful to anybody, here's how I load files into tables of the
right power-of-2 size at performance time:

ifilelen        filelen  <my file.aif>  
ifilesr         filesr   <my file.aif>  
iFileSmps       =        ifilelen*ifilesr
iFtableSize     =        2^int(log(iFileSmps)/log(2)+1)
giRandomSample   ftgen    0,0,iFtableSize,-1,<my file.aif>,0,4,0

Usually <my file.aif> is just a number as in soundin.<number>. Then I
use reinit to load consecutive soundin.<number> files into tables.

I've never seen this @@ trick. It's pretty cool. How did you find this?

-John

Steven Yi wrote:

>There's a UDO I wrote sometime back that you could use with ftgen:
>
>http://www.csounds.com/udo/displayOpcode.php?opcode_id=19
>
>steven
>
>On 6/28/05, David Akbari <[hidden email]> wrote:
>  
>
>>On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:
>>
>>    
>>
>>>How about a macro instead.  Something like:
>>>
>>>#define  TABLEN(x)  # [ @@ (x * 44100) ] #
>>>
>>>Just replace 44100 with the sampling rate. (@@ rounds up to the next
>>>largest
>>>power of 2).
>>>
>>>Then
>>>
>>>f1 0  $TABLEN(2.65)  1  ...   ; 2.65 second-long file
>>>      
>>>
>>Thanks!! This is much better than those VRAM eating widgets.
>>
>>Power of 2 is where it's at... especially with samples!! Much better
>>than deferred alloc, imho.  Just pick a power of 2 even... i tend to
>>prefer (2^18) for most samples <shrug>.
>>
>>
>>-David
>>
>>--
>>Send bugs reports to this list.
>>To unsubscribe, send email to [hidden email]
>>
>>    
>>
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

Anthony Kozar
Thanks for sharing your code John.  Looks very useful :)

The info about @ and @@ is in the manual:

http://csounds.com/manual/html/ScoreEval.html
Evaluation of Expressions

Note though that there were a couple of mistakes in my example (I was just
typing without testing :).  First, @@ rounds up to the next power of 2 plus
one.  (So, [@@ 25] will be 33).  Just a single @ rounds to the next power of
two.  ( [@ 25] would be 32).

Second, I forgot the $ for the macro variable.  So the macro should be
(still not tested):

#define  TABLEN(x)  # [ @ ($x * 44100) ] #

As far as I know, these two operators (@ and @@) only work in the score as
part of a score expression (must be enclosed in brackets).  They are kind of
buried in the manual, and I cannot remember if I first came across them
there or while reading the code.  (There are several other score expression
operators for bitwise operations that are still undocumented and that I only
know about from reading the score parsing code).

Anthony Kozar
[hidden email]
http://akozar.spymac.net/


On 6/30/05 1:19 AM, John Harrison <[hidden email]> etched in stone:

> I've never seen this @@ trick. It's pretty cool. How did you find this?

>>> On Jun 28, 2005, at 11:20 PM, Anthony Kozar wrote:

>>>> How about a macro instead.  Something like:
>>>>
>>>> #define  TABLEN(x)  # [ @@ (x * 44100) ] #
>>>>
>>>> Just replace 44100 with the sampling rate. (@@ rounds up to the next
>>>> largest
>>>> power of 2).

--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: A Csound widget?

jpff
In reply to this post by John Harrison-2
From the Changelog

1999-07-18  John ffitch  <jpff@montague>

        * sread.c (getscochar): Allowed @ in arithmetic part, and @@ for
        guard.  Gives next power of 2 up, between 1 and 0x40000000
        Also corrected ~ case


==John ffitch
--
Send bugs reports to this list.
To unsubscribe, send email to [hidden email]