feat: adds new granular player module and sampling folder #194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi There !
I'm excited to share with you my latest contribution to the DaisySP project – the GranularPlayer module.
About the GranularPlayer
The GranularPlayer module is designed to playback arrays of samples offering independent control over time-stretching and pitch-shifting. Here are some key features:
Playback Speed Control: This module allows you to adjust the playback speed. You can, for example, set it to 1 for normal playback, 2 to double the original playback speed, 0.5 to halve the original speed, an so on, and also use negative values to play the sample in reverse.
Transposition: You can transpose the sample in cents (with 100 cents equal to one semitone).
Grain Size Control: You can adjust the grain size in milliseconds, ranging from 1 millisecond to your desired value. This capability lets you manipulate the granularity of your sound.
Dual Grains with Overlapping Envelopes: The GranularPlayer module is implemented using two grains of sound, each multiplied by a half cosine envelope with 180-degree phase difference. This design is inspired by the "grain.player~" object in Pure Data’s else lib, by Alexandre Porres, which, in turn, draws inspiration from the B section of an audio example in Miller Puckette's Pure Data examples.
Folder Organization
I've organized this module under a new "Sampling" folder. The reason behind this categorization is that the GranularPlayer module incorporates several features that didn't quite fit neatly into any of the existing categories within the DaisySP repository. The creation of the "Sampling" category serves a dual purpose. Firstly, it provides a logical home for this module, making it easier for developers and users to find and utilize it. Secondly, I hope that this new category can serve as an inspiration for other developers to explore and develop modules based on various sampling algorithms. I've also taken care of the necessary changes in the Makefile and CMakeLists.txt to ensure a seamless integration of the "Sampling" category into the DaisySP project.
Demonstration Video and Sample Sound Effect
I am also sharing a demonstration video to showcase it in action. In the video, I am using a small array that contains the iconic sound effect of Super Mario growing after eating a mushroom. This choice was intentional, as it's both small enough to fit into the flash memory of the Daisy Seed and culturally recognizable, making it a fun sound to experiment with.
The decision to use a small sample and an array pointer input, rather than a file system in SDRAM or an SD card module, is to keep the module as agnostic as possible. This way, users can easily pass a pointer to their array and the array's size, making it straightforward to integrate the GranularPlayer into their projects.
Showcase video