Git Product home page Git Product logo

belaplatform / supercollider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from supercollider/supercollider

14.0 14.0 8.0 135.69 MB

an environment and programming language for real time audio synthesis and algorithmic composition

License: GNU General Public License v3.0

CMake 0.36% HTML 0.06% JavaScript 0.07% CSS 0.05% C++ 91.94% Objective-C++ 0.09% SuperCollider 4.32% C 2.05% Shell 0.03% Python 0.41% Makefile 0.01% Perl 0.01% XSLT 0.01% Objective-C 0.01% NSIS 0.01% Lex 0.02% Yacc 0.03% Batchfile 0.01% Scala 0.52% Rich Text Format 0.01%

supercollider's People

Contributors

bagong avatar crucialfelix avatar danstowell avatar dyfer avatar eleses avatar geoffroymontel avatar gusano avatar jamshark70 avatar jleben avatar joshpar avatar jrh-zz avatar lfsaw avatar lijon avatar llloret avatar lnihlen avatar miguel-negrao avatar mossheim avatar mtmccrea avatar muellmusik avatar patrickdupuis avatar redfrik avatar scztt avatar sensestage avatar shimpe avatar smrg-lm avatar sonoro1234 avatar telephon avatar timblechmann avatar vdonnefort avatar vivid-synth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

supercollider's Issues

Build errors with latest Bela code

one is due to g++-4.8 not being aware of some C++11 functionalities inBela/core/Midi.cpp, the other is due to having to link in an additional library in Bela/lib/libmathneon.a. I will try to fix them from the Bela side of thing.

Current workaround is to compile with make VERBOSE=true and manually edit and run the calls that fail, replacing gcc with clang for the former and adding /root/Bela/lib/libmathneon.a at the end of the latter.

Out.ar and SoundIn.ar ranges are inconsistent

It looks like Out.ar expects -1..1 and outputs that mapped to 0..5v on the bela analog out or the full range as expected if you have the audio expander caplet, but SoundIn.ar maps the 0..4v bela analog input or full range of the audio expander caplet, to 0..1 in software should probably pick one or another.

I'd suggest Out and SoundIn use -1..1 and then let AnalogIn/AnalogOut use the 0..1 mapping.

I'm running scsynth 3.8dev and sclang 3.8dev from the latest bela image Bela image, v0.2.0b_stable, 15 December 2016

I posted about this in #24 as well as they're related.

std::system_error thrown when building with all appropriate Xenomai flags

If I compile with the appropriate xenomai flags, as returned by /usr/xenomai/bin/xeno-config --skin posix --ldflags:

-Wl,@/usr/xenomai/lib/posix.wrappers -L/usr/xenomai/lib -lpthread_rt -lxenomai -lpthread -lrt

Then scsynth dies with terminate called after throwing an instance of 'std::system_error'

Printing "UGen(AnalogIn): 0.694458" causes mode switches

e.g.: when running


// ak
(
SynthDef("AnalogIn",{ arg out=0;
    Out.ar(out,
        SinOsc.ar( AnalogIn.ar( 0 ).poll.exprange( 200, 5000 ), 0, 0.1 )
    )
}).send(s);
);

a = Synth.new("AnalogIn", target: s).postln;

While this would be fixed with #26, as printf would automatically be wrapped by rt_printf, it is probably better to set SetPrintFunc(rt_printf) somewhere.

`sclang` uses 80% CPU

Just start it with a patch like this (i.e.: doing nothing) and - once scsynth has booted, you will get CPU usage around 80% for sclang.
It should not affect much the performance of the audio (as that runs at a higher priority), but it may affect, e.g.: the networking/OSC stuff?

  • note that the CPU usage reported by top is as percentage where 100% corresponds to whatever has been left over from Xenomai (for instance if your audio is using 25% CPU, as reported by cat /proc/xenomai/stat, then 100% reported by top will actually be 75%).

Proper Xenomai inter-process communication (IPC)

The issue is that staticMAudioSync->Signal(); (which in turns calls std::condition_variable_any::notify_one ) was causing a mode switch in the audio thread.
We removed the mode switch from the audio thread by moving it to another thread:

    // this avoids Xenomai mode switches in the audio thread ...
    Bela_scheduleAuxiliaryTask(mAudioSyncSignalTask);
}

