-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some "classic" bytebeats are js only #23
Comments
I made some reorganization in library: |
Ok, I will check all the formulas from the [Non-JS] section with C compiler, and move invalid ones to [Compat JS]. |
Also, there some things that are not obvious at first glance: song by yehar
must be rewrited for C as
So, it moves to JS formulas too... |
|
operand types '' and 'int' are incompatible with the '&' or '&=' operator
haha, what an irony... |
OK, next step is to rename [Compact JS] into [JS multivar] and move all its one-(t)-variable code (with used sin, arrays, strings, etc) into [JS one-var] |
i'm noticing some code like remix of "I hear the long meowing of a cat :)" by SthephanShi in the C section even though it uses division. there also could potentially be expressions that only compile if t starts as a double instead of an int, or work if t is an unsigned int but not a signed int. |
Yes, the code compiles and I leave it in the Classic section because it's a very vague task. I was not so strict, for this you need to implement the player in C and reproduce each formula in order to listen.
then you got a ton of errors like "operand type incompatible with the '>>' or '>>=' operator". Some songs can be modified to be reproduced in C, but according to this logic, almost any code can be modified and ported to C, one way or another. Then the question arises as to what category it should be assigned to, because the original remains incompatible. |
Moreover, as I remember, some formulas had playback problems on 8-bit microcontroller with a clock rate of 16MHz, because the calculations take too many clocks, hehe. But these are hardware problems. |
when i test bytebeat formulas in c i generally just run the program and pipe it to aplay on linux i think the best option would be to not worry about playing them and instead create an automated script that runs the bytebeat in nodejs with a "player" that just outputs as chars to stdout, then compile a few possible c players (different types for t) and see if they give the same result. |
At first I splitted all JS formulas in two sections: [JS one-var] and [JS multi-var], but decided finally to keep all JS code in one section. |
as an example of code that compiles but doesn't run, the first bytebeat with division doesn't work because of a division by 0 at the start trill is currently in the js section, but actually kinda with c when including the math library |
If you start t from 1, not 0, or timer-counter on hardware changes faster than calculations, 0 can be skipped. Yes, some of |
Hmmm. "Glissando" |
i would still go with the approach i recommended before, of using an automated script to compare the outputs (js, c with int32_t t, c with uint32_t t, c with double t) oddly enough |
actually |
I decicded i'g do find for songs that have typing issues and/or sound different in C int main() {
for(int t=0;;t++){
putchar(
...
);
}
return 0;
} gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04). I'll post the classic codes that have this issues shortly |
I decided to do this because i was noticing a lot of songs (for example, bongo) that were having this issue at the bottom of the section... Also, sarpnt was saying that fanfare should be in the js secton due to typing issues, so everything else should get the same treatment.
I feel like sarpnt's buzzy grindy beat could have issues too, but
|
maybe keep this in mind when it comes to my tests then. |
on 12, 11, and 6, maybe it's just for me, but the |
@Chasyxx 3, 4, 5, 7, 10, 13 still unsolved. |
i think you can change |
Truncation in C due to integer division causes issues now.
edit: in case it's unclear, these problems don't appear on the JS website, only when i put them in the C code. |
This song sparked a discussion - is it worth moving songs with one t and with C library functions like UPD: Do such songs even exist? |
6 "Logics, and?" by lhphr - turned to |
I think 3, 4, 5, 7, 10, and 13 are also caused by C integer division (truncating numbers and messing with pitches), just like in my last comment. You'd have to maybe change the division to use floats, and then make some parts an int using a cast to avoid compiler type errors. Bongo example: |
classic seems to imply c expressions, however many songs mix ints and doubles in ways that aren't valid in c
for example fanfare doesn't work in c because it applies a bitwise operator to doubles.
The text was updated successfully, but these errors were encountered: