Csound Csound-dev Csound-tekno Search About

Cps2 opcode and Just Intonation

Date1999-09-05 22:43
Frompatrick pagano
SubjectCps2 opcode and Just Intonation
Hello Csounders
i have been experimenting with the Cps 2 opcode for about a month or so.
Last night i decided to check the pitches with a sabine tuner and a freq
generator and too my dismay found that the 8.00 or 1/1 which i had hoped
would be 256hz (with some help from Bill alves) was in fact a eq temp C
. Can any one out there give me an idea what is wrong??
here is the instrument

sr   =   44100
kr   =   4410
ksmps  =   10
nchnls  =   2
garvbsig init 0
gaol init 0
gaor init 0


  instr   1
kpan  line 0,p3*.7,1
ipanl   =       sqrt(p5)                           ; Pan left
ipanr   =       sqrt(1-p5)                         ; Pan right
ifreq    cps2pch    p4,-1    ; refer to multiplier table #1
ifreq   =       512*ifreq/261.6;;;;;;;;;;;;;;;;;;;;;;THIS SHOULD MAKE
8.00 256hz??
k1      linen   700,.1,p3,.1
aamp    linseg  0, .002, 1, p3-.004, 1, .002, 0  ; Declick envelope
ifreq    cps2pch    p4,-1    ; refer to multiplier table #1
krtl =sqrt(2)/2*cos(kpan)-sin(kpan)
krtr =sqrt(2)/2*cos(kpan)+sin(kpan)
asound  oscili       k1,ifreq,2
aout    =       asound*aamp
aol=(asound*aamp)*krtl
aor=(asound*aamp)*krtr
gaol=gaol+aout
gaor=gaor+aor
garvbsig=garvbsig+aout
outs    aout*ipanl, aout*ipanr             ; Output stereo
endin
;;;;here is a segment of the score

;table # start  size    gen fn   1/1         17/16
9/8                 7/6
f 1      0      16      -2       1.000000   1.062500   1.125000
1.16666
;    9/7                         1323/1024      4/3          7/5
3/2         49/32           14/9            12/7         7/4
1.2857142857        1.2919921     1.333333   1.4   1.500000  1.53125
1.5555555    1.7142857   1.75
;  27/14       63/32
1.9285714    1.96875
f 2      0      8192    10      1

t  0 120
i3    0  300   8.00     .5
i3    100  200   8.08   .5
i3    200   100   8.12   .5
i1 8 0.25 9.08 .5
i1 8.25 0.25 9.08 0
i1 8.5 0.25 9.12 0.5
i1 8.75 0.25 9.08 0.5
i1 9 0.25 9.08 0.5
i1 9.25 0.25 9.08 0

any help would be greatly appreciated
thanks
pat

Date1999-09-06 13:39
Fromjpff@maths.bath.ac.uk
SubjectRe: Cps2 opcode and Just Intonation
Perhaps your problem is that 8.00 is the reference frequency I set
from which all is calculated?
==John


Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa08497;
          6 Sep 99 14:34 BST
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 2.12 #1)
	id 11Nyv1-0005yW-00
	for jpff@maths.bath.ac.uk; Mon, 6 Sep 1999 14:34:50 +0100
Received: from noether [144.173.8.10] by hermes via SMTP (OAA12855); Mon, 6 Sep 1999 14:29:36 +0100 (BST)
Received: from exeter.ac.uk by maths.ex.ac.uk; Mon, 6 Sep 1999 14:29:21 +0100
Received: from sparticus.bright.net [205.212.123.5] by hermes via ESMTP (OAA12207); Mon, 6 Sep 1999 14:29:20 +0100 (BST)
Received: from bright.net (find-cas1-cs-21.dial.bright.net [209.143.26.124])
	by sparticus.bright.net (8.9.3/8.9.3 ComNet Build) with ESMTP id JAA05497;
	Mon, 6 Sep 1999 09:29:01 -0400 (EDT)
Message-ID: <37D3C7A1.E132FA00@bright.net>
Date: Mon, 06 Sep 1999 09:54:41 -0400
From: Dave Phillips 
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: Csound Mail 
Subject: [Fwd: [CUD] Re: [linux-audio-dev] linux csound real-time input]
Content-Type: multipart/mixed;
 boundary="------------3D5A0BEC6BF766DE73A620B9"
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

