Forum
    • Categories
    • Register
    • Login

    How can I make authentic chiptune sound via waveform generator?

    Scheduled Pinned Locked Moved General Questions
    13 Posts 3 Posters 269 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      OstinTheKr0t
      last edited by

      Tbh I also wanted too add waveform editor (just like Namco163 NES add-on). Rn trying figure out how to done it. But if you have any ideas how to do it, you can post your assumptions.

      B 1 Reply Last reply Reply Quote 0
      • B
        Ben Catman @OstinTheKr0t
        last edited by

        @OstinTheKr0t

        you need to be more specific on what you want to achieve? i am glad to help, as this community has also helped me a lot, but i need more information?

        Btw shall i do a written tutorial on how to combine c++ nodes with your project ? Would the community be interested in that ?

        LindonL O 3 Replies Last reply Reply Quote 1
        • LindonL
          Lindon @Ben Catman
          last edited by

          @Ben-Catman said in How can I make authentic chiptune sound via waveform generator?:

          Btw shall i do a written tutorial on how to combine c++ nodes with your project ? Would the community be interested in that ?

          more useful documentation is always welcome.

          Maybe use an Air windows C++ FX as your example...

          HISE Development for hire.
          www.channelrobot.com

          B 1 Reply Last reply Reply Quote 1
          • O
            OstinTheKr0t @Ben Catman
            last edited by

            @Ben-Catman
            Okay, let me explain:
            I want to create a VST plugin for composing chiptune music. The reason: existing plugins don't meet my needs.

            At first, I tried using a sampler to create five basic waveform types: Square, Triangle, Sawtooth, Sine, and Noise. But then I ran into a problem: the user would have to download samples to use the VST plugin (which doesn't suit me, as it doesn't make sense with simple waveforms).

            Then I remembered the waveform generator and tried to do everything with it, but it uses a synthesizer to generate the waves, which makes the waves smoother. This doesn't match the authentic sound.The video I linked above shows what the waveform should look like.

            In other words, I want to make a copy of the Magical 8bit Plugin, but with Sawtooth and Sine waveforms and I want to keep all sethings of the waveform.44YWML6BYFBRHuWBwFf3UB.png

            1 Reply Last reply Reply Quote 0
            • O
              OstinTheKr0t
              last edited by

              I heard that Magical 8bit plug was made with JUICE, so I don't think that could be a big problem.

              Also, I'm not really good at coding. Yeah...

              1 Reply Last reply Reply Quote 0
              • O
                OstinTheKr0t @Ben Catman
                last edited by

                @Ben-Catman
                Anyway, I want you to help me with the code, please.

                B 1 Reply Last reply Reply Quote 0
                • B
                  Ben Catman @OstinTheKr0t
                  last edited by

                  @OstinTheKr0t

                  well i get it, but one thing i want to mention in advance is , that i would not want my (simple) code to be used in projects that are public. As you mentioned , you want "the user" not to force to install samples. That implies for me that you want to distribute the vst.

                  COMMUNITY: What would you do ? I really want to help, but if this project is not for personal use, i have some problems with that.

                  Anyways, - First you need to create the waveform itself - then you need to downsample and bitcrush it, depending on your needs.

                  O 1 Reply Last reply Reply Quote 0
                  • B
                    Ben Catman @Lindon
                    last edited by

                    @Lindon

                    as i have read quite a few times there is need for a low / highpass with steeper slopes.... i could give the community the code and everything and show them how to implement that as third party c++ node, if that helps.

                    Pretty sure soon a kind of AI will help us all with that part of the job, but as long as we dont have this feature, i am more than willing to help others

                    Cheers

                    1 Reply Last reply Reply Quote 0
                    • O
                      OstinTheKr0t @Ben Catman
                      last edited by

                      @Ben-Catman
                      I don't plan to distribute it right now. For now, I just want the plugin to work without any problems. If the VST works well, I'd like to make it public (something like making a YouTube video and leaving a Google Drive link where it can be downloaded). And it will be ABSOLUTELY FREE.

                      If you'd like, I can credit you as the coder. Or leave a link to your social media accounts.

                      In any case, I don't currently plan to release it publicly for now. As I said before, I just want it to work well.

                      B 1 Reply Last reply Reply Quote 0
                      • B
                        Ben Catman @OstinTheKr0t
                        last edited by Ben Catman

                        @OstinTheKr0t

                        okok, tehre you go:

                        here is a short explaination -

                        It combines Sample Rate Reduction (Sample & Hold) and Bit Depth Quantization in a single SNEX node.How it works:The node processes audio in two distinct stages to achieve that classic "crushed" digital sound.

                        1. Sample Rate Reduction (Temporal Distortion)Instead of processing every incoming sample, the node "freezes" the amplitude for a set number of samples using a counter and a buffer.The Logic:

                        • A holdCounter tracks the "steps." When it hits zero, it grabs a new "snapshot" of the input signal and stores it in holdLeft/Right.The Result: This creates a "staircase" waveform. In the frequency domain, this introduces Aliasing, giving it that metallic, ringing Lo-Fi character.

                        2. Bit Depth Reduction (Amplitude Quantization)This stage reduces the dynamic resolution of the signal, simulating older AD/DA converters (like 8-bit or 12-bit systems).

                        The Math:

                        1. We calculate the available "steps" based on the bit depth
                          2. We scale the signal up, round it to the nearest integer, and scale it back down

                        The Result: This introduces Quantization Noise and "fuzziness," especially audible on tails and quiet signals.

                        template <typename T> void processFrame(T& data)
                                {
                                    // --- Sample Rate Reduction (Sample & Hold) ---
                                    int divider = jmax(1, (int)srDivider);
                        
                                    if (holdCounter <= 0)
                                    {
                                        holdLeft = data[0];
                                        holdRight = data[1];
                                        holdCounter = divider;
                                    }
                                    holdCounter--;
                        
                                    float outL = holdLeft;
                                    float outR = holdRight;
                        
                                    // --- Bit Crusher ---
                                    
                                    float steps = std::pow(2.0f, bitDepth) - 1.0f;  // calculate steps
                                    steps = jmax(1.0f, steps);
                        
                                    outL = std::round(outL * steps) / steps;
                                    outR = std::round(outR * steps) / steps;
                        
                                    data[0] = outL;
                                    data[1] = outR;
                                }
                        
                                int handleModulation(double& ) { return 0; }
                                void setExternalData(const ExternalData& , int ) {}
                        
                                // -------------------------------------------------------------------------
                                // Parameters:  0 = BitDepth  |  1 = SampleRateReduction
                                // -------------------------------------------------------------------------
                                template <int P> void setParameter(double v)
                                {
                                    if constexpr (P == 0)   // Bit Depth  (1 – 16)
                                        bitDepth = (float)jlimit(1.0, 16.0, v);
                        
                                    if constexpr (P == 1)   // SR Divider (1 – 32)
                                        srDivider = (float)jlimit(1.0, 32.0, v);
                                }
                        

                        Play around with the settings, and you will get the classic NES - Sound :)

                        I can gice you the .h files if you send me a dm

                        Cheers Ben

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        41

                        Online

                        2.2k

                        Users

                        13.5k

                        Topics

                        117.2k

                        Posts