void SC_BelaDriver::staticMAudioSyncSignal(){
    // ... but mode switches are still happening here, in a lower priority thread.
    // FIXME: this triggers a mode switch in Xenomai.
    staticMAudioSync->Signal();
    rt_task_suspend(rt_task_self());
}

, still this is inelegant, non-deterministic and adds to the CPU load.

The proper way around this is to rewrite common/SC_SyncCondition.h and common/SC_lock.h so that they use Xenomai-specific IPC functions instead of condition_variable_any and std::mutex.
The discussion here shows a possible method using RT_COND, rt_cond_wait, rt_cond_signal, RT_MUTEX, rt_mutex_acquire, rt_mutex_release

Updated Bela API

There is a small (but breaking) change in the Bela API which requires that AuxiliaryTask functions take a (void*) argument.
Another change (the addition of a .c file) makes linking stages fail.

Scsynth - Bela UGens not received

This is the error I get on the Bela when trying to send a SynthDef with AnalogInput in it from my computer.

exception in GraphDef_Recv: UGen 'AnalogInput' not installed.

When launching the examples with sclang directly on the Bela, it works fine. I get the error when I want to send the SynthDef from my main computer, where the extension is correctly installed.

DigitalOutput.kr not behaving as expected

The following code doesn't behave as expected, when wired up with a LED from pin 6 (the basic digital output example).
The LED does blink, but from a 'dim' state to a 'fully lit' state ... with no fully off state.
LFPulse.kr is returning a proper 0 and 1 value according to poll..
this works as expected when using .ar calls instead of .kr

s.options.numAnalogInChannels = 8;
s.options.numAnalogOutChannels = 8;
s.options.numDigitalChannels = 16;
s.options.maxLogins = 64;  	   // set max number of clients

s.options.pgaGainLeft = 4;     // sets the pga gain of the left channel to 4 dB
s.options.pgaGainRight = 5;    // sets the pga gain of the right channel to 5 dB
s.options.headphoneLevel = -8; // sets the headphone level to -8 dB
s.options.speakerMuted = 0;    // the speakers are not muted (so active)
s.options.dacLevel = -5;       // sets the gain of the dac to -5 dB
s.options.adcLevel = -3;       // sets the gain of the adc to -3 dB
s.options.numMultiplexChannels = 0; // do not enable multiplexer channels

s.options.blockSize = 16;
s.options.numInputBusChannels = 2;
s.options.numOutputBusChannels = 2;

s.options.postln;

s.waitForBoot{
	"Server Booted".postln;
	{
		DigitalOut.kr(6, LFPulse.kr(0.5).poll(1), 0);
	}.play;
};

belaServer command sending crashes

Running SC server on the bela and sending commands from SC IDE to bela to make sounds. Following example consistently crashes bela, can't access the bela IDE or my finder, so have to just pull out of USB socket.

Server.default = s = Server("belaServer", NetAddr("192.168.7.2", 57110));
s.initTree;
s.startAliveThread;

(
{
Mix(
    Resonz.ar(          //The Resonz filter has arguments input, freq, rq=bandwidth/centre frequency
        Saw.ar([440,443,437] + SinOsc.ar(100,0,100)), //frequency modulated sawtooth wave with chorusing
        XLine.kr(10000,10,10), //vary filter bandwidth over time
        Line.kr(1,0.05, 10), //vary filter rq over time
        mul: LFSaw.kr(Line.kr(3,17,3),0,0.5,0.5)*Line.kr(1,0,AnalogIn.ar( DC.ar( 0 ) ).exprange( 2, 10 ))  //AM
    )
)
}.play
)

Thanks!

Make special BELA pattern for bela-specific command line arguments.

If we keep adding Bela options to SC we could quickly run out of letters.
We could think to redesign the SC Bela-related command line options so that they take something like
--bela "-C 8 --pga-left -9 -H 0"
so that we do not need to implement that on both sides AND we save letters.

MIDI on Bela

MIDI on Bela in sclang seems not to be working.
It may be an issue with the alsa backend not registering the MIDI devices properly.

DiskIO UGens cause mode changes

DiskOut: mode changes are happening.
Probably this will also happen with DiskIn.

DiskIO_UGens create a disk io thread that runs in non real time to write the buffer to disk