This is a multi-part message in MIME format.
--------------3D5A0BEC6BF766DE73A620B9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Greetings:

  I thought this message should be forwarded to the Csound list. I've
not verified the problem or this solution, but Eric knows his stuff...

== Dave Phillips

       http://www.bright.net/~dlphilp/index.html
   http://sunsite.univie.ac.at/Linux-soundapp/linux_soundapps.html
--------------3D5A0BEC6BF766DE73A620B9
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Received: by  (mbox dlphilp)
 (with Cubic Circle's cucipop (v1.31 1998/05/13) Mon Sep  6 09:13:29 1999)
X-From_: owner-csound-unix-dev@ilogic.com.au  Sun Sep  5 16:08:15 1999
Return-Path: 
Received: from toad.ilogic.com.au (intern12.lnk.telstra.net [139.130.53.38])
	by sparticus.bright.net (8.9.3/8.9.3 ComNet Build) with ESMTP id QAA26867
	for ; Sun, 5 Sep 1999 16:08:02 -0400 (EDT)
Received: by toad.ilogic.com.au (Postfix)
	id ADD7325277; Mon,  6 Sep 1999 06:07:55 +1000 (EST)
Delivered-To: csound-unix-dev-list@toad.ilogic.com.au
Received: by toad.ilogic.com.au (Postfix, from userid 91)
	id 85B2A25278; Mon,  6 Sep 1999 06:07:55 +1000 (EST)
Delivered-To: csound-unix-dev@ilogic.com.au
Received: from hyperreal.org (taz.hyperreal.org [209.133.83.16])
	by toad.ilogic.com.au (Postfix) with SMTP id 914C825277
	for ; Mon,  6 Sep 1999 06:07:51 +1000 (EST)
Received: (qmail 26395 invoked by uid 162); 5 Sep 1999 20:07:45 -0000
Message-ID: <19990905200745.26394.qmail@hyperreal.org>
From: est@hyperreal.org
Subject: [CUD] Re: [linux-audio-dev] linux csound real-time input
In-Reply-To: <19990905005820.25319.qmail@hyperreal.org> from "est@hyperreal.org"
 at "Sep 4, 1999 05:58:20 pm"
To: csound-unix-dev@ilogic.com.au,
        linux-audio-dev@ginette.musique.umontreal.ca
Date: Sun, 5 Sep 1999 13:07:45 -0700 (PDT)
X-Mailer: ELM [version 2.4ME+ PL60 (25)]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender: owner-csound-unix-dev@ilogic.com.au
Precedence: bulk
X-Mozilla-Status2: 00000000

est@hyperreal.org discourseth:
> 
> Also, I haven't been able to get -L to work at all.  Trying it with
> `cat >&3| csound -odac -L /dev/fd/3 foo.orc' or on a fifo I get:
> 
> can't reopen (null)

OK, the following patch seems to fix *this* problem:

--- musmon.c~   Thu Aug 12 00:59:58 1999
+++ musmon.c    Sun Sep  5 15:56:06 1999
@@ -221,7 +221,7 @@
         if (O.Beatmode)                        /* if performing from beats */
             settempo((FLOAT)O.cmdTempo);       /*   set the initial tempo  */

-        /*if (!O.RTevents)*/ {               /* *************** */
+        if (!O.Linein) {               /* *************** */
           if (!(scfp = fopen(O.playscore, "r")))
             dies(Str(X_649,"cannot reopen %s"), O.playscore);
         }

Eric


--------------3D5A0BEC6BF766DE73A620B9--



Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09052;
          6 Sep 99 17:33 BST
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 2.12 #1)
	id 11O1i8-00066m-00
	for jpff@maths.bath.ac.uk; Mon, 6 Sep 1999 17:33:40 +0100
Received: from noether [144.173.8.10] by hermes via SMTP (RAA00944); Mon, 6 Sep 1999 17:30:07 +0100 (BST)
Received: from exeter.ac.uk by maths.ex.ac.uk; Mon, 6 Sep 1999 17:29:53 +0100
Received: from rcsreg.rcsreg.com [198.176.199.30] by hermes via SMTP (RAA04548); Mon, 6 Sep 1999 17:29:51 +0100 (BST)
Received: from [63.193.151.229] by rcsreg.com (NTMail 3.02.12) with ESMTP id na029549 for ; Mon, 6 Sep 1999 09:18:49 +0100
Message-ID: <37D3EBF4.D8E99471@rcsreg.com>
Date: Mon, 06 Sep 1999 16:29:40 +0000
From: Tobiah 
X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.7 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Csound List 
Subject: Starting Csound sound...
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Ever get tired of opening an editor buffer and starting:

sr = 44100
kr = .....

Blah blah blah.
Takes minutes before you get your first beep out of Csound.
I finally wrote a little script that automates the tedious part.
I call it 'cs' and put it in /usr/local/script.  You give it
an argument which is the name of a directory that it will create.
It puts a basic orc and sco inside with a Makefile that will generate
a beep.

So if you have a quick idea to try out with csound, it is very fast
to just go:
	
	cs foo

and then go into foo and tweek the vanilla orc and sco.

####################### CUT HERE #############################

mkdir $1
cd $1

cat << END > orc
sr      =       44100
kr      =       4410
ksmps   =       10
nchnls  =       1

gasig   init    0

instr 1

        ;***** INITIALIZE *****

        imvol   init    1

        ibegin  init    p2
        idur    init    p3
        ivol    init    p4
        ipitch  init    p5

        ifront  init    .1
        iback   init    idur - ifront

        ;***** INSTRUMENT *****

        aenv    linseg  0, ifront, 1, iback, 0
        asig    oscil   ivol, ipitch, 1

        asig    =       asig * aenv * imvol
        gasig   =       gasig + asig

endin

instr 99
        irevamt init    .1
        ihidec  init    .5

        arev    reverb2 gasig, 10, ihidec

        asig    =       gasig * (1 - irevamt) + arev * irevamt

                out     asig
                gasig   = 0
endin

END

cat << END2 > Makefile
OUTFILE = \$\$SFDIR/test
#OUTFILE = dac
CSFLAGS = -R -W -d -o \$(OUTFILE)

\$(OUTFILE) : orc sco
        csound \$(CSFLAGS) orc sco

END2

cat << END3 > sco
f1 0 65536 10 1 .8 .6 .4 .2 .1
i1 0 3 10000 440
i99 0 4
END3


Received: from wallace.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09163;
          6 Sep 99 17:53 BST
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by wallace.maths.bath.ac.uk with esmtp (Exim 2.12 #1)
	id 11Nyz1-0007PQ-00
	for jpff@maths.bath.ac.uk; Mon, 6 Sep 1999 14:38:55 +0100
Received: from noether [144.173.8.10] by hermes via SMTP (PAA01003); Mon, 6 Sep 1999 15:47:41 +0100 (BST)
Received: from exeter.ac.uk by maths.ex.ac.uk; Mon, 6 Sep 1999 15:47:27 +0100
Received: from exim@wallace.maths.bath.ac.uk [138.38.100.104] by hermes via ESMTP (PAA12144); Mon, 6 Sep 1999 15:47:26 +0100 (BST)
Received: from [138.38.97.36] (helo=maths.Bath.AC.UK ident=mmdf)
	by wallace.maths.bath.ac.uk with smtp (Exim 2.12 #1)
	id 11Nyv6-0007PG-00; Mon, 6 Sep 1999 14:34:52 +0100
From: jpff@maths.bath.ac.uk
To: slinkp@ulster.net
CC: csound@maths.ex.ac.uk
In-reply-to: <37D343FA.60F416CA@ulster.net> (message from Paul Winkler on Mon,
	06 Sep 1999 00:32:58 -0400)
Subject: Re: b statement confusion
References:  <37D343FA.60F416CA@ulster.net>
Date: Mon, 6 Sep 99 15:47:23 BST
Source-Info:  From (or Sender) name not authenticated.
Message-Id: 
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Yes I use b regularly and successfully

But then it was my idea

==John


Received: from wallace.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09339;
          6 Sep 99 18:11 BST
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by wallace.maths.bath.ac.uk with esmtp (Exim 2.12 #1)
	id 11O1Aj-0007ZN-00
	for jpff@maths.bath.ac.uk; Mon, 6 Sep 1999 16:59:09 +0100
Received: from noether [144.173.8.10] by hermes via SMTP (SAA00999); Mon, 6 Sep 1999 18:07:55 +0100 (BST)
Received: from exeter.ac.uk by maths.ex.ac.uk; Mon, 6 Sep 1999 18:07:43 +0100
Received: from mailhub.dartmouth.edu [129.170.16.6] by hermes via ESMTP (SAA04895); Mon, 6 Sep 1999 18:07:42 +0100 (BST)
Received: from dancer.Dartmouth.EDU (dancer.dartmouth.edu [129.170.208.7])
	by mailhub.dartmouth.edu (8.9.3+DND/8.9.3) with ESMTP id NAA19802;
	Mon, 6 Sep 1999 13:07:35 -0400 (EDT)
Message-id: <8920711@dancer.Dartmouth.EDU>
Date: 06 Sep 1999 13:07:35 EDT
From: Eric Lyon 
Subject: Csound as filter
To: Csound List 
Cc: Paul Winkler 
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Paul Winkler wrote:
>>
What about storing the length of input in an
environment variable?

let's use the hypothetical scripts "flanger" and "echo".

You might call them like this:
flanger -i input.wav | echo -o output.wav

Here's what happens:
1. "flanger" sees that it has the "-i input.wav" arguments and =
decides
that it must call sndinfo, parse the result to find lenght of =
input.wav.
2. Length in sec. is stored in environment as $WAVLENGTH
3. echo sees that it does not have a "-i" argument and thus assumes =
its
input is from stdin.  So it looks to $WAVLENGTH for the duration to =
use.
It also modifies $WAVLENGTH if it will be changing the length. This =
is
so subsequent filters in the pipe get the new length correct.
>>

Another approach is to concatenate the processes directly into a =
new
Csound orc, thus obviating the need to pass the samples through a =
pipe.
Then you can mix and match your processes at will and have =
documentation
in synthetic orcs which you could also use for live processing. =
(See http://arcana.dartmouth.edu/cgi-bin/eric/CPROC/index.cgi
for an example.)

I don't understand why Csound would require a duration parameter if =
it is reading
samples from stdin. At most, duration should be an optional =
parameter to limit how
many samples are processed.

Eric Lyon


Received: from shaun.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa10210;
          7 Sep 99 3:27 BST
Received: from [144.173.6.14] (helo=exeter.ac.uk)
	by shaun.maths.bath.ac.uk with esmtp (Exim 2.12 #1)
	id 11OAyJ-0006GN-00
	for jpff@maths.bath.ac.uk; Tue, 7 Sep 1999 03:26:59 +0100
Received: from noether [144.173.8.10] by hermes via SMTP (DAA08449); Tue, 7 Sep 1999 03:22:55 +0100 (BST)
From: matthew.armour@immi.gov.au
Received: from exeter.ac.uk by maths.ex.ac.uk; Tue, 7 Sep 1999 03:22:44 +0100
Received: from bertha.au.csc.net [203.0.101.101] by hermes via ESMTP (DAA11792); Tue, 7 Sep 1999 03:22:41 +0100 (BST)
Received: from c3w-fwb (c3w-fwb [203.0.101.98])
	by bertha.au.csc.net (8.9.1a/8.9.1) with SMTP id MAA06885
	for ; Tue, 7 Sep 1999 12:17:37 +1000 (EST)
Received: by C3W-NOTES.AU.CSC.NET(Lotus SMTP MTA v4.6.3  (733.2 10-16-1998))  id 4A2567E5.000CB42B ; Tue, 7 Sep 1999 12:18:45 +1000
X-Lotus-FromDomain: IMMI@C3EXTERNAL
To: csound@maths.ex.ac.uk
Message-ID: <4A2567E5.000CB3D8.00@C3W-NOTES.AU.CSC.NET>
Date: Tue, 7 Sep 1999 12:11:40 +1000
Subject: Re: Starting Csound sound...
Mime-Version: 1.0
Content-type: text/plain; charset=us-ascii
Content-Disposition: inline
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

I use PFEdit on windows/dos platform.  It's very easy to create standard the
csound "templates" that you're talking about.  Also you can map the function
keys to start and pass the file.CSD to any version of Csound you have installed!
PFedit is my Csound "shell" - it's a small FREE editor that's very easily
customisable with straightforward help.

You can get it at:  http:/www.lancs.ac.uk/people/cpaap/pfe

!M