BelaPlatform / Bela

Bela: core code, IDE and lots of fun!
Other
489 stars 138 forks source link

Upload 101.csd from The Csound Book into new Csound project #610

Open csounder opened 4 years ago

csounder commented 4 years ago

For some reason, it does upload/import the .csd file, but it will not render/run it. Rather, it still keeps rendering _main.csd, making sound for a few milliseconds, and then crashing. How can I render Csound files from The Csound Manual or The Csound Book on the Bela?

Here is 101.csd - simple enough

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr      =       44100
kr      =       4410
ksmps   =       10
nchnls  =       1

        instr   101
a1      oscil   10000, 440, 1
        out     a1
        endin

</CsInstruments>
<CsScore>
;Function 1 uses the GEN10 subroutine to compute a sine wave
f 1  0 4096 10   1 
; inst  start   duration
i 101       0       3
</CsScore>
</CsoundSynthesizer>
giuliomoro commented 4 years ago

on Bela, csound will always run the file called _main.csd (similarly to what it does for _main.pd and _main.scd for Pd and SuperCollider). If renaming the file before uploading it is not an option, from the IDE, you can delete the old _main.csd and rename the newly uploaded file to _main.csd.

csounder commented 4 years ago

I will try this shortly. Thanks for the advice

csounder commented 4 years ago

Thanks for the info. This is working perfectly. What I did notice, however, is that the default _main.csd that is loaded in when you create a New Csound Project has some sort of bug. It only passes audio for a few hundred ms and then quits. Possibly another default should be loaded?


Dr. Richard Boulanger Professor of Electronic Production and Design Professional Writing and Music Technology Division Berklee College of Music


OFFICE: 1126 Boylston St., Suite 201 (EPD), Suite 208 (Boulanger)


President of Boulanger Labs - http://boulangerlabs.com Author & Editor of The Csound Book - http://mitpress.mit.edu/books/csound-book Author & Editor of The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book


about: http://www.boulangerlabs.com/#about about: http://www.csounds.com/community/developers/dr-richard-boulanger/ music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/


email: rboulanger@berklee.edu facebook: https://www.facebook.com/richard.boulanger.58

On Sun, Feb 23, 2020 at 7:29 PM giuliomoro notifications@github.com wrote:

on Bela, csound will always run the file called _main.csd (similarly to what it does for _main.pd and _main.scd for Pd and SuperCollider). If renaming the file before uploading it is not an option, from the IDE, you can delete the old _main.csd and rename the newly uploaded file to _main.csd.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BelaPlatform/Bela/issues/610?email_source=notifications&email_token=AALWYFVC5BO6TLAPVMT6HY3REMIFDA5CNFSM4KZ6R5IKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMWMBFQ#issuecomment-590135446, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALWYFVZ7JJ4OQUDJ2X3VJLREMIFDANCNFSM4KZ6R5IA .

giuliomoro commented 4 years ago

I know nothing about csound, would you be able to suggest an edit to make it last forever?

giuliomoro commented 3 years ago

With a modern version of the Bela code (one whose core code was updated after May 20 2020 (74eb2a59738e16ae3057e3978b115bbbcf030881, image v0.3.8a is the first that ships with this)), you can have the IDE run the current open .csd file on your board by creating a file in /root/Bela/CustomMakefileTop.in and placing the following into it:

ifdef PROJECT
ifndef CSOUND_FILE
PROJECT_SETTINGS_JSON = $(PROJECT_DIR)/settings.json
CURRENT_FILENAME = $(shell cat $(PROJECT_SETTINGS_JSON) 2> /dev/null | tr "," "\n" | grep "fileName.*\.csd\>" | sed 's/.*"fileName"\s*:\s*"\(.*\.csd\>\)"/\1/' )
override CSOUND_FILE = $(PROJECT_DIR)/$(CURRENT_FILENAME)
endif
endif