|
|
|
01-13-2017, 05:45 PM
|
#1
|
Banned
Join Date: Nov 2016
Posts: 416
|
JSFX Docs: What's missing or inaccurate?
I've found a couple of things that seem wrong in the JSFX docs.
Quote:
desc:Effect Description
This line should be specified once and only once....
|
http://reaper.fm/sdk/js/js.php#js_intro
But some Cockos JSFX use two "desc" lines, and apparently using two "desc" lines gives you some undocumented functionality.
Also, I discovered while Googling that there's a recently-added real FFT function, but I don't find it mentioned in the official JSFX docs.
Any other things that could use updating in the docs?
|
|
|
01-14-2017, 12:27 AM
|
#2
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
It would be great if the JSFX documentation could be upgraded to be up to date. E.g. real FFT and syntax highlighting and other IDE features has recently been added.
Moreover the "desc" and other keywords are used to drive the database of ReaPack - including generating the user documentation of a JSFX (that hopefully is available in the Reaper GUI some day...).
Even if this is not a native EEL feature a description in the Docs would be very helpful and encourage JSFX programmer to do a documentation for their great work and enhance it's accessibility.
-Michael
|
|
|
01-14-2017, 12:43 AM
|
#3
|
Banned
Join Date: Nov 2016
Posts: 416
|
Thanks for your ideas. I'm hoping if enough of us propose improvements for the JSFX docs in this thread, it would make it convenient for Cockos to act on our suggestions.
|
|
|
01-15-2017, 09:39 PM
|
#4
|
Banned
Join Date: Nov 2016
Posts: 416
|
Constants beginning with "$" are currently undocumented; e.g., $PI.
|
|
|
01-16-2017, 03:45 AM
|
#5
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Q. What's the one thing that all programmers hate.
A. Writing documentation.
The docs have always lagged behind reality somewhat. So shall it always be. This is a universal constant, much like the speed of light and all that jazz.
|
|
|
01-16-2017, 04:26 AM
|
#6
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by IXix
Q. What's the one thing that all programmers hate.
A. Writing documentation.
|
Not me, I have no experience defending bugs in my products. Unlike you, I care very much about the experience of the people using my products. Remind me never to use any program you've developed, but Cockos doesn't actually hate making their product usable. "... effort to build quality software that would benefit people...." -- Cockos.
If I hated writing documentation, I wouldn't be writing documentation about the bugs in the JSFX spec.
Last edited by TryingToMakeMusic; 01-16-2017 at 04:52 AM.
|
|
|
01-16-2017, 04:31 AM
|
#7
|
Banned
Join Date: Nov 2016
Posts: 416
|
JSFX docs:
Quote:
The freembuf() function provides a facility for you to notify the memory manager that you are no longer using a portion of the local memory buffer.
|
but JSFX code distributed with Reaper accesses memory after it's been "freed". That's not what "free" means.
|
|
|
01-16-2017, 08:19 AM
|
#8
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
Not me,
|
Me neither
-Michael
|
|
|
01-16-2017, 08:21 AM
|
#9
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
but JSFX code distributed with Reaper accesses memory after it's been "freed". That's not what "free" means.
|
I suppose it gets automatically re-allocated when used. Of course the content needs to be considered as gone.
-Michael
|
|
|
01-17-2017, 02:49 AM
|
#10
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by TryingToMakeMusic
Not me...
|
I salute your superior commitment. You are a wonderful human being.
Quote:
Originally Posted by mschnell
Me neither
|
And so are you.
|
|
|
01-17-2017, 03:56 AM
|
#11
|
Banned
Join Date: Nov 2016
Posts: 416
|
You can specify a list of "globals" in a function-definition, but that's missing from the JS docs.
|
|
|
01-29-2017, 12:00 PM
|
#12
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
|
Missing in the Graphics section:
Quote:
gfx_set(r[,g,b,a,mode,dest])
Sets gfx_r/gfx_g/gfx_b/gfx_a/gfx_mode, sets gfx_dest if final parameter specified
|
|
|
|
01-29-2017, 06:52 PM
|
#13
|
Banned
Join Date: Nov 2016
Posts: 416
|
The docs for "mdct" say, "See the example effects for more information."
Which specific example effects should we see? I find 252 files in the Effects directory.
|
|
|
01-29-2017, 07:03 PM
|
#14
|
Banned
Join Date: Nov 2016
Posts: 416
|
The docs say:
Quote:
You may use brackets to index into memory that is local to your effect. Your effect has approximately 8 million (8,388,608) slots of memory....
|
and for the "fft" function:
Quote:
Note that the FFT/IFFT require real/imaginary input pairs (so a 256 point FFT actually works with 512 items).
|
Quote:
The size of the FFT is specified by the second parameter....
|
I've taken the four words in bold and written them on a piece of paper, and I'm now taking a break after some time trying to figure out how the four words relate to each other.
From context and semantics, I'm getting the idea that "item" is a synonym for "slot".
Is "size" a number of "points", or is "size" a number "items"?
I'm going to take a break for a dinner, and then run some experiments in an attempt to solve this undocumented mystery.
|
|
|
01-29-2017, 07:57 PM
|
#15
|
Banned
Join Date: Nov 2016
Posts: 416
|
In the description of "fft" and "ifft", it says:
"Your inputs or outputs will need to be scaled down by 1/size, if used."
It's unspecified how the scaling is distributed between the fft and ifft phases of a round-trip. E.g., if I synthesize a unity-amplitude impulse in the frequency-domain and apply ifft to it, the amplitude of the resultant impulse-train is unspecified by the docs (it's inconsistent across IFFT implementations), and I needed to run another experiment to ascertain the semantics of the ifft-function.
|
|
|
01-30-2017, 12:17 AM
|
#16
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
|
Quote:
Originally Posted by TryingToMakeMusic
The docs for "mdct" say, "See the example effects for more information."
Which specific example effects should we see? I find 252 files in the Effects directory.
|
If you filter on "mdct" you will find only 3.
Quote:
Originally Posted by TryingToMakeMusic
Is "size" a number of "points", or is "size" a number "items"?
|
Compex points.
Quote:
Originally Posted by TryingToMakeMusic
It's unspecified how the scaling is distributed between the fft and ifft phases of a round-trip. E.g., if I synthesize a unity-amplitude impulse in the frequency-domain and apply ifft to it, the amplitude of the resultant impulse-train is unspecified by the docs (it's inconsistent across IFFT implementations), and I needed to run another experiment to ascertain the semantics of the ifft-function.
|
For more on FFT scaling see this example:
http://forum.cockos.com/showthread.p...=2#post1786820
|
|
|
01-30-2017, 12:54 AM
|
#17
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by Tale
If you filter on "mdct" you will find only 3.
|
That is a good solution, that I didn't think of.
Quote:
Originally Posted by Tale
Compex points.
|
Thank you; that confirms the results of my experiments.
Quote:
Originally Posted by Tale
|
Thank you again. I wasn't reviewing that thread, because this round I'm using complex <-> complex fft/ifft.
The ambiguity in the official docs is making me seriously consider abandoning JS and moving my project to C++ (including Steinberg's bad VST3 docs), with all due gratitude that I do receive good explanations whenever I post questions here and wait some hours, and with all due gratitude that Reaper does a lot for me that other DAWs can't.
I'm used to languages which are documented first, implemented last. I'm just a programmer, not a sleuth or a hacker anymore. I'm struggling to manage signals which extend infinitely in both the frequency and time domains, and that is enough challenge for me. The JS world will continue to thrive without me if I bail, but I don't understand why opening the JS-docs file and finishing speccing the language is as low a priority as it is.
Last edited by TryingToMakeMusic; 01-30-2017 at 01:08 AM.
|
|
|
01-30-2017, 04:46 AM
|
#18
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
I'm struggling to manage signals which extend infinitely in both the frequency and time domains, and that is enough challenge for me.
|
That is why you do DFT (Digital Fourrier Trasform, be it "fast" or "real" or not) when using a computer. The signals don't "extend infinitely in both the frequency and time domains", but instead they are "periodic in both the frequency and time domains", and don't have not much in common any more with what we might expect, which does not really help.
That is why a rather easy to use development special purpose audio IDE such as JSFX helps a lot to get something going.
With native C systems you need to struggle a lot programming and debugging before you even start to handle any audio.
Good Luck ! Let us know where you get...
-Michael (just successfully finished a rather complex JSFX using real FFT, which worked a lot better than I expected.)
Last edited by mschnell; 01-30-2017 at 04:52 AM.
|
|
|
01-30-2017, 01:52 PM
|
#19
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by mschnell
That is why you do DFT (Digital Fourrier Trasform, be it "fast" or "real" or not) when using a computer. The signals don't "extend infinitely in both the frequency and time domains", but instead they are "periodic in both the frequency and time domains", and don't have not much in common any more with what we might expect, which does not really help.
That is why a rather easy to use development special purpose audio IDE such as JSFX helps a lot to get something going.
With native C systems you need to struggle a lot programming and debugging before you even start to handle any audio.
Good Luck ! Let us know where you get...
-Michael (just successfully finished a rather complex JSFX using real FFT, which worked a lot better than I expected.)
|
I am still here. I have gone as far as to install Eclipse and Visual Studio, but they have their own set of workflow issues, so I am still here. Eclipse includes no spec for the C or C++ language? What kind of IDE includes no spec for the programming language?
The signals I'm trying to model are non-periodic in time and non-periodic in frequency, hence my anxiety. I know I have to sacrifice some info to model them finitely, but figuring out the best way to do that is a challenge for me.
Last edited by TryingToMakeMusic; 01-30-2017 at 02:34 PM.
|
|
|
01-30-2017, 02:56 PM
|
#20
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
I am still here.
|
Great ! I appreciate this.
Quote:
Originally Posted by TryingToMakeMusic
I have gone as far as to install Eclipse and Visual Studio, but they have their own set of workflow issues, so I am still here. Eclipse includes no spec for the C or C++ language? What kind of IDE includes no spec for the programming language?
|
I am using Eclipse daily at work to do embedded C programming, so I think I am entitled to answer. Eclipse is an IDE for everything but nothing in particular. So C language development is just *one* flavor of what can be done with Eclipse. For any dedicated task you need to install an appropriate plugin. The on for C/C++ is called "CDT" -> http://www.eclipse.org/cdt/.
Quote:
Originally Posted by TryingToMakeMusic
The signals I'm trying to model are non-periodic in time and non-periodic in frequency, hence my anxiety. I know I have to sacrifice some info to model them finitely, but figuring out the best way to do that is a challenge for me.
|
Of course it's common to use FFT to analyze or synthesize non periodic signals. Here you will to use windowing.
A typical way to synthesize non periodic signals with FFT is additive synthesis -> https://en.wikipedia.org/wiki/Additive_synthesis
-Michael
Last edited by mschnell; 01-30-2017 at 03:05 PM.
|
|
|
01-30-2017, 06:34 PM
|
#21
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by mschnell
I am using Eclipse daily at work to do embedded C programming, so I think I am entitled to answer. Eclipse is an IDE for everything but nothing in particular. So C language development is just *one* flavor of what can be done with Eclipse. For any dedicated task you need to install an appropriate plugin. The on for C/C++ is called "CDT" -> http://www.eclipse.org/cdt/.
|
Thanks very much. I have installed CDT, but as far as I can find, it includes no spec of the C or C++ language. Like, I need to order this
https://www.amazon.com/Programming-L.../dp/0131103628
and this
https://www.amazon.com/C-Programming...sap_bc?ie=UTF8
to turn CDT's compiler into a documented compiler. Maybe I am a dying breed, but I consider documentation to be the most essential part of distributed software.
Quote:
Originally Posted by mschnell
Of course it's common to use FFT to analyze or synthesize non periodic signals. Here you will to use windowing.
|
Thank you again. Windowing is necessary here, but it necessarily compromises audio-quality, and I'm having to work hard to find solutions that push the compromises towards inaudible.
Last edited by TryingToMakeMusic; 01-30-2017 at 06:57 PM.
|
|
|
01-31-2017, 01:45 AM
|
#22
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
Thanks very much. I have installed CDT, but as far as I can find, it includes no spec of the C or C++ language.
|
CDT is made to use the GNU Compiler Collection's (gcc) C / C++ complier.
The documentation is here (e.g.): https://gcc.gnu.org/onlinedocs/
But this is just the specs and not an instructive manual. Consulting some printed books might be of great help.
Quote:
Originally Posted by TryingToMakeMusic
Windowing is necessary here, but it necessarily compromises audio-quality,
|
This depends. I did some experiments recently, using overlapping smooth windows.
- FFT "to and fro" does not compromises audio-quality; in fact the samples are only effected by some (irrelevant) rounding errors, but not in any algorithgmic way, independent of the window size used. This is because the DC part perfectly transfers the "height" of the windows' content (do a mental experiment with window-size 1 Sample !).
- The window size determines the delay between input and output.
- If you do any operations on the frequency-domain data, the window-size determines the lowest frequency that can be affected by your "effect".
BTW.:
I did this using JSFX, here the FFT functions are provided out of the box and there are examples and help (e.g. found in this forum) on how to do the windowing.
If you want to do a program in C you supposedly will want to do a VST. Here you will need the VST SDK by Steinberg (free, but they request a developer agreement).
Cockos provides a free library of audio functions (including FFT) for C users. There is a Forum to discuss these issues around here: http://forum.cockos.com/forumdisplay.php?f=32 . (I did not try yet.)
-Michael
Last edited by mschnell; 01-31-2017 at 03:19 AM.
|
|
|
01-31-2017, 10:50 AM
|
#23
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by mschnell
|
That is great to know, thank you. I hadn't found that bit of info in the CDT docs, though it's probably in there somewhere.
If I made an IDE, if you put the cursor on the word "case" and hit ctrl-F1, it would instantly show you the specs for the "case" statement. Because software can automatically, instantly save users time when it's designed to do so.
Quote:
Originally Posted by mschnell
But this is just the specs and not an instructive manual. Consulting some printed books might be of great help.
|
Specs is what I'm after.
Quote:
Originally Posted by mschnell
This depends. I did some experiments recently, using overlapping smooth windows.
- FFT "to and fro" does not compromises audio-quality; in fact the samples are only effected by some (irrelevant) rounding errors, but not in any algorithgmic way, independent of the window size used. This is because the DC part perfectly transfers the "height" of the windows' content (do a mental experiment with window-size 1 Sample !).
- The window size determines the delay between input and output.
- If you do any operations on the frequency-domain data, the window-size determines the lowest frequency that can be affected by your "effect".
|
We are having some miscommunication on this. I understand that FFT/IFFT doesn't compromise audio quality (besides minute rounding-errors); but that's separate from the problem I'm trying to solve.
Quote:
Originally Posted by mschnell
If you want to do a program in C you supposedly will want to do a VST. Here you will need the VST SDK by Steinberg (free, but they request a developer agreement).
Cockos provides a free library of audio functions (including FFT) for C users. There is a Forum to discuss these issues around here: http://forum.cockos.com/forumdisplay.php?f=32 . (I did not try yet.)
|
I will check those out.
Last edited by TryingToMakeMusic; 01-31-2017 at 11:27 AM.
|
|
|
01-31-2017, 11:45 AM
|
#24
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
but that's separate from the problem I'm trying to solve.
|
And which you did not disclose yet
-Michael
|
|
|
01-31-2017, 12:30 PM
|
#25
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by mschnell
And which you did not disclose yet
-Michael
|
Convolve two signals. Each signal extends infinitely, non-periodically, in both time and frequency. The convolution integral is unsolvable.
|
|
|
01-31-2017, 02:25 PM
|
#26
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
Convolve two signals. Each signal extends infinitely, non-periodically, in both time and frequency. The convolution integral is unsolvable.
|
Nice. The calculation time will be (a constant) * (infinity) * (log(infinity), if using FFT.
We says tuned.
-Michael
|
|
|
01-31-2017, 02:27 PM
|
#27
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
Quote:
Originally Posted by TryingToMakeMusic
Convolve two signals. Each signal extends infinitely, non-periodically, in both time and frequency. The convolution integral is unsolvable.
|
Nice. The calculation time will be (a constant) * (infinity) * (log(infinity), if using FFT.
We say tuned.
(BTW.: the amount of memory used is infinte, as well, even if the resolution you desire limited.)
-Michael
|
|
|
02-10-2017, 10:04 PM
|
#28
|
Banned
Join Date: Nov 2016
Posts: 416
|
Friday night, and I'm running test signals through JS FFT functions trying to figure out how they scale amplitudes. The DSP textbooks I have tell me how they scale amplitudes. It takes less than square-inch of text to for them to specify that information. But I'm here running tests, and now debugging my tests after initial nonsense results. Friday night. It would just take a square-inch of text in the JS docs.
Here's Mathematica's docs describing the parameters which vary across various implementations of FFT:
What values is Cockos using for a? It's not specified in the docs, so we can only guess, or run tests on Friday night.
Last edited by TryingToMakeMusic; 02-10-2017 at 10:10 PM.
|
|
|
02-10-2017, 10:17 PM
|
#29
|
Banned
Join Date: Nov 2016
Posts: 416
|
Quote:
Originally Posted by TryingToMakeMusic
now debugging my tests
|
okay, so I tried to run the fft/ifft functions on 4-point buffers, which isn't allowed since it's too small. So instead of filling buffers manually for the tests, I'll set up some constants and do some loops. Since the answer isn't in the docs, so I have to reverse-engineer the JS language instead.
|
|
|
02-10-2017, 10:29 PM
|
#30
|
Banned
Join Date: Nov 2016
Posts: 416
|
I'm still here working on this, since it's not in the docs. I ran into a couple of typos in my test code, but I got them sorted out, but now I'm still getting nonsense-results.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:28 PM.
|