||byebeat/bitcode sounds and sequences on the nw2s::b
| br>Had a couple of folks asking about bytebeats, bitcode, or whatever they are called which got me thinking about them.
Like most of my code, I have more hardware work to do before I can really concentrate on the software, so I have managed to only spend enough time to get a couple of POCs done.
From an earlier thread, I used some of mckenic's code to build this sound... Whether that's what he was looking for or not I can only guess:
Then I looked through some of clone45's code for is upcoming Equation Composer module, and again, I was able to get something working, but I have no idea how close it is to what he's actually doing:
So anyway, If you want to add some of your own, I've created a little bit of a framework:
ByteBeat::ByteBeat(PinAudioOut pinout, PinAnalogIn samplerate, int algorithm, PinAnalogIn param1, PinAnalogIn param2, PinAnalogIn param3, int offset) : VCO(pinout, samplerate)
this->currentvalue = 0;
this->iterator = 0;
this->algorithm = algorithm;
this->param1 = param1;
this->param2 = param2;
this->param3 = param3;
this->offset = offset;
if (this->phaseindex == 0)
int tp1 = analogReadmV(this->param1);
int tp2 = analogReadmV(this->param2);
int tp3 = analogReadmV(this->param3);
/* Really, these should be set by the input parameters, but they are very sensitive to specific values */
unsigned int p1 = 2000;
unsigned int p2 = 200;
unsigned int p3 = 100;
// unsigned int p1 = 2000;
// unsigned int p2 = 500;
// unsigned int p3 = 1;
unsigned int t = this->iterator + this->offset;
This is a demo of some bitcode oscillating kind of like the equation composer module. Many thanks for clone45 for most
of the code that makes these work. You can see the original code here: https://github.com/clone45/EquationComposer
and you can see more info about the module here: http://www.papernoise.net/microbe-modular-equation-composer/
/* Filtered Triangles */
this->currentvalue = ((t % (512 - (t * 351) + 16)) ^ ((t >> (p1 >> 5)))) * (2 + (t >> 14) % 6) | ((t * p2) & (t >> (p3 >> 5)));
this->currentvalue = t;
This is in Oscillator.cpp. You can easily add more algorithms if you want, simply by adding case statements.
The configuration parameters are:
samplerate - defines the sample rate at which the oscillators run
pinout - an audio (AC coupled) output for the signal.
algorithm - used to select an algorithm
param1 - defines an analog input to drive algorithm parameter
param2 - defines an analog input to drive algorithm parameter
param3 - defines an analog input to drive algorithm parameter
offset - provides a number of sample offset if you want to run two oscs in stereo without them being completely in sync.
To configure and run one of these oscs from a sketch of your own, the code looks like:
VCO* bytebeat0 = ByteBeat::create(DUE_DAC0, DUE_IN_A00, 0, DUE_IN_A02, DUE_IN_A04, DUE_IN_A06, 0);
VCO* bytebeat1 = ByteBeat::create(DUE_DAC1, DUE_IN_A00, 1, DUE_IN_A02, DUE_IN_A04, DUE_IN_A06, 0);
Or, if you're running the no-code firmware, this is what the JSON configuration looks like:
"name" : "Byte Beat Demo",
"devices" : [
"type" : "ByteBeat",
"dacOutput" : 1,
"analogInput1" : 1,
"analogInput2" : 2,
"analogInput3" : 3,
"algorithm" : 1,
"offset" : 1
For those interested, let me know what you think. If you have any good ones that you'd like to share, please do, and if you want them in the library, I'll be happy to add.
s br> br>
| br> br> br>
| br>Just ordered the nw2s::b and am really excited to explore the possibilities soon. The bytebeat sounds really caught my attention after I saw the Microbe Modular Equation Composer module.
Has anyone done some work porting some of the Equation Composer factory programs over to the b? If not, I would try poking around a little using the information provided above and what's on the Microbe Modular github.
Thanks! br> br>
I only ported one of his and I can't even attest to whether or not it's an accurate representation or not since I don't own one of the equation composers.
In general, I've shied away from outright copying any code from any of the other developers that choose to open source their code. This includes his as well as some others such as mutable instruments. The last thing I want to do is to discourage anyone from releasing code... code like that is a great resource for everyone to have.
Of course that doesn't mean you can't do it... and it doesn't mean that at some point I won't try to leverage existing open source code in some way, but I still have plenty of my own (generally more mundane and utilitarian) ideas to get out there before starting that process...
-s br> br>
| br>Thanks, Scott. I completely understand your sentiment of not wanting to "rip off" other developers by reusing their code directly. It is a wonderful thing that quite a number of makers are openly sharing their code for anyone to study and learn from. Once my b arrives, I will try to play around with the available code to see how far I can get.
Cheers! br> br>
Powered by phpBB © phpBB Group