Newbie looking for API directions from a local

Hey everyone. I’m new to JUCE and was hoping to get a bit of help finding my way around the API.

The current project I’m working on is basically just a wave shaper that allows users to sort of draw a wave, then play it. Nothing amazing or special, just a starting point.

Right now, the API chunks I’m looking for are:

  1. How to declare midi inputs for a vst/au? I followed the tutorial, but ended up with a vst that doesn’t accept midi input (I think). I think I need something like BusesProperties().withInput ("Input", AudioChannelSet::stereo(), true)

  2. After the user creates a wave shape, I’d like to turn it into a static wavetable wave by computing all the values of the wave (rendered at the audio rate on a very low note). I could store all of these in an array, or maybe a buffer, but I feel like there must be a wavetable wave class. Ideally, it might have some helpful functions like mixing two samples if a position between two known samples is requested. Is there a class like this available?

  3. What chunk of the API should I look into for drawing arbitrary shapes (in this case a custom wave form)? I’d like to be able to draw lines with a bit of anti-aliasing, perhaps even some subpixel stuff if available.

  4. I’ve found SetSkewFactor, but what should I set it to for your average log10 (??) decibel scale? https://docs.juce.com/master/classSlider.html#aba8fe3610e7198bd4c1f2804736bfbf2

  5. I don’t want to reinvent the wheel too much. Are there some premade envelope and filter modules/ tools? If not, where can I find some?

I’m sure I’ll end up with more questions, but that’s it for now. Thanks for any help!
Seph

Welcome!

1 - Make sure that Plugin MIDI Input is checked in Projucer’s Plugin Characteristics box.
2 - I don’t believe there is a Wavetable class in JUCE as such.
3 - For drawing the wave shape, you should probably look at the Path class to create it and then draw the path in your Component’s paint() method with g.strokePath().
5 - There is a new simple ADSR class and there are several filter classes. There’s the original IIRFilter class and several filters inside the DSP module.

Hope that helps.

1 Like

I’ve found something which seems kind of similar to the “Wave” class I was thinking of:
https://docs.juce.com/master/classSynthesiserSound.html

I can only imagine giving this class to a synthesizer will yield decent results, regardless of how detailed the sound is.

What I can’t seem to find is how to fill this class up with data? (Oh, sorry. It appears it’s abstract, so I have to extend it and override getAudioData())

Also, thanks for the Path Class tip, works like a charm.

The SynthesiserSound class is mostly meant to support the Synthesiser & SynthesiserVoice classes. It’s not really meant as a generic sound processing class. You can see how it’s used in the AudioPluginDemo.

I think it’s pretty perfect for what I’m going. Letting a user draw a waveform, and then pass it off to a polysynth.

I keep running into issues with not knowing how to implement API calls. Fortunately, most of these will have a link to a class that does implement them, but I can’t see the .h file? Is there a place these files are hosted so I can see code examples of implementation?

Not exactly sure what you are looking for, but all classes and their member functions are documented here https://docs.juce.com/master/classes.html

However this documentation is just automatically generated from the doxygen comments in the header files and can be found in the headers as well.

Where/how exactly do you look for the headers?

I suppose that’s what I wondering. I don’t know. I see the generated docs, but they don’t seem to have any links that forward to the line on the .h file they are referencing. I’m trying to dig a bit deeper into these docs, but having a hard time finding their source material.

Here’s an example of what I mean:

http://sephreed.github.io/portfolio/Docurizer_Render/index.html?file=Polygon.doc.html&ov=inc

In the bottom right corner of each doc entry is a link to the line in the files that reference it’s creations. I’m looking for something like that so I can see how some abstract functions are usually overridden.

For some of the JUCE classes and their pure virtual methods, there isn’t necessarily anything like that in the documentation. Could you be a bit more concrete and give an example of a class and method where you are having problems figuring out how to do the method implementation?

DrawableImage re-implements the paint method inherited from Component. Unfortunately, I was just flagged so I can no longer post links to the api, but if you look up “DrawableImage” and go to the “paint()” function, you’ll see this text

Reimplemented from Component

I’d like to look into the .h or .cpp file where this is done to see how it was done.

I’d like to see the code where it does that, so I can copy/paste/modify it to paint what I want.

The juce API docs don’t directly point you to the implementation like the example you have given. If you want to find how the classes are implemented the easiest way in my opinion is just to let your IDE help you, I think every IDE has some sort of go to Declaration (–>header) oder Definition (–> cpp file) function, I attach a AppCode screenshot which is what I use for clarification, however it might look a bit different in your IDE…

Another option is to browse the JUCE git, just start in the root module folder https://github.com/WeAreROLI/JUCE/tree/develop/modules

This folder also lives on your computer, where ever you downloaded your JUCE copy.

2 Likes

Man, this is super weak. I was flagged as advertising.

Thank you PluginPenguin, the git link was exactly what I was looking for.

On another note, does anyone know how to remove this flag?

I suppose it was probably that link to my github. If that’s the case, I’ll take it as a compliment. The project I linked was a tiny personal one. But if anyone thought it looked professional enough to be an actual product, that’s kind of nice I guess…

Since you just joined a couple of days ago, the system was a bit nervous about linking more than once in one thread. This threshold will automatically be lifted once you have been on the forum for a while.

I did unhide the posts now

Edit: Actually, I got the year wrong, but anyway, it was just the machine’s decision :wink:

Thank you so much. I hadn’t realized it was the system. The auto-message said multiple people had flagged me and I was a little… worried. Seemed like a bad omen to not have anyone say something first. If it’s a bot though, that’s relieving.

What is this ASDR class called? Searching the docs for ASDR and Envelope yield no matches.

ADSR, not ASDR, note the spelling. It’s also part of the latest JUCE release, so if you are on an older version, it’s not available in those.

Ah. I’d searched adsr, messed up the post. I’m using a 5 day old version of JUCE, so it should be new enough. Do you know what the module>class is called?

Also, is it too new to be in the docs? Or am I searching the wrong name?

It might be it’s not part of even the official “master” source code of JUCE. At least it doesn’t show up in the online documentation. But it is in the “develop” branch of JUCE, available from github.

1 Like