Commit Graph

121 Commits

Author SHA1 Message Date
5684185+vsariola@users.noreply.github.com
95af8da939 fix(vm)!: first modulate delay time, then notetracking
BREAKING CHANGE: the order of these operations was inconsistent
across the different VMs. Go VM was the only one to first modulate
and then apply note tracking multiplication. But that made most
sense. So now all different VM versions work in this same way.
2025-04-16 23:17:08 +03:00
5684185+vsariola@users.noreply.github.com
0e10cd2ae8 fix(amd64-386): sample oscillator hard crash
The sample-based oscillators converted the samplepos to an integer
and did samplepos < loop_end comparison to check if we are past
looping. Unfortunately, the < comparison was done in signed math.
Normally, this should never happen, but if the x87 FPU stack
overflowed exactly at right position, we then got 0x80000000 in
samplepos, which is equal to -2147483648. Thus, we considered that
sample is not looping and read the sample table at position
-2147483648, well out of bound. TL;DR changing jl to jb makes sure
we always wrap within to sample table, no matter what.

Fixes #149.
2024-09-22 09:04:47 +03:00
5684185+vsariola@users.noreply.github.com
012ed10851 test: add unit test for unisons with phase = 0
This demonstrates a bug found by Virgill:
the x86 templates optimize away the phase
modulation when all phases are set to 0,
but the unisons need the phase modulation
internally to offset the phase of the different
unison oscillators.
2024-08-17 11:06:17 +03:00
5684185+vsariola@users.noreply.github.com
8227691523 test: the filenames of test_gain and test_gain_stereo were flipped 2023-10-23 22:05:28 +03:00
5684185+vsariola@users.noreply.github.com
04fbc9f6a7 feat(vm): add dbgain unit, where gain is defined in decibels
Closes #78
2023-10-23 21:57:29 +03:00
5684185+vsariola@users.noreply.github.com
01bf409929 refactor(vm): rename Commands/Values to Opcodes/Operands
The commands and values were not very good names to what the
byte sequences actually are: opcodes and their operands. In
many other places, we were already calling the byte in the Command
stream as Opcode, so a logical name for a sequence of these is
Opcodes. Values is such a generic name that it's not immediately
clear that this sequence is related to the opcodes. Operands is not
perfect but clearly suggests that this sequence is related to
the Opcodes.
2023-10-18 19:53:47 +03:00
5684185+vsariola@users.noreply.github.com
e5691d670a feat(vm): add frequency modulation for oscillators
Closes #105
2023-10-07 21:48:03 +03:00
5684185+vsariola@users.noreply.github.com
00850c8001 code/text formatting and cleaning up whitespace 2023-09-24 10:47:54 +03:00
5684185+vsariola@users.noreply.github.com
f35f948118 fix(vm/compiler/templates/wasm): add support for mono out
Adds also a test case to make sure mono out also works.
2023-09-24 10:27:34 +03:00
5684185+vsariola@users.noreply.github.com
7df8103bf9 fix(vm): change crush resolution to bits (closes #79)
BREAKING CHANGE: The problem with crush was that it had very few usable values. This changes the crush to map the value nonlinearly, so the crush resolution is bits. Still the upper portion of the values is not very usable (bits 12-24 i.e. hardly any crushing), but at least the lower portion is usable. But now crush resolution has slightly different meaning.
2023-09-23 21:23:05 +03:00
5684185+vsariola@users.noreply.github.com
1ac2ad3c75 fix(vm/compiler): invert the logic of the release flag in the voices (closes #102)
This makes all envelopes released by default, instead of attacking. Add also test to demonstrate the buggy behaviour.
2023-09-23 15:56:46 +03:00
5684185+vsariola@users.noreply.github.com
b028fea59a build: make targets properly rebuild when templates or compiler changed 2023-09-02 20:14:52 +03:00
5684185+vsariola@users.noreply.github.com
70080c2b9d fix(templates/wasm): $WRK was modified by stereo oscillators, messing up all modulations targeting units after the unit
add also tests to make sure we don't mess it up again
2023-04-06 15:03:16 +03:00
5684185+vsariola@users.noreply.github.com
6129076e97 upgrade ilammy/setup-nasm to v1.4.0 and wat2wasm to v1.0.29
wat2wasm doesn't support --enable-bulk-memory anymore, presumably because it is part of the standard nowadays
2023-04-06 14:50:18 +03:00
vsariola
f713133a0a feat(tests): test also gain parameter in envelopes 2021-04-10 15:58:02 +03:00
vsariola
fc89973848 fix(tests): make test_renderer return 1 if not enough parameters 2021-04-10 15:14:19 +03:00
vsariola
05e6f6da4e fix(tests): in test_renderer.c, print errors to stderr instead of stdout 2021-04-10 15:13:45 +03:00
vsariola
42c9e045b7 feat: change the compressor unit to apply post-gain instead of pregain.
Pregaining ran into trouble: could not bring the signal level back to near 0dB. For example, with infinite ratio in the pre-gain system, the signal level was capped at threshold, which in turn ran into trouble with stereo signals.
2021-03-20 17:01:04 +02:00
vsariola
38c0cea40f refactor(templates,tests): make sync an extern instead of parameter to render
This is to be able to use CreateThread with su_render_song; let's worry about multicore rendering sometime in the future.
2021-03-20 16:23:51 +02:00
vsariola
99dbdfe223 feat: add the ability to use Sointu as a sync-tracker
There is a new "sync" opcode that saves the top-most signal every 256 samples to the new "syncBuffer" output. Additionally, you can enable saving the current fractional row as sync[0], avoiding calculating the beat in the shader, but also calculating the beat correctly when the beat is modulated.
2021-03-09 23:52:33 +02:00
vsariola
3e7064e166 refactor(templates, tests): rename C-header defines consistently with Score.go 2021-02-28 16:07:55 +02:00
vsariola
048b36324c fix(tests): test_render_samples_api forgot to initialize struct
Sometimes crashed, if the unitialized struct happened to contain garbage.
2021-02-28 15:40:06 +02:00
vsariola
adcf3ebce8 feat(sointu, tracker,...): restructure domain & tracker models
send targets are now by ID and Song has "Score" part, which is the notes for it. also, moved the model part separate of the actual gioui dependend stuff.

sorry to my future self about the code bomb; ended up too far and did not find an easy way to rewrite the history to make the steps smaller, so in the end, just squashed everything.
2021-02-28 14:24:54 +02:00
vsariola
5f7eed4194 fix(templates/amd64-386, tests): fix global stereo sends and add regression test for future
the send asm code is quite ugly atm (pushf & popf to save stereo flag), but the new regression test should ensure we don't break it again if we eventually refactor it
2021-02-15 14:48:16 +02:00
vsariola
7408956f77 fix(tests): update sample tests to use "samplestart" instead of "start" parameter 2021-02-08 20:21:26 +02:00
vsariola
3f494661e3 feat(sointu): add RowsPerBeat so non-power of 2 beat divisions are easier 2021-02-01 18:33:52 +02:00
vsariola
61437db0d6 refactor(sointu): add explicit RowsPerPattern to the song 2021-01-21 13:16:41 +02:00
vsariola
69f236dbd3 fix(tests): wat-compilation was missing correct output filename 2021-01-05 18:30:47 +02:00
vsariola
1be75362d0 refactor(tests): remove copying files to output directory; tests accept path to expected instead 2021-01-05 18:18:48 +02:00
vsariola
588488ce54 feat(sointu): remove 16-bit output toggle from song; make it compile time option 2021-01-05 18:08:13 +02:00
vsariola
30379c981d feat: remove hold from song
assume songs code it as 1 always; implementations are free to change this during compilation, but this should be a compile time flag / optimization; not a concern of song.
2021-01-05 15:50:27 +02:00
vsariola
ccae4325c3 reformat .yml files 2021-01-04 17:51:28 +02:00
vsariola
5dd81430b7 feat(sointu): make patterns local to track
The global pattern table is constructed only during compilation. At this point, we can do also all sorts of optimizations / changes e.g. remove unnecessary releases and reuse patterns if there's a pattern already that could be used.
2021-01-03 01:06:59 +02:00
Veikko Sariola
c02c5c3c3d fix(asm/wasm): oscillator phase was causing rounding errors once large enough
gopher had fixed this, but we foolishly removed it. reintroducing fix, although this could be optional only for those who really care. ultimate size optimizers could still want to get rid of it.
2020-12-30 21:19:27 +02:00
Veikko Sariola
e4490faa2e feat(compiler): Add support for targeting WebAssembly.
The working principle is similar as before with x86, but instead of outputting .asm, it outputs .wat. This can be compiled into .wasm by using the wat2wasm assembler.
2020-12-26 23:16:18 +02:00
Veikko Sariola
7f049acf88 feat(cli): Re-engineer CLIs, split play & compile
Play depends on bridge and compile on compiler package. Before, the compiler depended on bridge, but we could not use the compiler to build the library, as the bridge depends on the library. Also, play can now start having slightly more options e.g. wav out etc.
2020-12-18 20:25:49 +02:00
Veikko Sariola
224b8dcb70 refactor(go): Move everything from go4k to root package sointu 2020-12-16 21:35:53 +02:00
Veikko Sariola
d0bd877b3f feat(asm&go4k): Rewrote both library & player to use text/template compiler
There is no more plain .asms, both library & player are created from the templates using go text/template package.
2020-12-16 17:23:50 +02:00
Veikko Sariola
2ad61ff6b2 feat(asm&go4k): Preprocess asm code using go text/template
The preprocessing is done sointu-cli and (almost) nothing is done by the NASM preprocessor anymore (some .strucs are still there.
Now, sointu-cli loads the .yml song, defines bunch of macros (go functions / variables) and passes the struct to text/template parses.
This a lot more powerful way to generate .asm code than trying to fight with the nasm preprocessor.

At the moment, tests pass but the repository is a bit of monster, as the library is still compiled using the old approach. Go should
generate the library also from the templates.
2020-12-14 15:44:16 +02:00
Veikko Sariola
92c8b70fd2 refactor(tests): Save .yml in the repo; auto-generate .asm when needed 2020-12-09 13:48:19 +02:00
Veikko Sariola
1a633778bc feat(Song): Support HOLD definition, allowing using other values than 1 as the hold. 2020-12-07 09:01:53 +02:00
Veikko Sariola
9e4bee1b67 feat(asmformat): Remove special treatment of oscillator types to ease the parsing of asmformat
BREAKING CHANGE: They are now numeric values like all the rest macro parameters, instead of %defined constants.
2020-12-06 15:05:12 +02:00
Veikko Sariola
1b1a4af5ea refactor(asmformat): .asm starts and stops with BEGIN_SONG and END_SONG which define all the magic defines and BPMs.
Now, every setting is visible to the user, so no need to guess magic defines.
2020-12-06 01:35:54 +02:00
Veikko Sariola
7bb60de74e feat(libsointu): make su_render return some error codes, typically due to FPU stack errors. 2020-12-05 16:41:07 +02:00
Veikko Sariola
e7ae775842 refactor(test_renderer): Allocate buffers statically instead of dynamically, so the tests are closer how Sointu will be eventually used. 2020-12-05 01:06:04 +02:00
Veikko Sariola
d19d513ea8 feat(sointu-cli): Merge the asmfmt and sointuplayer to generic command line utility for processing song files.
Currently supports: playing, exporting .asm (reformatting), exporting .h, exporting .raw (raw float32 buffer), exporting .json.
2020-12-05 00:01:24 +02:00
Veikko Sariola
efbcf1454e feat(go4k&sointu): Export .h C header files from the songs using go, also automatically during build for the tests.
The header files are automatically generated during build. No need to #define anything; everything is fixed by the .asm file. This adds go as a dependency to run the unit tests, but this is probably not a bad thing, as go is probably needed anyway if one wants to actually start developing Sointu.
2020-12-03 23:43:39 +02:00
Veikko Sariola
a1e7e82d6d refactor(song): Remove song length from Song and assume the user knows MAX_SAMPLES
Trying to force a specific song length other than the default never quite worked, so we'll only support the default MAX_SAMPLES & will calculate it for the user in the user in the exported .h header file.
2020-11-29 22:12:29 +02:00
Veikko Sariola
6d883f43ab fix(test_renderer): Add include <string.h> as linux builds were giving warnings for implicit declaration of memset. 2020-11-12 19:50:59 +02:00
Veikko Sariola
1b1dabafb8 fix(asm): Change the scaling to 29 in the speed unti (29 increments = double speed).
The old speed scaling of 24 was ill-chosen so that triplets resulted in a minor buffer overflow error. This was never caught by anyone until Visual Studio 2019 in debug mode. Presumably all compilers allocate some extra space so this didn't matter. Now 29 increments = double speed and speeds with alternating 52 and 81 result in triplets that are just slightly faster then ordinary bpm i.e. the buffer will be slightly underrun, which probably is unnoticable to the user.
2020-11-12 19:46:37 +02:00