Bytebeats (was: Audiorate counter, constant rising value)


#1

Wondering how to patch a constantly rising value at audio rate and also then be able to control the ramp speed?

At control rate it's easy using the counter object but I am looking for rates at 8KHz increments.

Context is feeding a value "t" into a Bytebeat object I'm trying to build (and throwing myself in the deep end with some C while I'm at it).


Why is there no frequency dial?
#2

osc/phasor?

as such a audio signal cannot raise 'forever' since it runs from -1 to 1,
so if you want something that goes from 0 to 1, over a period measured in hz, then its phasor.

you probably want phasor lin, so its a linear frequency rather than pitch


#3

Thanks, I guess I just meant at a "slow" rate compared to an oscillator, I realise the value will wrap. I've got a phasor with some control on the freq inlet to bring it down a few orders now.

I'm getting something akin to the examples but I guess I need to look at custom objects and play around with datatypes to make it sound "right".


#4

its an interesting one...

I think scaling is probably going to be the key... as the functions have to form a waveform, and yet slowly evolve...
I suspect you can probably do it with patch object, and a few shifting operations
for entering the 'equation' you can use the one-liner
e.g. enter the following into a one liner s-rate

int t=inlet_in; outlet_out = ((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7;

given its 8 bit, we would presumable need to move this into the lower 8 bits, and then move back after the equation is run.

so, given 1 = 1 << 27 for axoloti... , that would mean for 8 we should do shifts of 27-8, or 19
EDIT: wrong, its Q31 for audio.... Q27 for k-rate

I couldn't resist give this a bit of a go...

bytebeat.axp (3.3 KB)

Im not sure my scaling is exactly right... as Ive noticed it seems best to run the phasor really fast... 24khz, whereas in the article seemed to suggest 8khz, so i think ive missed something ... also id be tempted to put it through some kind of oscilloscope since the built in axoloti one with 128 samples is not really big enough to see exactly whats going on.
and though it is evolving, i suspect the patterns usually are a little longer than the one I'm getting.
(I didnt watch the whole video, so not sure how long they run for with a given equation)

I altered the one-liner a bit, so that it would force result to 8 bit.., but apart from that its the above...
(of course, i could do the shifts in the one-liner too, but thought it was clear for 'demonstration' purposes to do outside.

Id love to see what you get going ... its an interesting idea, that Id not heard of before :slight_smile:


#5

Hmm that gives me some ideas!

So far I have:

Which certainly sounds in the spirit of things, the object is not too different to your oneliner essentially. This is all experimentation for me, I'm not unfamiliar with coding, but have barely touched C or bitwise ops in the past.


#6

cool, yours sounds very close :slight_smile:

if you confident with creating objects, definitely the better way.. (some are not confident with it, hence the one-liner i suggested)

i realised I was confusing the bit position, its Q31 for audio... not 27 ( I keep having to check these things , its Q27 for k-rate vars) , this also makes things easier, as I assume the equation is generating signed values, so this needs to be maintained for the 32 bit audio.... which i wasn't doing when doing the 19 shift.

its interesting listening to different values though and at different frequencies of the phasor and also different shifting..


#7

The frequency has a few sweet spots, you can scan through them with the fine controls.

Here is a really good one :slight_smile:

bytebeat.axp (5.1 KB)

There are "recipes" here: http://pelulamu.net/countercomplex/music_formula_collection.txt


#8

Why only have one bytebeat?


#9

Awesome stuff :smiley:


#10

Awesome ! The idea is very original with very aesthetic result.


#11

Update: had a bit of interest from glitch loving friends so have expanded this a little.

Question, is there an easy way to store the "beats" at the moment the object uses the text field like so:

outlet_out = (attr_beat & 0xFF) << 23;

I don't believe I can eval a string, right? I would like to be able to select from a pool of strings without needing a new object instance each time/muxing them.

Edit: by pool of strings I mean pool of "beats".


#12

no, the code has to be compiled, which is done on your computer, and then uploaded to the axoloti.
eval'ing would require an interpreter/jit compiler.

if you only want a pool, then you could compile each one, and then use a mux to target the one you want to select. or alternatively have a custom object, perhaps with a table of function pointers to hold each equation... (or simply do a switch)

if you want totally dynamic, then you'd have to implement some kind of 'poor mans' interpreter, and then interface to that some how.
(funny, i was thinking of something similar to this a few days ago, for a completely different purpose :))

of course worth baring in mind the processor is not that powerful, so there are going to be compromises. (saying that the equations are all pretty simple)

btw: this might interest you, I just stumbled on it... by microbe modular
https://github.com/clone45/EquationComposer


#13

Thinking through this after my last post I did realise why I couldn't do that! :slight_smile:

I'm not really up to the task of writing an interpreter I think. Just wondering how to easily add more beats without muxing a bunch of objects or adding functions within.

Yes, very interesting!


#14

I'm playing with your patch and I have added for each 'branch' a bitcrusher . Then, it's not possible to dynamically change the "formula beats" but you can introduce variability in the current formula (set the noise gate input to 0).

Again thank you for this great work !


#15

Thanks!

Made a lot of changes today, added an internal clock and a bunch of inlets which you can work out. :slight_smile:

I'll add a start position/phase inlet later.

beatmachine.axo (1.2 KB)
beatmachine.axp (4.4 KB)


#16

check these out:

(int)(t/1e7*t*t*4)|(int)(t*0.5)

((t >> 5) & 32) * t + ((t >> 10) & 42) * t

((t >> 8) & 41) * t | ((t >> 10) & 42) * t * t + ((t >> 5) & 32) * t & ((t >> 6) & 24) * t


#17

Currently in 1.0.12 the hc/osc/beatmachine object does not work at runtime.

Generate code complete
Start compiling patch
BDIR = C:\Users\ADMINI~1\DOCUME~1\axoloti/build
FIRMWARE = .
RM
APP
! C:\Users\ADMINI~1\DOCUME~1\axoloti/build/xpatch.h.gch
. C:/Users/Administrator/Documents/axoloti/axoloti-contrib/objects/hc/osc/beatmachine/beatmachine.h
.. c:\users\administrator\documents\axoloti\axoloti-contrib\objects\hc\osc\beatmachine\equations.c
... c:\users\administrator\documents\axoloti\axoloti-contrib\objects\hc\osc\beatmachine\equations.h
C:\Users\ADMINI~1\DOCUME~1\axoloti/build/xpatch.cpp: In member function 'void rootc::instancebeatmachine__1::dsp(int32_t, int32_t, int32_t, int32_t, bool, int32_t, int32_t, int32_t, int32_t (&)[16])':
C:\Users\ADMINI~1\DOCUME~1\axoloti/build/xpatch.cpp:260:22: error: expected primary-expression before ';' token
beat_table = ;
^
C:\Users\ADMINI~1\DOCUME~1\axoloti/build/xpatch.cpp:265:63: error: expected primary-expression before ')' token
compute_output = (((Equation(inlet_beat, t, x, y, z, )) << 23) - (1 << 26))<<1 ;
^
Multiple include guards may be useful for:
c:\users\administrator\documents\axoloti\axoloti-contrib\objects\hc\osc\beatmachine\equations.c
make: *** [C:\Users\ADMINI~1\DOCUME~1\axoloti/build/xpatch.bin] Error 1
shell task failed, exit value: 1
Compiling patch failed ( untitled )


#18

compiling here... are you sure your equation is correct? if its not then this will lead to compilation failures.


#19

Take a look at the help patch, as @thetechnobear said, the beat field needs to be populated with something valid.

Also please use https://sebiik.github.io/community.axoloti.com.backup/t/hellcore-contributions/1745 for further issues. :slight_smile: