Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alda play --code misinterprets snippets with custom instrument names #408

Closed
elydpg opened this issue Nov 8, 2021 · 7 comments
Closed

Comments

@elydpg
Copy link
Contributor

elydpg commented Nov 8, 2021

🐞 Bug report 🐞

Description

I found that trying to play a code snippet with custom instruments behaves in an unexpected way.

An easy test case is the following code snippet: piano "pi-1": c d e f g piano "pi-2":c < b a g f

Playing this on PowerShell using the command alda play --code "piano `"pi-1`": c d e f g piano `"pi-2`": c < b a g f" (I believe on Bash it would be alda play --code "piano \"pi-1\": c d e f g piano \"pi-2\": c < b a g f") prodces the error message <no file>:1:1 undefined variable: piano. Saving the snippet to a file and playing with alda play --file runs normally.

It seems to cause problems even if the instruments are on separate lines, as in

alda play --code "piano `"pi-1`": c d e f g
piano `"pi-2`": c < b a g f"
@elydpg elydpg added the bug label Nov 8, 2021
@daveyarwood
Copy link
Member

This works for me in my Bash shell:

alda play -c 'piano "pi-1": c d e f g piano "pi-2":c < b a g f'

Based on this, it looks like you can use single quotes in PowerShell too. Can you try the snippet above?

I'm not sure why the version with the backticks wouldn't work as well, based on what I read in the article that I linked. 🤷‍♂️

@elydpg
Copy link
Contributor Author

elydpg commented Nov 9, 2021

I tried the snippet above. Same problem

@daveyarwood
Copy link
Member

I'm stumped. No idea why that wouldn't work, unless quoting works completely unexpectedly in PowerShell. 🤨

@elydpg
Copy link
Contributor Author

elydpg commented Nov 9, 2021

Ok, where it gets even weirder is that Windows CMD (arguably a much "dumber" shell) has no problem with it, so long as you escape the quotes properly: alda play --code "piano \"pi-1\": c d e f g piano \"pi-2\": c < b a g f". However, running what you suggested in cmd tells me The system cannot find the file specified. And running alda play --code "piano "pi-1": c d e f g piano "pi-2": c < b a g f" gives me the same <no file>:1:1 undefined variable: piano error message I was seeing in PowerShell. I am honestly so confused...

@daveyarwood
Copy link
Member

That error message makes "sense" to me in that that's the error message I would expect if you ran this:

alda play -c "piano " 

It seems like because of some Windows-specific shell quoting issues that I don't understand, it isn't actually escaping the first double quote after piano.

@daveyarwood
Copy link
Member

And I have heard that single quotes don't work in CMD, for what it's worth.

@daveyarwood
Copy link
Member

It seems clear to me that this is an issue with the way that quoting works in CMD and PowerShell, and not a bug in Alda, so closing this issue. Happy to reopen it if there are other perspectives!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants