csound / csound-vscode-plugin

Plugin for Csound Language support in Visual Studio Code
MIT License
25 stars 8 forks source link

Internationalized quotes issue? #16

Open tgrey1 opened 4 years ago

tgrey1 commented 4 years ago

Hey Steven!

I'm not a user of vscode, but I'm trying to get to the bottom of a problem that may or may not involve this plugin... either way, it's a great first step in the search for a solution ;)

In the process of refreshing the csound manual, I noticed some of the example drafts @AsterixMusic was posting didn't compile when I tried. I tracked it down to this line: ain1 diskin “fox.wav”, 1, 0

Which works fine if I delete the quote marks and retype them, so it now reads: ain1 diskin "fox.wav", 1, 0

The first example Stefano created using an international layout keyboard, and is running them through vscode and this plugin to test (hence why I'm starting here).

I thought perhaps the editor itself is sanitizing the text before sending it to the api, so the plugin and csound itself has no idea the difference quotes ever existed! My other thought is that perhaps csound on the console behaves different than api, and I test on console whereas Stefano uses vscode and the plugin which I think is using api. But both of those are wild guesses, and I could be completely wrong.

Either way... just trying to figure out why this is happening, and whether or not a csound issue is relevant requesting that csound treat both style of quotes as the same (no idea if that has other implications tho).

kunstmusik commented 4 years ago

I'm not sure regarding conversion of quotes in VSCode. I don't believe there is any code to convert in this vscode extension nor in csound. The only time I've seen quotes like that myself show up is when using Microsoft Word.

tgrey1 commented 4 years ago

Same here, it's not something I've seen or dealt with before... I'm just really stumped as to why it works is vscode but nowhere else. My thought then is perhaps raise the issue to the main csound list suggesting that csound treat both versions the same unless someone knows a good reason not to. This would probably help in some (albeit rare) confusion for international keyboard layout users.

kunstmusik commented 4 years ago

Is there a CSD and steps to reproduce I could follow to diagnose?

tgrey1 commented 4 years ago

It came up in this issue: https://github.com/csound/manual/issues/216 But I saw it in a few others too before I realized what was going on. I think @AsterixMusic has edited the original posts since then, now that we know it's a problem.

Either way, this example should get the idea across:

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o repluck_advanced.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; By Stefano Cucchi 2020

sr = 44100 
ksmps = 10 
0dbfs  = 1  
nchnls = 2

instr 1

iplk  = p4
kamp  = p5
icps  = p6

krefll randomi 0.52, 0.99, 0.61
kpickl randomi 0.1, 0.9, 13

kreflr = p7
kpickr = p8

; does not work
ain1 diskin “fox.wav“, 1, 0

; works
; ain1 diskin "fox.wav", 1, 0

asigl repluck iplk, kamp, icps, kpickl, krefll, ain1
asigl dcblock2 asigl    

asigr repluck iplk, kamp, icps, kpickr, kreflr, ain1
asigr dcblock2 asigr

kdeclick linseg 0, 0.05, 1, p3-0.1, 1, 0.05, 0

outch 1, asigl * kdeclick
outch 2, asigr * kdeclick
endin

</CsInstruments>
<CsScore>

i 1 0 4 0.11 0.5 69 0.9 0.11
i 1 3 4 0.11 0.5 12 0.9 0.11
i 1 6 4 0.41 0.5 1 0.2 0.11
i 1 9 4 0.11 0.5 300 0.9 0.99
i 1 12 4 0.11 0.5 182 0.9 0.99
i 1 15 15 0.99 0.5 12.039 0.9 0.11

e
</CsScore>
</CsoundSynthesizer>