Installed Quarks are not compiled

Quarks on Bela install to /root/.local/share/SuperCollider/downloaded-quarks, but when compiling Bela only looks in /usr/local/share/SuperCollider/Extensions and /usr/local/share/SuperCollider/SCClassLibrary.

Moving /root/.local/share/SuperCollider/downloaded-quarks to /usr/local/share/SuperCollider/downloaded-quarks also does not work.

Current workaround is to move /root/.local/share/SuperCollider/downloaded-quarks to /usr/local/share/SuperCollider/Extensions

cannot build

Just now I cannot build. All the object files are generated, but both sclang and scsynth fail to link properly. I followed the instructions in the README, anything else I should do?

I am on 2bbfa5f

scsynth fails to link as follows:

root@bela ~/supercollider/build/lang$ /usr/lib/ccache/g++-4.8    -march=native -std=c++11 -mfloat-abi=hard -mfpu=neon -O2 -g -DNDEBUG  -std=c++11   CMakeFiles/sclang.dir/LangSource/cmdLineFuncs.cpp.o  -o sclang -rdynamic libsclang.a -lpthread ../external_libraries/hidapi/linux/libhidapi.a -ludev ../external_libraries/hidapi/hidapi_parser/libhidapi_parser.a ../external_libraries/libboost_thread.a ../server/scsynth/libscsynth.a ../external_libraries/libtlsf.a ../external_libraries/libboost_system.a -ldl /usr/xenomai/lib/libxenomai.so -L/usr/xenomai/lib -L/usr/lib/arm-linux-gnueabihf -lrt -lnative -lxenomai -lprussdrv -lpthread_rt -lfftw3f -lreadline -lasound /usr/local/lib/libsndfile.so -lrt ../external_libraries/libyaml.a -Wl,-rpath,/usr/xenomai/lib:/usr/local/lib:
libsclang.a(OSCData.cpp.o): In function `prBootInProcessServer(VMGlobals*, int)':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:989: undefined reference to `SetPrintFunc'
/root/supercollider/lang/LangPrimSource/OSCData.cpp:1069: undefined reference to `World_New'
libsclang.a(OSCData.cpp.o): In function `getScopeBuf(unsigned int, SndBuf*, bool&)':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:1078: undefined reference to `World_CopySndBuf'
libsclang.a(OSCData.cpp.o): In function `_Bind':
/usr/include/c++/4.8/functional:1342: undefined reference to `World_WaitForQuit'
/usr/include/c++/4.8/functional:1342: undefined reference to `World_WaitForQuit'
libsclang.a(OSCData.cpp.o): In function `netAddrSend':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:336: undefined reference to `World_SendPacket'
    collect2: error: ld returned 1 exit status

sclang fails to link as follows:

Linking CXX executable sclang
cd /root/supercollider/build/lang && /usr/bin/cmake -E cmake_link_script CMakeFiles/sclang.dir/link.txt --verbose=true
/usr/lib/ccache/g++-4.8    -march=native -std=c++11 -mfloat-abi=hard -mfpu=neon -O2 -g -DNDEBUG  -std=c++11   CMakeFiles/sclang.dir/LangSource/cmdLineFuncs.cpp.o  -o sclang -rdynamic libsclang.a -lpthread ../external_libraries/hidapi/linux/libhidapi.a -ludev ../external_libraries/hidapi/hidapi_parser/libhidapi_parser.a ../external_libraries/libboost_thread.a ../server/scsynth/libscsynth.a ../external_libraries/libtlsf.a ../external_libraries/libboost_system.a -ldl /usr/xenomai/lib/libxenomai.so -L/usr/xenomai/lib -L/usr/lib/arm-linux-gnueabihf -lrt -lnative -lxenomai -lprussdrv -lpthread_rt -lfftw3f -lreadline -lasound /usr/local/lib/libsndfile.so -lrt ../external_libraries/libyaml.a -Wl,-rpath,/usr/xenomai/lib:/usr/local/lib:
libsclang.a(OSCData.cpp.o): In function `prBootInProcessServer(VMGlobals*, int)':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:989: undefined reference to `SetPrintFunc'
/root/supercollider/lang/LangPrimSource/OSCData.cpp:1069: undefined reference to `World_New'
libsclang.a(OSCData.cpp.o): In function `getScopeBuf(unsigned int, SndBuf*, bool&)':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:1078: undefined reference to `World_CopySndBuf'
libsclang.a(OSCData.cpp.o): In function `_Bind':
/usr/include/c++/4.8/functional:1342: undefined reference to `World_WaitForQuit'
/usr/include/c++/4.8/functional:1342: undefined reference to `World_WaitForQuit'
libsclang.a(OSCData.cpp.o): In function `netAddrSend':
/root/supercollider/lang/LangPrimSource/OSCData.cpp:336: undefined reference to `World_SendPacket'
collect2: error: ld returned 1 exit status
make[3]: *** [lang/sclang] Error 1
make[3]: Leaving directory `/root/supercollider/build'
make[2]: *** [lang/CMakeFiles/sclang.dir/all] Error 2
make[2]: Leaving directory `/root/supercollider/build'
make[1]: *** [lang/CMakeFiles/sclang.dir/rule] Error 2
make[1]: Leaving directory `/root/supercollider/build'
make: *** [sclang] Error 2

