> For the complete documentation index, see [llms.txt](https://lcav.gitbook.io/dsp-labs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lcav.gitbook.io/dsp-labs/granular-synthesis.md).

# 5. GRANULAR SYNTHESIS

In this exercise, we will implement a more sophisticated voice transformation with [granular synthesis](https://en.wikipedia.org/wiki/Granular_synthesis). Although the alien voice does a good job in altering the voice, it can severely harm intelligibility due to aliasing and can only be used for shifting the pitch up. With granular synthesis, intelligibility will not be so significantly affected *and* we can shift the pitch down to create a Darth Vader voice.

In [Section 5.1](/dsp-labs/granular-synthesis/effect_description.md), we will briefly explain how we will be performing pitch shifting with granular synthesis. As for the alien voice effect, we will *prototype* the implementation in Python by simulating a real-time environment that receives samples in a buffer-based fashion. This should minimize the amount of errors when implementing the voice transformation in C on an embedded device. We will guide you through the Python implementation in [Section 5.2](/dsp-labs/granular-synthesis/implementation.md).

As in the previous chapter, text contained in highlighted boxes, as shown below, will require ***you*** to determine the appropriate solution and implementation.

{% hint style="info" %}
TASK: This is a task for you!
{% endhint %}

May the Force be with you!

```
                                   _.-'~~~~~~~~~~~~`-._
                                  /         ||         \
                                 /          ||          \
                                |           ||          |
                                | __________||__________|
                                |/ -------- \/ ------- \|
                               /     (     )  (     )    \
                              / \     ----- () -----    / \
                             /   \         /||\        /   \
                            /     \       /||||\      /     \
                           /       \     /||||||\    /       \
                          /_        \o=============o/        _\
                            `--...__|`-._       _.-'|__...--'
                                    |    `-----'    |
```

*Figure: Modified from* [here](http://www.ascii-art.de/ascii/s/starwars.txt).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lcav.gitbook.io/dsp-labs/granular-synthesis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
