- 14 Nov, 2020 5 commits
-
-
Joel K. Pettersson authored
-
Joel K. Pettersson authored
Split parser op list and ref types into the nodelist module, moving enums to script.h. SAU_ParseOpList and SAU_ParseOpRef becomes SAU_NodeList and SAU_NodeRef, also used for script.h types instead of SAU_PtrList, using a (separate) mempool for holding script data from parseconv for all allocations kept. The nodelist module fleshes out the implementation, possibly useful for future needs while quite small. Also refactor scriptconv and program.h types: * Remove the SAU_POPP_ADJCS flag (done "todo"), replacing all checks using other information. Note: This version fixes the v0.3.6 scriptconv changes for no ADJCS flag, the tagged version ignored clearing of modulator lists in scripts. Add 'devtests/pm-addremaddrem.sau' (which tests adding and clearing PM modulators). Change log: * 2019-12-26: Remove SAU_POPP_ADJCS flag, replace checks using other information. * 2019-12-27: Set version to v0.3.6. * 2019-12-29: Increase version suffix to 'b'. Turn parser op list and ref code into nodelist module. Use nodelist instead of ptrlist for script.h types, and a separate mempool for holding script data. * 2020-10-08: Re-apply after splitting out change still using the old ptrlist module and moving down most redesign except the SAU_POPP_ADJCS flag removal. Old branch: - 2019-12-30: Set version to v0.3.6-beta2. Tidy up naming & comments in new code. Use mempool to alloc program op lists. Fix v0.3.6 bug introduced when removing ADJCS flag. Correct scriptconv output and adjust generator, ensuring that cleared modulator lists are produced and set when clearing modulator lists in a script. Add 'devtests/pm-addremaddrem.sau' testing with PM. - 2019-12-31: scriptconv: Use mempool in two more cases where it fits the design. Add a comment clarifying why NULL checks are absent following updates to op list pointers. Add missing restrict, sauMalloclike. Reorder Makefile dependency names alphabetically. - 2020-07-26: Keep version at v0.3-dev. ISC-relicense nodelist.
-
Joel K. Pettersson authored
Tweak usage notice for conciseness. Change the -h option to list topics available with -h <topic>. For now, only other lists are available, the first built-in help consisting of a 'wave' type list and a 'ramp' list. Parser warnings now use the new code for listing valid items. But a meta-list, of the lists to be available with -h, needs manual extension in help.c when more are added. All lists are in the same format. Change log: * 2020-01-18: Add help module, expand -h. Simple code for printing out name array, used for wave module. Easily extended to print out more lists in the same format. * 2020-02-16: Split out "Common options" usage line. * 2020-07-23: Move to saugns from the 2020-06 "mgensys" experiment. Re-do adapting to use modified symtab. Replace 'noise' help type with 'ramp'. Old branch: - 2020-01-22: Import saugns v0.3.6d symtab. Use in parser. Replace parser strfind() using symtab pool pointers. Use mempool for parser and program nodes. Add MGS_LangOpt for pool wave_names in parser & program, make symtab pool_stra store additional end NULL pointer, remove useless name arr count for parser pool stra uses. Adjust parser messages ("label" -> "named value", etc.). - 2020-01-26: Remove symtab get/set functions, rename types, expose MGS_SymStr type - used directly in parser to simplify code. - 2020-02-02: Adjust for newer code. - 2020-02-03: Small clean-up. Reindent program.h. Re-add common.h #define for symtab testing, moved to mgensys.h. - 2020-02-10: Add noise module with noise names, and add help type.
-
Joel K. Pettersson authored
Rename the program from 'ssndgen' to 'saugns' (Scriptable AUdio GeNeration System). Change SSG prefix to SAU throughout code. Rename scripts from *.sgs to *.sau, naming the language SAU (Scriptable AUdio). Update descriptions in README. Set version to v0.3-dev. Change log: * 2018-12-05: Rename to 'saugns'. Change SGS prefix to SAG. * 2019-01-21: Update for newer code. Change prefix to AGS. * 2019-01-22: Bump copyright years. Change prefix to SAU. Rename scripts from *.sgs to *.sau, polish README. * 2019-07-04: Update for newer code. Tag "v0.3.0". * 2019-08-18: Increase version suffix to 'b'. * 2019-12-25: Update for newer code. * 2020-01-03: Increase version suffix to 'c'. * 2020-02-09: Update for newer code. Tag "v0.3.6e-2". * 2020-07-26: Update for newer code. Set version to v0.3-dev. * 2020-10-21: Update to latest code, on top of new 'ssndgen'. Old branch: - 2018-10-25: Rename to 'ssndgen'. Change SGS prefix to SSG. - 2019-01-27: Fix inconsistent indentation in some files. * 2020-11-14: Update to latest code.
-
Joel K. Pettersson authored
Reorganize code: * Rename ptrlist to ptrarr. * Move all in builder/ except builder.c and scriptconv and voicegraph to reader/. * Rename 'test-builder' to 'test-scan', built with `make tests` (previously `make test`). This moves down remaining old reorganization changes from the current saugns v0.3.x commits. Reorder Makefile dependency names alphabetically. Change log: * 2020-10-09: Rename ptrlist to ptrarr. * 2020-11-14: Move most builder/ files to reader/. Remove builder/ modules from test-builder linkage, rename to test-scan. Clean up name/ver in cli strings. Clean up Makefile.
-
- 13 Nov, 2020 1 commit
-
-
Joel K. Pettersson authored
Flense generator, simplifying away most "event data" and using what's allocated at the previous stage. In the future, some data and code can be moved from the program types to the generator, ending up in-between the layers as part of pre-allocation code, e.g. move voicegraph. The basic main idea is very old, not new. Now the stubbornly kept premature abstraction of the past is gone in the generator. Compared to the flat 2020-06 "mgensys" design, reduces differences in part. But here, in a more multi-layered design, there's already specialized data types for the "updates" to be done, use those instead of duplicating data with the generator's own types. Now uses mempool for all allocation in generator. Reorganize code: * Move builder.c into builder/. * Rename renderer/ to interp/. * Move renderer.c (renamed player.c) and the audiodev and wavfile code into player/. Command-line behavior: Print -p info for each script just prior to generating audio for it if done, instead of printing for all before generating for all. Option flag enum and handling is moved out to ssndgen.h and the builder/builder.c and player/player.c code. Also change ramp run and skip functions to accept NULL pos for jumping ahead in time to goal value. Expand IDEAS file (design ideas) and rename to IDEAS.md. Change log: * 2020-10-24: Silence implicit conversion warning in osc.c, add (float) before INT32_MAX. * 2020-10-26: Add runalloc module (placeholder) and use in generator, as in 'old-dev_202006' branch. * 2020-10-27: Make ramp SSG_Ramp_skip() skip all remaining values if pos is NULL. Simple but may remain unused without a new use-idea. Flense generator, simplifying away most "event data" and using what's allocated at the previous stage. Remove runalloc module for now, for simpler diff. Now uses mempool for all allocation in generator. * 2020-11-11: Merge part-new code reorganization. Use saugns v0.3.5 IDEAS.md with update for changes. Adjust SSG_Ramp_run() for consistency when pos NULL. Old branch: - 2019-12-12: Move builder.c into builder/. - 2019-12-15: Move audiodev and wavfile into renderer/. Move old files from renderer/ to interp/. Expand IDEAS file, rename to IDEAS.md. - 2020-07-22: Rename renderer to player. - 2020-11-09: Naming in player/player.c. * 2020-11-12: Group -p info printing with other per-script output generation.
-
- 21 Oct, 2020 2 commits
-
-
Joel K. Pettersson authored
Add time.h with SSG_Time type and flags, replacing the main script.h and program.h time_ms variables, and the default time flag and infinite time magic number. Also refactor a little in parser, and fix warnings when building. No noted functional change. A lead-up to more clean-up. Design idea from the 2020-06 "mgensys" changes. Todo: Unbreak 2011 feature, which is tested by devtests/defaulttime*.sgs. The problems come with the maintained sgensys design. In part, parsing is subtly broken when multiple operators are placed on one line. In part, timing code needs revisiting, as in 2020-06 "mgensys". More, to move all "voice" handling from the parser is needed for a clean and reliable design. Set version to v0.2-dev. Change log: * 2020-10-18: Add SSG_Time type, time.h header, use in script.h and program.h types. Replace default time flag and use of SSG_TIME_INF (except the latter kept in the generator). Fix warnings in parser using saugns v0.3.4 change and refactor a little. Also move SSG_MS_IN_SAMPLES() from math.h to time.h. Set version to v0.2-dev. * 2020-10-19: IDEAS -> notes/, add notes/TODO. (Copy 1/2 2011 TODO items from mgensys.) Replace the old magic value in generator. * 2020-10-20: Clean up devtests/: devtests/newconcept -> notes/modidea2012 devtests/script3.sgs -> devtests/defaulttime0.sgs add new devtests/defaulttime1.sgs devtests/testnewsyntax*.sgs -> devtests/testbindtomulti*.sgs devtests/warning-* -> devtests/warning/*
-
Joel K. Pettersson authored
Change SGS prefix to SSG throughout code. Also: * Reindent parser.c (the only remaining file). * Update .gitignore for the 'got' tool. Change log: * 2018-10-25: Rename to 'ssndgen'. Change SGS prefix to SSG. * 2018-10-27: Update .gitignore. * 2020-10-18: Re-apply change on top of former v0.2.13. Reindent parser.c (only remaining file). * 2020-10-21: .gitignore update from 2020-06 "mgensys". Old branch: - 2020-01-17: Update .gitignore for got tool.
-
- 26 Jul, 2020 1 commit
-
-
Joel K. Pettersson authored
Use floating-point processing in generator internally, until writing 16-bit output, instead of mixing float and int buffers. For PM phase offsets, get 32-bit int values from float buffer, instead of 16-bit values. Rework mixing, add clipping for audio output. Move oscillator sample block fill code to osc.c (from generator.c). Move lut, coeff fields to SGS_Osc type, from the types in generator.c. Change default sample rate to 96000 Hz, undoing the 2012-02-10 change to 44100 Hz. Change log: * 2018-11-09: Complete changing generator to use float internally. Rework mixing, clip output. Move script.h and ptrlist to builder/. Complete branch merging. * 2018-11-11: Minor refactoring in generator. Minor comment clean-up. * 2019-05-28: Merge refactoring. Old branch: - 2019-02-07: Move osc block running to osc.c (split from generator.c). * 2020-07-23: Split out after ramp and other refactoring. Merge renaming in ramp module. Replace osc module with newer version from the 2020-06 "mgensys" experiment, refactoring generator for moving coeff and lut fields to SGS_Osc. Also update wave module. * 2020-07-26: Reduce diff with 2020-06 "mgensys" experiment, changing default sample rate to 96000 Hz (was 44100 Hz after 2012-02-10). Also use ISC license header for the common module and math.h, to keep permissive code free from dependence on non-permissive code; and use it for audiodev and wavfile modules as well. Keep version at v0.2-beta.
-
- 23 Jul, 2020 3 commits
-
-
Joel K. Pettersson authored
Support multiple script files or strings per command-line invocation. Also make corresponding changes to the 'test-builder' program. (Use SGS_PtrList in main module, builder, and renderer for lists. Combine the old behavior with running through a batch of things at each stage.) Use 256 ms of audio output buffering in renderer. Fixes stuttering on NetBSD 8 (which requires >= 128 ms of buffering for consistently smooth playback). The extra 128 ms is for the sake of portability. (All non-NetBSD systems I personally use have however worked fine with the old 1024 sample buffering.) While at it, also increase the generator's internal buffer length from the ancient value of 256 samples to 1024. (This is simply a performance vs. memory use trade-off. The number of buffers could potentially grow into the hundreds or thousands for extreme input. This increases memory use fairly conservatively.) Const-ify pointers to non-modified SGS_Program instances. Change log: * 2019-06-04: Move multiple script args support back to v0.5.0, use the old version number. Old branch: - 2019-02-10: Support multiple script paths per command-line invocation. Also make corresponding changes to the 'test-builder' program. Move ptrlist to main dir (out of builder/). Increase version to v0.6.1. Const-ify non-modified SAU_Program pointers. - 2019-05-28: Merge support for multiple script args, and refactoring. Combine with support for -e <string> in the simplest way. Set version to v0.5.2. Update README. - 2019-05-29: Tweak usage notice. * 2019-06-18: Merge audio buffering changes. Move it all back to after v0.2.8, set version to v0.2.9. Old branch: - 2019-06-13: Increase generator buffer length from 256 samples to 1024 samples. - 2019-06-14: Change renderer output buffer sizing to remove stuttering on NetBSD. (Use 256 ms instead of 1024 samples.) Refactor the code in the process. Increase version to v0.3.2. * 2019-02-09: Merge changes for renderer.c, fixing crash on opening several files when only some failed to open. Simplify usage notice. Old branch: - 2019-06-22: Minor refactoring in renderer.c. - 2020-02-03: Add missing NULL checks in renderer.c; check for NULL programs, as is supposed to be done. * 2020-07-13: Keep version at v0.2-beta.
-
Joel K. Pettersson authored
Use restrict keyword for pointer function parameters throughout code. For now, this is the only use. Makes for a minor size and speed improvement. The design has been checked for safety with this, though something could have been missed. Various smaller updates for test lexer and scanner code. Split out usage of the test lexer and test scanner into the separate 'test-builder' program, built with 'make test'. Also add install/uninstall targets to Makefile. Change log: * 2018-11-18: Reduce lexer char switch cases to values 0-127, use default for the identical rest. Reduce scanner char handler array to 128 values, use entry for 0 when char > 127. * 2018-11-19: Move test lexer use to separate 'test-builder' program, instead of conditionally compiling it into sgensys. Add (unused) SGS_Scanner_handle_char1comments() for first-character-only line comment openers. * 2018-11-22: Move test scanner use to 'test-builder' program. Complete branch merging. * 2018-11-23: Add SGS_Scanner_close(). * 2018-11-28: Use restrict keyword. For now, only add to function argument pointers. Reduces size of the binary somewhat, and produces very marginal speed-up. * 2019-05-06: Move back to after new v0.4.2. Increase version to v0.4.3. Change test scanner file handling, write new SGS_Scanner_open(). Copy scanner file handling to lexer. Update test-builder for new code. * 2019-05-10: Tweak usage notice. Fix missing part of scanner.c merge. * 2019-06-13: Set version to v0.2.8. Re-merge tidying. * 2019-06-22: Makefile: add install/uninstall targets. * 2019-09-12: Merge diff for renaming slope module to ramp. * 2020-07-13: Keep version at v0.2-beta.
-
Joel K. Pettersson authored
Support direct evaluation of a string argument with a new -e option. E.g., ./sgensys -e "Osin f643 t1" will run (play) a 643 Hz oscillator for 1 second. Add experimental test scanner, a reworking of the test lexer; a draft for future redesign, as in breaking up the tasks of the lexer and/or an intermediate parser redesign. Add file module string open/read/close code, and change sgensys, builder, parser, lexer to use it. Also add support to file for creating nested instances, in preparation for future nested file usage. Updates to the test lexer. Change log: * 2019-04-24: Add file module string open/read/close code. * 2019-04-25: Name changes in file. * 2019-04-29: Move back to after new v0.4.0. * 2019-04-30: Add -e string evaluation option. Also change file module to support nested (linked) instances, in preparation for future addition of nested file usage (prepend/predefine arg, file includes from file, etc.). Increase version to v0.4.1. Merge test lexer changes, with some final tweaks. Old branch: - 2018-11-04: Import updated test lexer code. (Drop new test scanner for now.) - 2018-11-09: Silence warnings in test lexer. - 2018-11-15: Use SGS_File_skipline() in test lexer. - 2018-11-16: Debug test lexer, also a few clean-ups and performance tweaks. - 2018-11-18: Minor fixes and tweaks for test lexer. - 2018-11-19: Minor clean-up in test lexer. - 2019-01-14: Use SGS_File_trynewline() in test lexer. * 2019-05-04: Add test scanner module, merging tidied up basic version. Old branch: - 2018-03-25: Add scanner module (incomplete) for use in parser (next) and lexer (later). - 2018-04-07: Some debugging and improvements for test scanner. - 2018-04-13: Improve test scanner design and add C-style comment support. - 2018-11-05: Complete branch merging. (Add the postponed test scanner.) Minor clean-up in test scanner. - 2018-11-09: Silence warnings in test scanner. - 2018-11-15: Use SGS_File_skipspace(), SGS_File_skipline(), in test scanner. - 2018-11-18: Properly check scanner EOF status for error. - 2018-11-19: Renaming and minor changes in test scanner. Use symtab in scanner symbol string reading. - 2019-01-14: Use SGS_File_trynewline() in test scanner. * 2019-05-08: Tweak usage notice. * 2019-05-10: Add -e quick test to README. Fix parser string matching when item ends with end of file marker (as happens with -e "Osin"). Fix missing part of scanner.c merge. * 2019-06-13: Set version to v0.2.7. Merge minor code tidying for lexer.c, scanner.c. * 2020-02-09: Simplify usage notice. * 2020-07-13: Keep version at v0.2-beta.
-
- 20 Jul, 2020 2 commits
-
-
Joel K. Pettersson authored
Bugfixes: * Adjust which flags the parser checks to allow/disallow nesting-dependent 'r' and 'i' syntax elements, correcting handling for label references. Also make the parser use flags to cleanly guard against wrong end_*() processing for nested ParseLevel instances. * Add checks in parser to reject infinite numbers and expressions containing them. * For ramp default time duration, carry over 'S t' default time instead of using a fixed 1 second default. Changes default time for panning, and for operator ramps where the operator previously had infinite time set. Clean-ups: * Turn Valit (VALue ITeration) types and code from program.h and generator.c into the new ramp module and SGS_Ramp type. * Simplify parse level SDPL_IN_* "location". Replace flags and macros with a simple enum state. No functional change, as only one flag was set at a time. * Use size_t for string and buffer lengths. Change wave LUTs from 16-bit int to float (refactoring osc & updating generator). No significant quality difference in the output, as mixing is still 16-bit. Change log: * 2019-06-13: Merge various clean-ups, and the change of wave LUTs from 16-bit int to float. Set version to v0.2.5. Old branch: - 2018-07-30: Change "http" to "https" in heading license comment. - 2018-11-06: Break out slope from program/generator. Change wave LUTs from int16_t to float. Refactor osc, update generator. - 2019-04-30: Place after new v0.4.1. Increase version to v0.4.2. Bring in README update. - 2018-12-29: Add check for infinite numbers in parser, refactor reading of multiplicative inverse numbers. - 2018-12-30: Change uint32_t to size_t for string lengths. - 2019-01-11: Complete merge of uint32_t -> size_t changes. - 2019-05-04: Add SGS__malloclike() to SGS_create_*() functions where missing. - 2019-05-17: Add missing #pragma once to slope.h. - 2019-06-05: Merge README diff after v0.2.3 syntax change. * 2019-08-07: Merge Makefile -ffast-math portability fix. * 2019-09-12: Rename slope module to ramp. (For cleaner diffs and old versions.) * 2019-12-21: Merge 'S a' multiplier apply-to-ramp fix. * 2019-12-22: Merge composite timing fix. * 2019-12-24: Move down clean-up changes from v0.2.6, v0.2.12, and v0.3.1d. Also change default time for ramp, using a flag instead of placeholder value, and using the 'S t' value instead of a fixed 1 second. Old branch: - 2018-12-29: Complete branch merging. Simplify parse level SDPL_IN_* "location", replacing flags and macros with a simple enum state, as only one flag was set at a time. - 2019-07-18: Use isinf() for infinite-number checks. Use isnan() for portable NAN checks in parser. - 2019-09-12: Merge down to v0.2.12. - 2019-12-21: Change which flags are checked to allow/disallow 'r' (rel. freq.) and 'i' (inf. time), fixing syntax for "@label" references. Update README. Change parser to use flags to cleanly guard against wrong end_*() processing for nested ParseLevel instances. * 2020-07-13: Keep version at v0.2-beta.
-
Joel K. Pettersson authored
Script syntax changes: * Label referencing: From ":label" to "@label". * Compound value (e.g. gradual value change, arg value with subvalues): From "[...]" to "{...}". * PM modulator list prefix: Change from "p*" to "p+". (I.e., a list uses "p+[]". More fitting, as PM amounts to adding the amplitude of modulator(s) to the phase.) * Add downscaling of output amplitude by voice count by default. Using "S a" disables it. * Allow 'a' (amplitude) parameter for AM and FM modulators. (Previously disallowed within "a![]" and "f![]"/"r![]".) * Numerical expressions: Further change parsing for correctness and consistency. - Fix bug disallowing sign before a nested '(' after '('. - Fix result of several subtractions in succession. - Fix handling of '^' (to the power of) priority, truly binding it more closely than other operators. - Only allow arithmetic inside parentheses. (Previously allowed without parentheses when no whitespace separated parts of the expression.) - Only allow number sign within parentheses. (Previously '-' sign was allowed without parentheses. This frees up '-' for new future uses.) - Allow '+' as sign (not only as operator) in addition to '-'. * Multiple operator binding: From "{...}" to nesting syntax prefixed by '@', i.e. "@[...]". Todo: * Make multiple operator binding functional. (It has been a "todo" since it was added.) Wave type changes: * Make 'saw' (saw wave) increasing instead of decreasing. (Negative frequency or amplitude gives a decreasing saw.) Reorganize code: * Move parser.c, program.c, and the lexer and symtab modules to builder/, splitting out builder.c and renaming files: - parser.h -> script.h (parser output). - program.c -> parseconv.c. Place conditionally-compiled test use of lexer in builder.c. * Move generator and osc to renderer/, splitting out renderer.c from sgensys.c. * Create common module, moving the old sgensys.h contents to common.h. Add and use utility functions: - SGS_warning(), SGS_error(): now used for warnings and errors (when the format is suitable). - SGS_memdup(), SGS_strdup(): moved from parser.c. Consistent type and function naming: * Rename each "SGSType" to "SGS_Type". * For function and macro names including a type, use same (mixed) case as in type. Further clean-ups: * Use size_t for event IDs, uint32_t for operator IDs, uint16_t for voice IDs. * Rename parser struct types, flags, and functions. Name types "SGS_Script*", flags "SGS_S*". * In parser result (SGS_Script), include options set in script and script name. * Add circular reference guard for operators in generator to avoid crashes due to incompletely supported features. * Refactor generator memory handling. Also somewhat simplify memory handling in program module. * Add -p option for printing script info after loading. No longer print the program "debug info" unless -p used. Change log: * 2018-04-13: Rename parser struct types and flags. * 2018-04-18: Simplify memory management in program and generator. Implement downscaling of amplitude by voice count by default. * 2018-06-02: Undo faulty simplification in parser code, and some further renaming. Add circular reference guard for operators in generator, and some further clean-ups. * 2018-06-30: Rename types from "SGSName" to "SGS_Name". Rename corresponding functions and macros to use same (mixed) case in included type name. * 2018-09-11: Create common module, refactor warnings and errors. Move memdup from parser to common. * 2018-10-04: Further renaming of parser structs and flags. Some additional tidying. * 2018-10-15: Reorganize code, moving parser.c, program.c, and symtab to builder/. Rename program.c to parseconv.c, split out builder module. Further flag renaming in parser.c. Add -p option for printing program info. * 2018-10-16: Move lexer to builder/. Update headers, comments. Move lexer test invocation to builder.c. Complete branch merging. Split out renderer module from sgensys.c. Move audiodev, wavfile, generator, and osc to renderer/. Some code tidying. * 2018-10-17: Move audiodev and wavfile out from renderer/. Make "saw" wave increasing instead of decreasing. Replace renderer.h and builder.h with combined sgensys.h. * 2018-10-18: Enable 'a' parameter for "f!<>"/"r!<>" and "a!<>". * 2018-10-23: Change PM list syntax from "p*<>" to "p+<>". * 2018-12-25: Further changes to numerical expression parsing for correctness and consistency. Add warning for '(' without closing ')'. Remove extra linebreak from file open error. * 2019-06-05: Merge syntax changes. Increase version to v0.3.1. Clean up a few scripts. * 2019-06-13: Set version to v0.2.4. * 2019-06-16: Backport further simple syntax changes. Old branch: - 2019-02-08: Fix inconsistent indentation in a few scripts. - 2019-06-13: Three simple syntax changes. Label ref: from ":label" to "@label". Subvalues: from within "[...]" to "{...}". Mul. op.b: from within "{...}" to "@[...]". * 2019-06-30: Update -p printout details to match June syntax changes. * 2019-08-07: Move back Makefile -ffast-math portability fix. Also update unusable 'devtests/newconcept' script. Old branch: - 2019-08-06: Fix parsing when -ffast-math breaks isnan(). Only build some files with -ffast-math. * 2019-12-21: Merge 'S a' multiplier apply-to-ramp fix. * 2019-12-22: Merge composite timing fix. * 2020-02-09: num.exp. parsing: Fix result of several subtractions in succession. * 2020-07-13: Keep version at v0.2-beta.
-
- 11 Jul, 2020 5 commits
-
-
Joel K. Pettersson authored
Change PM modulator list syntax from "p!<>" to "p*<>". Since semantics differ for PM lists vs. AM and FM lists, make this clearer in the syntax. (For PM lists, modulator amplitudes are summed, while for AM and FM lists, they are multiplied.) Split osc module into osc and wave. Wave type changes: * Add 'sha' (half-frequency absolute sine). * Add 'szh' (half-zero'd sine). * Add 'shh' (first quarter of sine). * Rename 'srs' (square root of sine) to 'ssr'. Move wave type names from parser to wave module. Reorganize example and test scripts. Move some old and useful scripts from devtests/ to examples/tests/. Rename scripts, add descriptions to some of them, modify a few, remove a few which are useless, and add more wavetype testing. Change log: * 2018-04-18: Move wave type names to osc module, add new 'sab' wave type, rename 'srs' to 'ssr'. Reorganize and update example and test scripts. * 2018-06-02: Add 'shw' and 'shr' wave types, and further LUT init code changes. * 2018-06-30: Split osc module into wave and osc. * 2018-09-12: Rename wavetypes ("sab"->"sah", "shw"->"szh", "shr"->"szhhr"). * 2018-09-27: Rename wave type 'sah'->'sha', add 'shh', comment out 'szhhr'. * 2018-09-29: Rename debug #define switches in sgensys.h. * 2018-10-16: Update headers, heading comments, for added code. Complete branch merging. * 2018-10-19: Change PM list syntax from "p!<>" to "p*<>". * 2020-07-11: Merge into current branch to provide fuller history.
-
Joel K. Pettersson authored
Support sndio and use on OpenBSD. Fixes audio on newer OpenBSD. Clean up the Linux audio code. Improve audiodev error messages. Program & parser changes: * Rework the SGSNodeList parser code into the SGSPtrList type, split out into the ptrlist module. * Return parser result in new SGSParserResult type. Add parser module method for destroying it, instead of it being implemented in program module. Add missing list clearing. * Rename voice and operator parameter flags from SGS_* to SGS_P_*. Further edit usage notice. Makefile changes: compile with -std=c99, add missing header dependencies. Change log: * 2018-02-16: Renamed voice and operator parameter flags from SGS_* to SGS_P_*. * 2018-02-19: Split out ptrarr module from parser, reworking node list code and its uses. * 2018-02-20: Makefile changes: add -Werror=implicit-function-declaration, list more header dependencies. * 2018-03-10: Change ptrarr to work more like old nodelist, re-adding case for < 2 items and needed macros. * 2018-08-23: Makefile: use -std=c99. Adjust audiodev. * 2018-09-09: Add sndio support, use on OpenBSD. Fixes audio on newer OpenBSD. Move audiodev implementation files to audiodev/. * 2018-09-11: DragonFly portability fix: On DragonFly, cannot build audiodev with _POSIX_C_SOURCE defined (needed on Linux), only define _POSIX_C_SOURCE on Linux, in audiodev.c instead of in Makefile. * 2018-09-20: Replace ptrarr with cleaned-up ptrlist. Fixes and clean-ups for parser, program, as well as some addititional tidying. * 2018-10-12: audiodev code tidying, and fix typo which broke Linux build. Some further code tidying. * 2019-04-18: Merge into current branch to provide fuller history. * 2019-04-26: Remove useless uint typedef.
-
Joel K. Pettersson authored
Use stdint.h and stdbool.h types instead of ushort, uchar, and uint (and usually int) throughout all code. Universally use 32-bit IDs and counters for voices and operators. Rework the oscillator module: * Increment phase after each sample instead of before. * Move wave type enum (SGS_WAVE_*) to osc.h, use to index array of LUTs. * Replace extra value at end of LUTs with use of bitmask. Bump LUT values from 1024 to 2048. * Correct saw wave LUT initialization off-by-one indexing error. Also improve init code for other LUTs. * Remove unused SGSOsc_RUN*() variants. Renamings, a few new macros, improved comments. * Add wave type test script, examples/test-wavetypes.sgs. Remove math.h SET_I2FV() macro (x86/x86-64 fast float-to-int rounding). Replaced with lrint()/lrintf(), which nowadays is inlined to fast code when compiling with -O > 0 and -ffast-math. This removes all inline assembly. Change audiodev and main module, retrieving and using modified sample rate when changed by the audio device. Handle resulting difference in sample rates for device and file outputs by generating audio twice if needed. Also improve audio output-related error and warning messages. Tweak usage notice. Split sgensys.h into sgensys.h (common type definitions), generator.h (new) and program.h (relevant lines moved over). Also rename some functions, do minor refactoring, improve commenting here and there. Change log: * 2017-12-03: Replace types in many cases. Quick first pass. Remove sgensys.h. Program module still largely not updated. * 2018-02-05: Replace more types. Rewrite and readd sgensys.h. Rename some functions. Minor refactoring. Improve audio output handling. Program module updated. * 2018-02-06: Oscillator module changes. Use SGS_WAVE_* enums to index LUTs. Correct saw wave LUT. Inc phase after sample instead of before. Renamings, macro clean-ups. * 2018-02-08: Undo minor changes for SGSNodeList (parser) that are better redone with a real redesign. Rename a few more functions. Tweak messages in sgensys.c. * 2018-02-09: Remove math.h inline assembly, leaving none. * 2018-02-19: Replace a ';' with a ',' in heading comments. * 2018-02-22: Extend oscillator LUTs to 4096 values from 1024. Some further renamings, init code improvements, and smaller macro improvements. Update COPYING file. (FSF link updates.) * 2018-02-23: Add examples/test-wavetypes.sgs. * 2018-03-14: Fix allocation size in generator.c. Use offsetof(), avoid allocation failure which resulted from unsigned value wrapping around upon (zero flag count - 1). * 2018-09-27: Reduce osc LUTs to 2048 values (no point in 4096 with 16-bit int and lerp). Some more osc module tidying. * 2019-04-17: Merge into current branch to provide fuller history.
-
Joel K. Pettersson authored
Disable test lexer and re-enable normal output by default, adding a #define switch in sgensys.h to switch between the old parser and the test lexer. Some clean-ups for the test lexer, symtab code, and other parts of the program. Make the test lexer handle line comment ('#'), and change its buffered reading to make multiple character ungetting possible. Portability fixes: * Makefile and linking: Correct sh syntax. Check in Makefile for three uname -s cases: - Linux - OpenBSD or NetBSD - other ("generic UNIX") Unbreaks building on FreeBSD and DragonFly. Also reorder linking CC args for portability. * ALSA: Add missing call to snd_pcm_drain(). Re-remove GNUmakefile and simply use Makefile. Change log: * 2017-11-27: Some cleanups for lexer and symtab modules. Add debug #define for hash table in symtab.c (for testing collisions). * 2018-01-21: Make lexer handle line comments ('#'). Source fix for ALSA. Correct Makefile sh syntax and reorder CC args for linking. * 2018-02-04: Fix program.c typo / memory init bug. * 2018-02-08: Only include LFLAGS addition for OpenBSD and NetBSD on those systems. Unbreaks building on FreeBSD and DragonFly. * 2018-02-12: Change buffered reading in the lexer. * 2018-02-13: Rearranging of and renamings in lexer code. Add debug #define for lexer (for silent-enough output to measure time to process file). Move debug #define switches to sgensys.h. * 2018-02-14: Disable lexer, re-enable parser and output. Insert #define switch in sgensys.h to toggle. * 2018-02-19: Replace a ';' with a ',' in heading comments. * 2018-02-22: Update COPYING file. (FSF link updates.) * 2018-05-01: Replace README with rewritten version from 04-16. Similar to newer versions, but with references to added features removed. * 2018-09-19: In program.c, remove two unused functions, and two useless conditionals, one broken. * 2018-10-25: Fix parser string matching bug (not impacting the current uses). * 2019-01-19: Complete branch merging. Correct README wording in one place. Re-remove GNUmakefile and simply use Makefile.
-
Joel K. Pettersson authored
Add ALSA support, splitting out system audio support from the main module to the new audiodev module. Further rework main module, expanding command-line options. Indentation style changed to tabs in new code, as well as the wavfile module. (Having planned redesigning of sgensys, the indentation style was changed to tabs for new or "clean" modules after this, while those to be rewritten or further reworked still use 2 spaces.) Moved tests/ to devtests/. (This snapshot contains the scripts missing in and readded to the last 4 snapshots.) Change log: * 2013-02-28: ALSA support added. Reworked sgensys.c. Reindented sgensys.c, audiodev and wavfile modules. * 2013-03-04: Add -c command-line option to stop after processing a script, before sound generation. Re-add tests/ as devtests/. * 2013-08-03: Add '.' to heading comments.
-
- 09 Jul, 2020 3 commits
-
-
Joel K. Pettersson authored
Parser fix for added, incomplete multiple operator binding feature, and minor refactoring. Copyright notices and LGPL-3.0+ info added to source files. (README.COPYRIGHT, added to this repository for earlier versions lacking this, removed with this commit.) tests/ script changes. (Taken from later working dir because tests/ missing in tarball, but no scripts dated later than 2012-02-20.)
-
Joel K. Pettersson authored
-
Joel K. Pettersson authored
Some parser refactoring and experimental changes. Re-enable planned operator binding '{}' syntax, change nesting syntax to '<>'. Reorder code. Fix for voice allocation. Move string copying out of symbol table, make it simply store pointer. Syntax changes: - Use '<>' to list modulators rather than '{}', as in 'a!<...>', 'f!<...>' or 'r!<...>', or 'p!<...>'. - Remove '-' syntax for PM modulators. Replaced with 'p!<...>'. - Add '{...}' for binding several operators as one object to manipulate. Used to e.g. link several carriers to one or more modulators. Update various test scripts.
-
- 02 Jul, 2020 1 commit
-
-
Joel K. Pettersson authored
Parser refactoring and changes. Use per-block instead of per-sample processing for sound generation. Note click reduction code works. Note: Fixes some bugs, is the first version which "sounds" like sgensys, but also includes new bugs fixed in the 2011-04-26 version, see script3.mgs.
-