Ndef not functional remotely

Ndefs seem also not to work when coding remotely on the Bela.
The following code doesn't throw any errors, but produces no signal at either output.

s = Server.new('belaServer', NetAddr("192.168.7.2", 57110));
s.initTree;
s.startAliveThread;
Ndef(\sintone -> 'belaServer', {
    AnalogOutput.ar( DC.ar( 0 ), SinOsc.ar(440).range(0.0, 0.5) ); // output channel must be audio rate
    Out.ar( 0, SinOsc.ar(440) );
}).play;

Whereas the following works fine:

x = {
    AnalogOutput.ar( DC.ar( 0 ), SinOsc.ar(440).range(0.0, 0.5) );
    Out.ar( 0, SinOsc.ar(440) );
}.play(target: s);

Server fails to start with `s.options.blockSize` != 16

s = Server.default;
s.options.numAnalogInChannels = 8;
s.options.numAnalogOutChannels = 8;
s.options.numDigitalChannels = 16;
s.options.blockSize = 32;
s.options.numInputBusChannels = 2;
s.options.numOutputBusChannels = 2;
s.options.postln;

s.waitForBoot({
});

if s.options.blockSize != 16 then the server cannot be started and it errors out terminate called without an active exception.
Note that 16 is the default blocksize for Bela.

`scprintf` from within scsynth does not work when running `sclang`

That's funny. I believe it is a xenomai issue:
scprintf is set to call rt_vprintf, which in turn requires a call to rt_print_auto_init(1) to properly work (though this does not seem to be always the case). Anyhow, it boils down to:
"rt_vprintf does not work when scsynth is started by sclang".

So for now, do not rely on the output from scprintf when running sclang.

Server->Client communication is unrealible when working remotely

When using Bela as a remote server (controlled via the IDE on my Macbook), the server responsiveness via OSC is either unreliable or disfunctional. Server status info in the bottom right of the IDE is available sometimes and sometimes not. Some server/language communication features even crash scsynth (for example, using the poll Ugen, or polling control busses from the language)

Include classes for projects

It would be good for each project to have:

  • an optional folder classes
  • which is added to a local sclang_config.yaml file
  • which is then passed onto the startup of sclang

This config-file can also be used for including downloaded quarks.
This would also fix #38

Compile failed on latest BELA image

following instructions on https://github.com/sensestage/supercollider/blob/bela_hackery_v01_master/README_BELA.md, I get the following compile error with the latest BELA image (master):

Building CXX object server/scsynth/CMakeFiles/libscsynth.dir/SC_Bela.cpp.o
/root/supercollider/server/scsynth/SC_Bela.cpp: In constructor ‘SC_BelaDriver::SC_BelaDriver(World*)’:
/root/supercollider/server/scsynth/SC_Bela.cpp:108:100: error: invalid conversion from ‘void (*)()’ to ‘void (*)(void*)’ [-fpermissive]
  mAudioSyncSignalTask = Bela_createAuxiliaryTask(staticMAudioSyncSignal, 90, "mAudioSyncSignalTask");
                                                                                                    ^
