HISE Logo Forum
    • Categories
    • Register
    • Login

    Anything wrong with doing this? || Buffer Length

    Scheduled Pinned Locked Moved General Questions
    13 Posts 3 Posters 246 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.
    • ChazroxC
      Chazrox
      last edited by Chazrox

      Im just curious if this is some kind of taboo or something. Idk why I have the fear of it crashing my project down the line like having some crazy timer rate or something.... just curious. 🙏

      Im setting the "BufferLength" to 1 just to get that simpler wave visual. Can I go lower than 1? lol.
      Screenshot 2025-05-24 at 3.48.18 PM.png

      HISEnbergH 1 Reply Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @Chazrox
        last edited by

        @Chazrox Did you even try 1 sample? You can't really see any useful information with just 1 sample. Even at the lowest sampling rate of 44.1kHz, I think that only equates to like 20~ microseconds in time (that number is probably wrong, but it's something like that).

        But either way, setting the Buffer Length to to a float instead of an integer will either round the number to the closer integer or crash. It's not possible to go below the sample rate.

        ChazroxC 2 Replies Last reply Reply Quote 0
        • ChazroxC
          Chazrox @HISEnberg
          last edited by Chazrox

          @HISEnberg I tried it. Its useful for what I want it for and it just looks like what Im trying to get out of it so im wondering if its safe.

          Screenshot 2025-05-24 at 3.58.16 PM.png

          HISEnbergH 1 Reply Last reply Reply Quote 0
          • ChazroxC
            Chazrox @HISEnberg
            last edited by Chazrox

            @HISEnberg Ideally I would like it to just show 1 cycle of the wave but im not sure how to do that so im kind of settling for what I have as well. Do you know how I can achieve that? Im novice at this type of stuff. Appreciate the input! 🙏

            the pic above looks like its showing 1 cycle but when its moving the visual feedback is moving to much. I want it to show the waveform edges to change but not "cycle" if that makes sense. I dont want the signal to look like its moving from right to left, but a still visual of the wave shape.

            HISEnbergH 1 Reply Last reply Reply Quote 0
            • HISEnbergH
              HISEnberg @Chazrox
              last edited by

              @Chazrox That doesn't look correct. You couldn't see a full cycle of the waveform if the buffer length is at 1 sample. You would only ever see a portion of it. Did you hit "Apply" after setting it to 1 sample?

              ChazroxC 1 Reply Last reply Reply Quote 0
              • ChazroxC
                Chazrox @HISEnberg
                last edited by Chazrox

                @HISEnberg I did. Thats how it looks after pressing apply. As for as I know thats all I did.

                1 Reply Last reply Reply Quote 0
                • HISEnbergH
                  HISEnberg @Chazrox
                  last edited by

                  @Chazrox it's hypothetically possible but realistically it is not doable. Essentially your buffer length would have to be resized to whatever the frequency is. A pure signal (like a sine wave ) is easier since the frequency is stagnant and doesn't have harmonics. But with white noise it would be impossible. Essentially the buffer length always has to be the same size or somewhat larger than the frequency.

                  This part is chatGPT:

                  period (samples) = sampleRate (Hz) ÷ frequency (Hz)
                  
                  

                  At 44 100 Hz sample rate, a 440 Hz sine wave has a period of 44 100 ÷ 440 ≈ 100 samples.

                  At 96 000 Hz, that same 440 Hz tone needs ≈ 218 samples.

                  If you set your buffer to, say, 50 samples, you’ll only ever “see” half of the 440 Hz cycle; set it to 10 samples, less than an eighth of the cycle; set it to 1 sample, and you just get a single point that jumps up and down—you can’t reconstruct any shape.

                  Me again:
                  You would have to account for the sample rate, and then account for the frequency of the signal. Then you would have to dynamically resize the buffer, which is possible. However, this example only really works for a sine wave, anything else it gets more complicated and then closer to impossible!

                  ChazroxC 1 Reply Last reply Reply Quote 1
                  • ChazroxC
                    Chazrox @HISEnberg
                    last edited by

                    @HISEnberg ahh. I see. Possible, but just a sh** ton of math haha. Thanks for that. That still helps me understand.

                    HISEnbergH 1 Reply Last reply Reply Quote 0
                    • HISEnbergH
                      HISEnberg @Chazrox
                      last edited by

                      @Chazrox Ya it's very useful to know. I would just say set it super close if you want that type of waveform display (like 256 samples). It changes based on the sample rate though.

                      As an aside I don't know why you are seeing the full cycle, that isn't correct. Something is going wrong there. I tried playing a sine wave at ~8Hz , with a 1 sample buffer and it looks like this (44.1kHz sample rate).

                      Screenshot 2025-05-24 at 7.21.13 PM.png

                      ChazroxC 1 Reply Last reply Reply Quote 1
                      • ChazroxC
                        Chazrox @HISEnberg
                        last edited by Chazrox

                        @HISEnberg I just hit any note on my keyboard tbh so I cant even tell you. It just happened to look like that when I screenshotted it at the time.

                        edit**

                        I just tried again and the lower notes look more like your picture.

                        Christoph HartC 1 Reply Last reply Reply Quote 1
                        • Christoph HartC
                          Christoph Hart @Chazrox
                          last edited by

                          @Chazrox if you move the oscilloscope into the midi chain it will dynamically resize the cycle length to the frequency derived by the note number so you should see a more or less steady waveform.

                          ChazroxC 2 Replies Last reply Reply Quote 2
                          • ChazroxC
                            Chazrox @Christoph Hart
                            last edited by

                            @Christoph-Hart woah... Ok. Im gonna try that asap! Thanks!

                            1 Reply Last reply Reply Quote 0
                            • ChazroxC
                              Chazrox @Christoph Hart
                              last edited by

                              @Christoph-Hart Wow...game changer! 🙏

                              Thank you sir!

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

                              26

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              103.1k

                              Posts