This is because I found it was a bit more understandable to group register by functionnality.jsk wrote: Fri Jan 17, 2025 6:51 pm
Not sure why in tools/gensym.py it prints out the values in a strinage order, doesn't seem to be r0..r13?
r0 r1 and r10 are all related to channel A (freq an amplitude)
r2 r3 and r11 are all related to channel B
r4 r5 and r11 are all related to channel C
r13 and r14 both relates to Envelope period
etc .. etc ..
It is just a display log
Code: Select all
'r0' : 0 , # "ToneAFine",
'r1' : 0 , # "ToneACoarse",
'r2' : 0 , # "ToneBFine",
'r3' : 0 , # "ToneBCoarse",
'r4' : 0 , # "ToneCFine",
'r5' : 0 , # "ToneCCoarse",
'r6' : 0 , # "NoiseGenerator",
'r7' : 0x3F, # "Mixer",
'r10' : 0 , # "AmplitudeA",
'r11' : 0 , # "AmplitudeB",
'r12' : 0 , # "AmplitudeC",
'r13' : 0 , # "EnvelopeFine",
'r14' : 0 , # "EnvelopeCoarse",
'r15' : 0 , # "EnvelopeShapeCycle",
'r16' : 0 , # "IOA",
'r17' : 0 # "IOB",

I agree with you. There should be a seed. I presume the python module random auto generates a seed to initialize random generator because it generates different number sequence even without using a seed.jsk wrote: Fri Jan 17, 2025 6:51 pm a) I'd assume to generate a music, you initialize the random number generator with a seed, and with this seed, and same random number generator (your own is better for predicatablility) it generates exactly the same music every time you run wherever? Don't see the seed.
But it the C program, at line 255, I use a seed to initialize my random generator
https://github.com/jbperin/OSME/blob/si ... ain.c#L255
Code: Select all
initRand(deek(0x276))
It is located at line 196 of genym.pyjsk wrote: Fri Jan 17, 2025 6:51 pm
b) I'd assume you can also input how long/many samples you want it to generate? How?
I want the music generator to generate 8 bars of music with 4 beat per bars at 60 beat per minute based on the 100 Hz interrupt.
Code: Select all
#8 bars * 4 beat/bar * 60/TEMPO(bpm) * 100 pulse/sec
for i in range(int(8*4*(60/Tempo)*100)):
I thought you had just to clone the repository, go into the directory tools and then run python genym.py (after replacing ugly hard coded path at line 280.jsk wrote: Fri Jan 17, 2025 6:51 pm c) If I could just see a simple version that outputs r0..r13 and I just need to pump it to the AY just like that every 50Hz clock interrupt, that'd be easy.
What's the matter with that ?
You're right, Euclide rhythm are only for beat .. It tells us when it is time to play a note.jsk wrote: Fri Jan 17, 2025 6:51 pm
d) I looked at the Euclide webpage and it all seems simple, except, then somehow it's mapped to music! There seems to be some really clever stuff going on interpreting the "beats" soming out as single tune + chords + drum beats? Not sure how it gets there and what the theory is about it. Need to read some more!
As for the choice of the note, I use a random generator to select a note amongst the "proper" ones.
The "proper" ones are the one that do not violate harmony and music theory rules.
These rules are implemented in music.py
cadences are some basic chord progression that we can find in 95% of popular tunes.
chords are note numbers for every possible chord in a major scale.
scales are possible notes for each 7 unaltered scale
notefrequency is used to make the correspondance between note and register value in the AY
Google search "Music Theory Understanding Harmony". Many valuable resources.
Don't reinvent the wheel. ISS has published a clickable version of the ROM disassembly where all this routine are available. No need to code them.jsk wrote: Fri Jan 17, 2025 6:51 pm
e) I just coded MUSIC/SOUND/PLAY for oric raw, TODAY!, without relying on the ROM. More or less works... This would be an excellent usage of it! LOL And incidentally, I did just test to have a C-routine called 50x per/s by interrupt... So this is doable.
Only simple 8 bits interger arithmetic (except the tempo counter which is 16 bits). No fix-point math here.jsk wrote: Fri Jan 17, 2025 6:51 pm
d) is this all integer math, or does it rely on more advanced math? I see fractions being mentioned. I'm guessing with your 3D-expericence you use some variant of fix-point math!
The fraction I'm referring here is a beat fraction to decompose the beat into 12 fractions.
Why 12 ? Because it the smallest multiple of 3 and 4.
Thus, with 12 fractions, I can adress both binary and ternary beat decomposition

12 is a very good number.
It's a pity that men had 10 fingers and then based the arithmetic on 10.. a 12 based numerical system would have been far better for mankind.
12 is also good to deal with angle and many other things. But it is an other debate.
Very interesting idea. I remember that ISS was looking for this kind of stuff some times ago.jsk wrote: Fri Jan 17, 2025 6:51 pm e) I've written various C-implementations of float point math (dec24, dec30) that basically just implements + - * / so far...
Some unix user use Wine to run the OSDK when they have to. ISS is one of them.jsk wrote: Fri Jan 17, 2025 6:51 pm Since I'm not on a PC I rely on ONLY cc65 under Linux/termux(Android) actually, and typically very simple build-procedures. I think it's good enough to prototype and if you push it, using char etc for indexing it generates descent simple code.
Thank you for your interest in euclidian rhythms and my code. I hope I could answer some of your questions.