In file included from /root/supercollider/include/plugin_interface/SC_World.h:26:0,
                 from /root/supercollider/server/scsynth/SC_HiddenWorld.h:30,
                 from /root/supercollider/server/scsynth/SC_Bela.cpp:26:
/root/Bela/include/Bela.h:709:15: error:   initializing argument 1 of ‘void* Bela_createAuxiliaryTask(void (*)(void*), int, const char*, void*)’ [-fpermissive]
 AuxiliaryTask Bela_createAuxiliaryTask(void (*callback)(void*), int priority, const char *name, void* arg
               ^
make[2]: *** [server/scsynth/CMakeFiles/libscsynth.dir/SC_Bela.cpp.o] Error 1
make[1]: *** [server/scsynth/CMakeFiles/libscsynth.dir/all] Error 2
make: *** [all] Error 

- 2

The occasional kernel panic ...

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.298656] Internal error: Oops: 807 [#1] THUMB2

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.375293] Process scsynth (pid: 20399, stack limit = 0xd6448238)

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.381729] Stack: (0xd6449f48 to 0xd644a000)

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.386265] 9f40:                   c0084d5d c087a840 c07ddb24 c087a840 c07dece4 c07dc9a4

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.394784] 9f60: c087a840 c0060c93 c087a840 c005fed1 d5766040 d6449fb0 00000002 000f0042

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.403299] 9f80: 000f0042 c000c148 bec217ec 000d0093 00000000 c0011733 00000004 bec215f4

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.411827] 9fa0: 50534531 00000000 000f0042 c000c0ad 00000002 50534531 a000000f 00000004

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.420346] 9fc0: bec215f4 50534531 00000000 000f0042 40137960 bec217ec 00000003 00000000

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.428878] 9fe0: bec215c8 bec215e8 404affa9 4012d54c 000d0030 0000022b 00000000 00000000

Message from syslogd@bela at Oct 21 03:16:10 ...
 kernel:[ 2828.477228] Code: 3644 b14b f8d5 2440 (601a) e002

Bela UGens do not interact nicely with `play`

@apmcpherson had found an issue with one of the digital UGens I think, where having it last in a play statement would occasionally cause noisy outputs (probably because the output buffer was not being filled with zeros).

Now I have this:

s.waitForBoot{
    "Server Booted".postln;
    {
        var rate = AnalogIn.ar(0).exprange(0.3, 20);
        var amp = AnalogIn.ar(1); // returns a value from 0-1
        rate.poll(1);
        amp.poll(1);
        AnalogOut.ar(0, SinOsc.ar(rate).range(0.0, amp)); // send to Analog Output 0
    }.play;
}

and this floods the terminal output with

UGen(AnalogIn): 0.000106812

(they are about 50 per second: the trigger input to the Poll receives a trigger every 873 or 889 samples), while the lines from the LinExp (generated by rate.poll)

UGen(LinExp): 0.303403

seem to come in at about the right frequency.

Funny enough, if you comment out, e.g.: rate.poll(1);, thus leaving only the AnalogIn Poll UGen, this one only prints its output only once at the beginning (probably when the constructor calls Poll_next_kk).

Explicitly adding a UGen which produces a valid audio-rate output as the last command of the play block fixes everything, e.g.:

s.waitForBoot{
    "Server Booted".postln;
    {
        var rate = AnalogIn.ar(0).exprange(0.3, 20);
        var amp = AnalogIn.ar(1); // returns a value from 0-1
        rate.poll(1);
        amp.poll(1);
        AnalogOut.ar(0, SinOsc.ar(rate).range(0.0, amp)); // send to Analog Output 0
        Out.ar(0,
            SinOsc.ar(100, 0, 0.1 )
        )
    }.play;
}

@sensestage: is this expected behaviour with play or is there something wrong in the Bela UGens?

Should we just avoid play altogether and do something like this (which works fine) instead?

s.waitForBoot{
SynthDef("AnalogIn",{ arg out=0;
    var rate = AnalogIn.ar(0).exprange(0.3, 20);
    var amp = AnalogIn.ar(1); // returns a value from 0-1
    rate.poll(1);
    amp.poll(1);
    AnalogOut.ar(0, SinOsc.ar(rate).range(0.0, amp)); // send to Analog Output 0
}).send(s);
s.sync;
a = Synth.new("AnalogIn", target: s).postln;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.