| Mozzi version v1.1.0 sound synthesis library for Arduino |

Public Member Functions | List of all members
WavePacketSample< ALGORITHM > Class Template Reference

A WavePacket which allows a custom table to be set as the audio source for the wavepackets (or grains). More...

`#include <WavePacketSample.h>`

Inheritance diagram for WavePacketSample< ALGORITHM >:

## Public Member Functions
void | setTable (const int8_t *TABLE_NAME)
| Change the sound table which will be played. More...
void | set (int fundamental, int bandwidth, int centrefreq)
| Set all the parameters for the synthesis. More...
void | setFundamental (int fundamental)
| Set the fundamental frequency. More...
void | setBandwidth (int bandwidth)
| Set the bandwidth. More...
void | setCentreFreq (int centrefreq)
| Set the centre frequency. More...
int | next ()
| Calculate the next synthesised sample. More...

## Detailed Description

### template<int8_t ALGORITHM>
class WavePacketSample< ALGORITHM >

A WavePacket which allows a custom table to be set as the audio source for the wavepackets (or grains).

Template Parameters

  ALGORITHM | options are SINGLE or DOUBLE, for a single non-overlapping stream of packets or a double, overlapping stream.

Definition at line 22 of file WavePacketSample.h.

## Member Function Documentation

## ◆ next()

template<int8_t ALGORITHM>

int WavePacket< ALGORITHM >::next | ( |  | ) |
| inline inherited

Calculate the next synthesised sample.

Returns
  a full-scale 16 bit value, which needs to be scaled to suit your sketch. If you're using it straight as the sketch output, then that will be yourThing.next()>>2 for HIFI 14 bit output, or >>8 for STANDARD 8+ bit output.

Definition at line 113 of file WavePacket.h.

## ◆ set()

template<int8_t ALGORITHM>

void WavePacket< ALGORITHM >::set | ( | int | fundamental,
|  | int | bandwidth,
|  | int | centrefreq
| ) |  |
| inline inherited

Set all the parameters for the synthesis.

The function is designed so that usable ranges for parameters can come from analog inputs, ie. 0-1023.

Parameters

  fundamental | the rate at which packets are produced.
  bandwidth | the width of each packet. A lower value allows more of the centre frequency to be audible, a rounder sound. A higher value produces narrower packets, a more buzzing sound.
  centrefreq | the oscillation frequency within each packet.

Definition at line 57 of file WavePacket.h.

## ◆ setBandwidth()

template<int8_t ALGORITHM>

void WavePacket< ALGORITHM >::setBandwidth | ( | int | bandwidth | ) |
| inline inherited

Set the bandwidth.

The function is designed so that usable ranges for parameters can come from analog inputs, ie. 0-1023.

Parameters

  bandwidth | the width of each packet. A lower value allows more of the centre frequency to be audible, a rounder sound. A higher value produces narrower packets, a more buzzing sound.

Definition at line 85 of file WavePacket.h.

## ◆ setCentreFreq()

template<int8_t ALGORITHM>

void WavePacket< ALGORITHM >::setCentreFreq | ( | int | centrefreq | ) |
| inline inherited

Set the centre frequency.

The function is designed so that usable ranges for parameters can come from analog inputs, ie. 0-1023.

Parameters

  centrefreq | the oscillation frequency within each packet.

Definition at line 100 of file WavePacket.h.

## ◆ setFundamental()

template<int8_t ALGORITHM>

void WavePacket< ALGORITHM >::setFundamental | ( | int | fundamental | ) |
| inline inherited

Set the fundamental frequency.

The function is designed so that usable ranges for parameters can come from analog inputs, ie. 0-1023.

Parameters

  fundamental | the rate at which packets are produced.

Definition at line 70 of file WavePacket.h.

## ◆ setTable()

template<int8_t ALGORITHM>

void WavePacketSample< ALGORITHM >::setTable | ( | const int8_t * | TABLE_NAME | ) |
| inline

Change the sound table which will be played.

Needs to be 8192 cells long for now.

Parameters

  TABLE_NAME | is the name of the array in the table ".h" file you're using.

Definition at line 29 of file WavePacketSample.h.