Wavetable | A Rust library for wavetable handling

 by   icsga Rust Version: Current License: MIT

kandi X-RAY | Wavetable Summary

kandi X-RAY | Wavetable Summary

Wavetable is a Rust library. Wavetable has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

This is a library for generating and using wavetables. It is currently used in the Yazz software synthesizer. The library offers support for importing wavetables from wave files, bandlimiting the tables to avoid aliasing, storing tables in a compressed format and getting samples from the tables. While functional, this is not yet in a very useful state. The code is currently being reworked into a library and needs a lot of refactoring, testing and optimization. There is not much documentation yet, and some features are still missing.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Wavetable has a low active ecosystem.
              It has 1 star(s) with 0 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              Wavetable has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of Wavetable is current.

            kandi-Quality Quality

              Wavetable has 0 bugs and 0 code smells.

            kandi-Security Security

              Wavetable has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Wavetable code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Wavetable is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Wavetable releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Wavetable
            Get all kandi verified functions for this library.

            Wavetable Key Features

            No Key Features are available at this moment for Wavetable.

            Wavetable Examples and Code Snippets

            No Code Snippets are available at this moment for Wavetable.

            Community Discussions

            QUESTION

            How to read optimally from an array (in memory) having array position from a vector?
            Asked 2021-Apr-13 at 20:45

            I've such a code:

            ...

            ANSWER

            Answered 2021-Apr-13 at 20:45

            Your code is not too efficient for multiple reasons.

            1. You’re setting individual lanes of SIMD vectors with scalar code. Processors can’t quite do that, but the compiler pretends they can. Unfortunately, these compiler-implemented workarounds are slow, typically they do that with a rountrip to memory and back.

            2. Generally, you should avoid writing loops of very small lengths of 2 or 4. Sometimes compiler unrolls and you’re OK, but other time they don’t and the CPU is mispredicting way too many branches.

            3. Finally, processors can load 64-bit values with a single instruction. You’re loading consecutive pairs from the table, can use 64-bit loads instead of two 32-bit ones.

            Here’s a fixed version (untested). This assumes you’re building for PCs i.e. using SSE SIMD.

            Source https://stackoverflow.com/questions/67076900

            QUESTION

            Is there a way to set an object member array size from a project's main program file that #includes the .h file used to declare/define the object?
            Asked 2020-Dec-18 at 01:26

            For context, I'm working in c++ on a stm32f ucontroller doing embedded audio and trying to avoid dynamic allocation.

            One of the classes I've written is a wavetable oscillator that is, for the scope of my question, essentially just a bunch of c-style arrays.
            I have these files, among others, in a separate folder from the specific project that is using them so I can reuse them across projects with no rewriting or copy/pasting.

            The values that fill the arrays are calculated during an initialization routine rather than being hardcoded so that, if I change the "#define tableLength 256" statement at the top that sets the size of the arrays from 256 to some other value, the waveforms will be recalculated properly the next time I compile and flash the program onto the chip.

            Since I'm working with limited memory resources, some programs that use this wavetable oscillator may necessitate that these tables be of a smaller size.

            Is there a way of specifying the size of these arrays from a given project's main program file so that nothing needs to be changed in the shared wavetable oscillator file?

            I'm still pretty early into my programming journey, but my intuition tells me there must be some sort of mechanism to accomplish this since the size of the arrays will still be known at compile time?

            I'm trying to avoid changing the array size directly in the shared file, because any file that gets modified since the last flashing gets recompiled during the flashing process.
            This means I would have to remember to change the value every time I needed to flash a different product or work on a different project.

            For further context, I'm building and uploading the programs using a makefile.
            My knowledge of using them is very minimal, so maybe there's a way to specify the size to be used for the arrays from the project's makefile?

            Thanks for the help.

            ...

            ANSWER

            Answered 2020-Dec-18 at 01:26

            Since you include the c++ tag in your question and c++ language includes templates, then you can parametrize the size of a static array declared in another file from a MAIN.cpp file like this:

            In MYCLASS.cpp (declared in MYCLASS.h)

            Source https://stackoverflow.com/questions/65333678

            QUESTION

            Pygame read MIDI input
            Asked 2020-Nov-20 at 16:04

            I referenced the Pygame MIDI documentation and this code to try to get MIDI input to work. The MIDI Interface (Avid Eleven Rack) receives MIDI data from my MIDI controller just fine in my audio software (Pro Tools). Using Pygame, however, I can not seem to read any information at all.

            Source Code ...

            ANSWER

            Answered 2020-Nov-20 at 16:04

            I got an answer in another forum. It turns out that there is an example file which shows how to get the code to work. So if someone else stumbles over this problem here is the useful part of example code:

            Source https://stackoverflow.com/questions/64818410

            QUESTION

            Change wavetable pitch (Resample)
            Asked 2020-Oct-19 at 19:07

            I've been using math equations to do some basic synthesis for android. The problem with that the formulas keep and keep getting more complicated. So i'm starting to use wavetable synthesis.

            So far i can play a single note based on an array of bytes and a predetermined frequency. However when looking for formulas to resample the samples and change the pitch of the wavetable... i just couldn't find a simple solution. There are whole libraries that do this. But it feels like it should be a simple formula to change the sample frequency by downsampling or oversampling.

            Is there an easy way of doing that?

            Ex: Input is [0,0.5,1,0.5,0...] let's pretend it's a C4

            To make it a C3 the expected output should be [0,0.25,0.5,0.75,1,0.75,0.5,0.25,0...]

            Basically it's and android's audiopool "rate" property but just the formula that resamples the bytes, which i haven't found anywhere

            EDIT:

            Thank you to Phil Freihofner for guiding me to the answer. However the original formula he provided didn't smoothed out the end in case of oversampling. But it was a really nice start and i only had to smooth the end. I will attach my end code in case anyone wants a simple function to "Stretch out" a float array.

            ...

            ANSWER

            Answered 2020-Oct-19 at 19:07

            Let's say you have a wave table in floats.

            What you can then do is create a "cursor" to iterate through the table. This cursor does NOT have to be an integer, it can be a float. When your cursor lands on a value that is in between two elements your wave table, you can use linear interpolation to calculate a "good enough" value to return.

            Consider the first wave table the have. It plays C4 when you use a cursor with an increment of 1. If you make the increment 0.5 and use linear interpolation, the values that you would be returning would be the same as contents of your table that is an octave lower.

            But you could chose any increment value, and even change it over time (to get glissandos).

            The exact size of the increment for the cursor will depend on the size of the wave table and the sample rate as well as the desired pitch.

            I am using wavetables for an FM synthesizer I coded. The sine wave table has 1024 increments for a single wave, float resolution. It seems to be working well. Sounds are quite clear--definitely less quantization noise than I get with my old Yamaha DX7 or the second generation DX7S.

            Here is the code I'm currently using for returning the wave table value for a given cursor value, using linear interpolation:

            Source https://stackoverflow.com/questions/64417603

            QUESTION

            Dynamically setPeriodicWave() of WebAudio Oscillator that's playing?
            Asked 2020-Jul-10 at 15:01

            Trying to do some basic wavetable synthesis (developing an addon for p5.sound) – and wondering if it's possible to dynamically change the waveform of an oscillator while it's playing (constant tone rather than note duration)? In my basic testing, the setPeriodicWave() function has to be called before the oscillator is connected to the AudioContext output then started. Hoping to do some dynamic wavetable synth (with two hard panned channels) for feeding into the X-Y mode of an oscilloscope (for vector visuals based on audio signals). The workflow above, constantly creating a new oscillator with every wavetable change, causes lots of artifacts and phase-shifting issues... it would be great if I could start two oscillators and just update their waveform. Any tips on workflow for doing so? My abstracted workflow:

            • create oscillator with 'custom' type (inited with a flat/silent wave)
            • custom setWavetable() which uses functions from dsp.js to createPeriodicWave() with array values
            • re-init oscillator with this wave (stop oscil, disconnect/trash oscil, init new oscil w/ wave, connect + start oscil)
            ...

            ANSWER

            Answered 2020-Jul-10 at 15:01

            What issues are you having? As an example, this works for me. I can clearly hear the sound change:

            Source https://stackoverflow.com/questions/62833963

            QUESTION

            Why does my template lead to duplicated symbols?
            Asked 2020-May-10 at 07:40

            My program has 30 duplicate symbols errors for the methods length() and table() from the struct below.

            This struct can be instantiated in four ways. Each of them is identical but for the table each instantiation refers to and, potentially, the length of that table.

            This needs to be known at compile time in order that I can construct an array in the following fashion.

            std::array, N> oscillators;.

            Could someone please help me to see my error?

            ...

            ANSWER

            Answered 2020-May-10 at 07:35

            Fully specialized template functions in a header file should be declared inline

            Source https://stackoverflow.com/questions/61708606

            QUESTION

            Multi-Threaded Wavetable Synthesizer clicks. Is this caused by torn reads?
            Asked 2020-Mar-18 at 18:23

            I'm currently working on a very basic wavetable synthesizer. I'll try my best to give an understandable overview.

            I have a single lookup-waveform with 4096 points, which is sampled by the audio thread. In general, however, a single oscillator has multiple waveforms, which can be morphed by a position parameter. For example, let's take two sine waves where the second one has half the period of the first one. When we play those back at frequency = 440Hz and position = 0.5, we would hear two equally loud tones at 440Hz and 880Hz. Here's a link to the audio (See Sidenote 2).

            Due to performance reasons I generate the lookup table on another thread whenever the position parameter changes. And therein lies my problem. Even when I don't change the table position and just periodically generate my lookup table, I get weird, unpredictable glitches. Since the audio data in the table doesn't change in this case, I can only explain this by torn reads. Is that correct? And if so, how do I get around it? Do I use a double-buffer with an atomic pointer-swap after I finish generating the data?

            Again, here's the audio for this recording (See Sidenote 2). Also, some oscilloscope data:

            Sidenote 1: Populating my lookup table takes ~50,000ns without optimizations and ~10,000ns with optimizations. But the glitches seem to happen with the same probability.

            Sidenote 2: The website I uploaded the audio to seems to have introduced some weird harmonics, which are not audible in my video. Just so you know.

            ...

            ANSWER

            Answered 2020-Mar-18 at 18:23

            Found it! I accidentally set an old scanner position after generating my lookup table. If the latter took too long my position was basically reset to a few microseconds earlier, which explains the visual setback in the oscilloscope.

            Source https://stackoverflow.com/questions/60743123

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Wavetable

            You can download it from GitHub.
            Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/icsga/Wavetable.git

          • CLI

            gh repo clone icsga/Wavetable

          • sshUrl

            git@github.com:icsga/Wavetable.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link