hlolli / csound-mode

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

elisp error: Symbol’s function definition is void: string-join #3

Closed agraef closed 4 years ago

agraef commented 6 years ago

Playing around with the REPL, I've run into another issue:

Symbol’s function definition is void: string-join

This comes up whenever I try to invoke one of the interaction functions csound-evaluate-line and csound-evaluate-region.

Apparently Emacs 25 is supposed to have this (at least I can find some spurious refs to it on the interwebs), but my Emacs 25.3.1 certainly does not. Maybe it's a non-standard extension? What does C-h f string-join give in your Emacs?

A more portable implementation would probably be to use something like mapconcat 'identity, cf. https://stackoverflow.com/questions/18979300/how-to-convert-list-to-string-in-emacs-lisp?

agraef commented 6 years ago

Also, if I define string-join using mapconcat, I'm getting past this, but then it complains about hlt-highlight-region not being defined. This apparently comes from highlight.el which apparently isn't included in Emacs 25.3.1 either.

agraef commented 6 years ago

I seem to vaguely recall that highlight.el, now available on emacswiki, is a package from bygone days that used to be part of Emacs, but fell out of use when font-lock came along. It isn't on MELPA either (well, it's listed on the website, but the wiki packages don't show up in the package manager any more). So I'm not sure that it's a good idea to depend on this, even though it still seems to be maintained on emacswiki.

Anyway, I just downloaded it from there, installed it in my site-lisp and loaded it in my .emacs, and both csound-evaluate-line and csound-evaluate-region seem to work now. Well, at least they don't throw any errors any more, although I'm still not getting any sound from the REPL. But that's something for another bug report, I guess. :)

agraef commented 6 years ago

Just for the record, here's my definition of string-join which I had to add to csound-mode.el to make that first error go away:

(defun string-join (sl delim)
  (mapconcat 'identity sl delim))
agraef commented 6 years ago

Ok, I guess next I'll have to dig out the video of your talk at ICSC2017 on YouTube to figure out how to actually use the REPL, since I'm not getting any sound from it, there's no output there after the command prompt appears, and typing stuff at the command prompt there doesn't seem to do anything either. So I'm a bit at a loss, as this isn't really described in your ICSC paper either. Is there any usage instructions for the REPL anywhere?

hlolli commented 6 years ago

Not at the computer, feverish today. But when the repl buffer is open, you should be able to a leadt write score statements into the prompt. C-M-x shpuld send a code snippet into the instance. Are you seeing csound event logs being printed into the repl buffer when you semd them.

I will look at this later today and fix the missing functions, glad youre finding this :)

On Thu, 26 Oct 2017 at 07:14, Albert Graef notifications@github.com wrote:

Ok, I guess next I'll have to dig out the video of your talk at ICSC2017 on YouTube to figure out how to actually use the REPL, since I'm not getting any sound from it, there's no output there after the command prompt appears, and typing stuff at the command prompt there doesn't seem to do anything either. So I'm a bit of a loss, as this isn't really described in your ICSC paper either. Is there any usage instructions for the REPL anywhere?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hlolli/csound-mode/issues/3#issuecomment-339553580, or mute the thread https://github.com/notifications/unsubscribe-auth/AFyxgv5CoXhyir9juxnHR_S1XdFXufjUks5swBVLgaJpZM4QGhjt .

agraef commented 6 years ago

Are you seeing csound event logs being printed into the repl buffer when you semd them.

Nope, the input line I'm feeding with C-x C-e flashes, but nothing gets printed in the REPL window. I'm suspecting that csound doesn't access the right audio device (I'm using Jack), how can I configure that? CsOptions don't seem to get picked up.

hlolli commented 6 years ago

No that's right, I need to document that, that won't get picked up, only when you really compile the file. Your best chance to adjust your audio device would be to do something like this in the ~/.csound6rc

-r44100 -b1024 -B2048 -+rtaudio=jack -odac:system:playback_

or adjust the values fitting to your jack config.

This is really strange that from emacs core ecosystem string-join and hlt-highlight-region is removed. I'm running emacs compiled from git which prints version 26.0.50. I'll use your string-join function, or evaluate it based on if that symbol is bound or not. I'll investigate further...

hlolli commented 6 years ago

But I'll add, that I for sure can implement some functionality that reads the config in CsOptions. But I still think that a global config is a better solution, because it's also a question of opening many .csd files quickly, as well as .sco and .orc files, and you can be sure that the repl starts when you've set your global config.

agraef commented 6 years ago

Your best chance to adjust your audio device would be to do something like this in the ~/.csound6rc

Fair enough. I have this in my .csound6rc:

-+rtmidi=alsaseq -M MPKmini2 -+rtaudio=jack -o dac

This works if I launch csound from the command line; in qjackctl, I can see see the csound audio and MIDI ports appearing and the connections being made. But nothing like that ever happens when I launch the REPL in Emacs. For all intents and purposes, the embedded csound doesn't seem to launch at all.

But I'll add, that I for sure can implement some functionality that reads the config in CsOptions. But I still think that a global config is a better solution, because it's also a question of opening many .csd files quickly, as well as .sco and .orc files, and you can be sure that the repl starts when you've set your global config.

That makes sense to me. Still, the REPL really needs a lot more documentation. It's not obvious how to use it.

Also, how am I supposed to debug this, given that the REPL doesn't appear to work for me? Do you have a little elisp program which I can run interactively to see whether the Emacs csound module is working at all?

agraef commented 6 years ago

Here's how it looks like over here. No sign of any action, I'm afraid. ;-)

csound-repl

hlolli commented 6 years ago

@agraef sorry for all this delay, I've finally pushed snapshot version of csound based on udp (this api and c compilation is now histoy). If/when you have time to try it out, then you need to compile csound from its dev branch as I'm relying on features very recently implemented.

And I've added so that sr,ksmps,nchnls and 0dbfs in a given buffer/file will overwrite the default config or global config file. This does tough not include in CsOptions when those are given as command line flags, I need more time to add that as well.

agraef commented 6 years ago

Ok thanks. Wow, that innocent-looking issue prompted quite a major revision! ;-) It's probably a good idea to avoid dependency on a C module, though, that really complicated things.

Unfortunately, we're running the latest stable csound release in the lab, so I guess that we'll have to wait until csound 6.10 is out before we can give the REPL another go again.

hlolli commented 5 years ago

@agraef Did you give the repl another go?