Commit Graph

423 Commits

Author SHA1 Message Date
788b3721fd Add missing sendpop to UnitTypes. 2020-11-10 00:20:57 +02:00
ae334a5dfe refactor(asm&go4k): Remove FLAGS from all units; they were the source of difficulty in parsing and fragile.
All units now take parameters according to flags. Only non-numeric parameter anymore is oscillator type.
2020-11-10 00:18:56 +02:00
e36aea59a5 feat(go4k): Algorithm to construct small delay times tables by abusing overlapping of different delay times.
The problem of finding a string that contains all particular substrings is the "shortest superstring problem"; it is NP-hard and analogous to traveling salesman problem. We use simple greedy search instead of trying to find true optimum. But even with these algorithm, units that use exactly the same delay times will always appear only once in the delay times table.
2020-11-09 22:29:10 +02:00
c153239710 feat(go4k): Document all the UnitTypes in a 'constant' table. Tells what parameters each unit takes. 2020-11-08 20:49:38 +02:00
bcbb5aaf19 feat: Delays and samples are now working through the bridge.
One should call bridge.Init() once during the initialization of the program to load the static sample table. On linux, bridge.Init() does nothing.
2020-11-08 16:03:10 +02:00
e65b08d2b3 fix(tracker): Change the "flags" parameter to "type", because this is what the bridge nowadays expects. 2020-11-08 14:19:54 +02:00
05899fc185 Merge branch 'draft/go-tracker' 2020-11-08 14:15:29 +02:00
d5886c0920 Change unison to be in the range of 0 - 3.
With this change, forgetting to initialize unison results in the default behaviour: 0 means one oscillator, 3 means four oscillators in unison.
2020-11-08 10:17:43 +02:00
b1ac141ea5 fix(tracker/sequencer): add a way to exit the sequencer loop 2020-11-08 04:27:52 +02:00
d30388a09a fix(tracker): fix invalid println 2020-11-08 04:22:00 +02:00
5e45e4f1f4 feat(tracker): hook up audio to tracker, we have liftoff
audio still a bit crackly; should probably decouple actual row ticking and rendering of audio (but how does that work with tempo ops?)

sequencer goroutine is a bit weird, too, should rethink
2020-11-08 04:17:21 +02:00
175bbb7743 fix(tracker/track): re-enable clipping of tracks 2020-11-08 02:48:52 +02:00
7a434f69fd fix(go/audio): fix audio.Player interface to have erroring Close()
not sure if this is actually required, though? shouldn't we just try to close and disregard errors?
2020-11-08 02:41:42 +02:00
9b6249a1a7 feat(tracker): implement basic tracker keys 2020-11-08 02:36:24 +02:00
77949bdc17 feat(tracker): implement basic track display 2020-11-08 02:24:27 +02:00
90c3536f3e feat(tracker): implement some basic styled ui building blocks 2020-11-08 01:20:53 +02:00
910bf42da9 Update README.md 2020-11-07 21:31:24 +02:00
9209aa1cba Implement .asm parsing in go4k, and run succesfully almost all tests/ through the bridge.
Delays and samples are not implemented yet and thus the tests are skipped, as these require parsing the delay and sample tables also. Various macronames were changed to be more sensible and consistent i.e. ATTAC was changed to ATTACK. GatesLow and GatesHigh was removed for the time being and the tracker will just have to know they are the SHAPE and COLOR parameters. SU_SPEED was changed to take a parameter so the parser picks it up.
2020-11-07 21:05:55 +02:00
64fe28a240 feat(tracker): create initial tracker skeleton using Gio 2020-11-07 19:50:37 +02:00
5eb7cef889 style(go/audio/oto): change error messages to be consistent 2020-11-07 19:38:58 +02:00
6e141f36c7 fix(go/audio/oto): clean up forgotten debug prints 2020-11-07 19:37:33 +02:00
551a7cb6c0 feat(sointu-player): implement a basic commandline tool to play songs 2020-11-07 19:34:46 +02:00
fa772ddd77 feat(go/audio): implement basic audio output with oto
splitting implementation into a separate package to potentially allow for other sorts of output, too.
2020-11-07 19:33:39 +02:00
41ce5d1efe Merge remote-tracking branch 'upstream/master' into draft/go-tracker 2020-11-07 17:27:11 +02:00
f584138572 Remove expressions from parameters, so the future .asm parser does not need expression evaluator. 2020-11-04 23:31:08 +02:00
df83001a64 Change delay macros to use FLAGS(NOTETRACKING) and FLAGS(NONE)
Previously it was + NOTETRACKING. This new way of using FLAGS(...) is more consistent with other macros, making the .asm format easier to parse.
2020-11-04 23:29:16 +02:00
d99cfd92d9 Change LOCALPORT and GLOBALPORT macros so that SU_SEND commands are easier to parse.
The new format is to give either 5 or 6 parameters to SU_SEND, corresponding to local and global send, respectively. For example, a global send:
        SU_SEND     MONO,AMOUNT(128),VOICE(2),UNIT(0),PORT(1),FLAGS(SEND_POP)

