hlolli / csound-mode

Emacs major mode for coding in Csound
41 stars 13 forks source link

REPL / Interactive code evaluation #27

Open ghost opened 1 year ago

ghost commented 1 year ago

excuse me if am interpreting this wrong... here is my .csd file

<CsoundSynthesizer>
<CsOptions>

-odac                           ; realtime audio out
; -o noise.wav -W               ; for file output any platform

</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 1
0dbfs  = 1

instr 1 ; oscillator

 ; i1 str dur fn amp pch att rel
 ; 1   2   3  4   5   6   7   8  ;

 ifn  = p4
 kamp = p5
 ipch = p6 + 4
 ; print ipch ; PRINT FUNCTION! ;
 ascil oscil kamp, cpspch(ipch), ifn
 knlope adsr p7, 0, 1, p8
 outs ascil * knlope
 endin

instr 2 ; pluck

 ; i2 str dur fn amp pch att rel meth pam1 pam2
 ; 1   2   3  4   5   6   7   8   9    10   11  ;

 ifn = p4
 kamp = p5
 ipch = p6 + 4
 imeth = p9
 aluck pluck kamp, cpspch(ipch), cpspch(ipch), ifn, imeth, p10, p11
 knlope adsr p7, 0, 1, p8
 out aluck * knlope
 endin

</CsInstruments>
<CsScore>

; wavetables ;
f1 0 8192 10 1 ; 8192 point sine
f2 0 1024 7 1 512 1 0 -1 512 -1 ; square

m oii ; >.<
i1 0 2.5 1 .25 4.05 .5 .5
s

</CsScore>
</CsoundSynthesizer>

so after C-c C-z to start repl i evaluate both instruments with C-c C-c and then i try to C-x C-e the score i1 0 2.5 ... but Emacs throws me Symbol's function definition is void: lexical-let* am i wrong to think that my sequence above would play that little score block interactively (without doing the C-c C-p | csound-play)? i tried to read about csound REPL by Googling but since i am a rookie, i got no satisfactory answer...

Emacs 27.1 csound-mode 0.2.9 Csound 6.14

hlolli commented 1 year ago

You found a bug, so modules are more isolated in emacs 27 and lexical-let is part of 'cl and not 'cl-lib, and its import was missing, I pushed a bugfix but I didn't push a new version, so it will be included when I bump the version where it will be available then on melpa.

ghost commented 1 year ago

now it is throwing me;

rtevent: T245.122 TT245.122 M:
  0.00000  0.00000
new alloc for instr 1:
INIT ERROR in instr 1 line 10: 
Invalid ftable no. 1.000000

ascil   
oscil.a 
kamp    
#i1 
ifn 
0   

           T245.122
 - note deleted.  i1 had 1 init errors

also when initializing Emacs it says: Package cl is deprecated

hlolli commented 1 year ago

I see, as for the table error, you need to evaluate

f1 0 8192 10 1 ; 8192 point sine

or perhaps define it in orchestra using ftgen opcode and refer to it there.

cl being deprecated, I have it too now that I look into my message buffer. Let me see if there's an alternative approach.

ghost commented 1 year ago
rtevent: T 71.518 TT 71.518 M:
  0.00000  0.00000
INIT ERROR in instr 1 line 10: 
Invalid ftable no. 1.000000

ascil   
oscil.a 
kamp    
#i1 
ifn 
0   

           T 71.518
 - note deleted.  i1 had 1 init errors

same error after evaluation... and i had to remove the comment on f1 0 8192 10 1 ; 8192 point sine otherwise it says: Wrong type argument: stringp, nil

ghost commented 1 year ago

using, gisine ftgen 1, 0, 16384, 10, 1 ;sine wave evaluating it and then trying to play the score, produces no sound and this output,

rtevent: T 82.873 TT 82.873 M:
  0.00000  0.00000

playing with csound-play works

hlolli commented 1 year ago

you are mixing csound-score language syntax and csound-orchestra language syntax :)

hlolli commented 1 year ago

can you pull from master again and tell me if the issue regarding lexical-let/cl is better?

ghost commented 1 year ago

you are mixing csound-score language syntax and csound-orchestra language syntax :)

what do you mean? i added gisine ftgen 1, 0, 16384, 10, 1 ;sine wave at CsInstruments if it is what you are trying to point :D

and regarding lexical-let/cl, Emacs now does not throw me any message

ghost commented 1 year ago

ok i got something by adding a space on p1, i 1 1 2.5 1 .25 4.05 .5 .5 instead of i1 1 2.5 1 .25 4.05 .5 .5 which was not making any sound on repl mode! but strangely, it makes noise if i use csound-play T.T