The SU_SEND macro does the address packing into word.
2020-11-04 23:11:51 +02:00
4eaa54ecee Update LICENSE: Fix whitespace. 2020-11-02 23:14:01 +02:00
ccb6434fac Implement compile definition RUNTIME_TABLES, which enables putting the pointers to delay and sample tables to stack.
Useful for the eventual API to be able to modify the delay and sample tables during runtime.
2020-11-02 23:10:33 +02:00
c7c752cd73 Change the stack rewind in the end of render to be slightly less fragile, anticipating putting more stuff in the stack.
Specifically, we will soon put the su_sample_offsets and su_delay_times table addresses to stack in the render_samples, to avoid hard coding them in the api call.
2020-11-02 23:10:33 +02:00
b94bb79366 Update README.md 2020-11-02 22:43:15 +02:00
dc88b885e9 Fix warnings when built using nasm.
Nasm gives warnings about labels without colons in the end; these were particularly prevalent in struc members: ".size" has be ".size:". Nasm also wasn't happy with extra trailing commas when calling macros.
2020-11-02 22:31:22 +02:00
eb37d8123d Change include path in CMake file to point to include/ instead of include/sointu/ 2020-11-02 21:37:22 +02:00
9544a130ab feat(song): add basic JSON marshaling/unmarshaling tests to make sure everything gets marshalled properly
TBD: should the various []bytes be marshaled in a different way? Go defaults to base64-encoded strings but creating just plain JSON arrays with bytes could be more friendly to both humans and computers.
2020-11-02 16:36:54 +02:00
e0a793ea6d Reorganize the project folder structure and how go packages are organized.
Sointu.asm / lib stuff lives at the root folder. There is a folder called "go4k", which is where
all go stuff lives. Following the ideas from https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1
the go4k folder is the "domain-model" of the go side, and should have no dependencies.
It contains Unit, Instrument, Synth interface etc. Putting go4k under a sub-folder is actually
in the spirit of Ben, as go4k adds dependency to the go language.

Bridge ties the domain-model to the sointulib through cgo. It returns C.Synth, but
makes sure the C.Synth implements the Synth interface, so others are able to use the
Synth no matter how it actually is done. MockSynth and WebProxy synth are good
prospects for other implementations of Synth.

It is a bit fuzzy where methods like "Play" that have no dependencies other than domain
model structs should go. They probably should live in the go4k package as well.

The file-organization on the Go-side is not at all finalized. But how packages are broken
into files is mostly a documentation issue; it does not affect the users of the packages at
all.

BTW: The name go4k was chosen because Ben advocated naming the subpackages
according to the dependency they introduce AND because the prototype of 4klang was
called go4k (there are still some defines in the 4klang source revealing this). go4k thus
honors our roots but is also not so bad name: it's the main package of a 4k synth tracker,
written in go.
2020-10-31 22:05:47 +02:00
23e8bc0c5f Remove bridge.newSynthState & add 1 to RandSeed during Render calls, so now an empty struct corresponds to the Sointu default behavior. 2020-10-28 20:03:21 +02:00
8183c698da Separate Synth and SynthState: SynthState is the part that Render changes.
This should make testing easier, as Synth can be assumed to stay the same
during each call. Synth is also the part that we can parse from .asm/.json file
and a Patch can be compiled into a synth. Synth can be eventually made
quite opaque to the user. The user should not need to worry about opcodes
etc.
2020-10-28 19:47:59 +02:00
64afa9fb48 Change the C-API to roughly match the new Go-API.
The parameter order is now so that all the in/out int parameters are in the end of the signature.
2020-10-27 21:58:56 +02:00
5f4b85b0a4 Change the Go API to have two versions: Render(buffer []float32), which always fill the whole buffer, and RenderTime(buffer []float32,int maxtime), which ends either when the buffer is full, or modulated time is reached. 2020-10-27 17:26:08 +02:00
7a9ac3489b Add polyphonism support to bridge.go 2020-10-26 13:06:50 +02:00
1d07b4f192 Change the .asm song format so it's a bit easier to parse, by replacing PORT and GLOBALPORT macros with LOCALPORT and GLOBALPORT.
The LOCALPORT and GLOBALPORT just get numeric parameters (unit, port) and (voice, unit, port), respectively, which should be now quite intuitive as most of the time the port index is one of the parameters visible in the .asm file. Only a few units have extra ports beyond transformed variables. Overall, this should make the parsing of the .asm files a lot easier.
2020-10-26 12:55:15 +02:00
f495b0575a Fix bug in song.go: the note was pulled from the song data incorrectly. 2020-10-26 12:55:14 +02:00
debeaa181c Fix bug in song.go: len(s.Patterns) should have been len(s.Tracks). 2020-10-26 12:55:14 +02:00
470ba28592 Change the Render function in bridge.go to return a tuple of: number of samples rendered; bool indicating if rowend was reached; and a possible error.
The callbacks are gone; the row looping is the job of the user which is probably better for everyone.
2020-10-26 08:30:43 +02:00
acab824523 Update README.md 2020-10-24 23:36:56 +03:00
6c90ba2067 Implement a song struct to hold all the information of a single song (corresponding one .asm file) and Render function for it. 2020-10-24 23:25:23 +03:00
be7a4e21f3 Optimize asm player size, removing one unnecessary instruction. 2020-10-24 22:07:58 +03:00
3bb3e5c88e Fix su_render_samples to return correct values when built in 32-bit. 2020-10-24 17:04:27 +03:00
aa133b4606 Change bridge.go so that there is just SetPatch(...) function, instead of having to SetCommands, SetValues etc.
Now the patch definition in bridge_test.go and test_envelope.asm appear quite similar, so it's clear how they are related.
2020-10-24 16:15:15 +03:00
1abc6f22d5 Change the Go bridge API to more idiomatic Go, offering a callback when the row advances. 2020-10-24 14:39:10 +03:00