Skip to content

Commit

Permalink
update 0.01.12c tentative
Browse files Browse the repository at this point in the history
  • Loading branch information
sensorium committed Jun 27, 2013
1 parent 2e916e9 commit 76c6513
Show file tree
Hide file tree
Showing 548 changed files with 37,974 additions and 52,477 deletions.
7 changes: 7 additions & 0 deletions AudioDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class AudioDelay
}


/** Set the delay time, measured in cells.
@param delaytime_cells how many cells to delay the input signal by.
*/
inline
void set(unsigned int delaytime_cells){
_delaytime_cells = delaytime_cells;
Expand Down Expand Up @@ -128,5 +131,9 @@ class AudioDelay

};

/**
@example _09_delays/AudioDelay/AudioDelay.ino
This is an example of how to use the AudioDelay class.
*/
#endif // #ifndef AUDIODELAY_H_

11 changes: 9 additions & 2 deletions ControlDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

#include "AudioDelay.h"

/** Control delay line for delaying control signals, for instance to allow oone voice to follow the dynamics of another, a bit later.
Good for echo-like effects using multiple instances of the same voice, when AudioDelay would be too short.
/** Control-rate delay line for delaying control signals.
For example, this could be used to produce echo-like effects using multiple
instances of the same voice, when AudioDelay would be too short for an actual
audio echo. See AudioDelay for documentation, as this is just a wrapper of the same code.
@tparam NUM_BUFFER_SAMPLES is the length of the delay buffer in samples. This should
be a power of two.
@tparam the type of numbers to use for the signal in the delay. The default is char, but int could be useful
Expand All @@ -39,5 +41,10 @@ class ControlDelay: public AudioDelay<NUM_BUFFER_SAMPLES, T>
;
};

/**
@example _02_control/Control_Echo_Theremin/Control_Echo_Theremin.ino
This is an example of how to use the ControlDelay class.
*/

#endif // #ifndef CONTROLDELAY_H_

291 changes: 196 additions & 95 deletions Doxyfile

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Line.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
you can use Line to make an oscillator glide from one frequency to another,
pre-calculating the required phase increments for each end and then letting your
Line change the phase increment with only a simple addition at each step.
@tparam T the type of numbers to use. For example, Line <int> myline; makes a
@tparam T the type of numbers to use. For example, Line \<int\> myline; makes a
Line which uses ints.
@note Watch out for underflows in the internal calcualtion of Line() if you're not
using floats (but on the other hand try to avoid lots of floats, they're too slow!).
Expand All @@ -54,7 +54,7 @@ class Line

public:
/** Constructor. Use the template parameter to set the type of numbers you
want to use. For example, Line <int> myline; makes a Line which uses ints.
want to use. For example, Line \<int\> myline; makes a Line which uses ints.
*/
Line ()
{
Expand Down Expand Up @@ -104,7 +104,7 @@ class Line

/** Given a new starting value, target value and the number of steps to take on the way,
this sets the step size needed to get there.
@param value the number to set the Line's current_value to.
@param startvalue the number to set the Line's current_value to.
@param targetvalue the value to move towards.
@param num_steps how many steps to take to reach the target.
*/
Expand Down
43 changes: 35 additions & 8 deletions MozziGuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
#error Mozzi expects a cpu clock speed of 16MHz!
#endif


#include "mozzi_config.h" // User can change the config file to set audio mode
#include "TimerOne.h"
#include "TimerZero.h"
#include "TimerOne.h"
#include "FrequencyTimer2.h"

/** @mainpage Welcome
Expand All @@ -48,19 +49,45 @@ Utility functions which are generally useful, including midi note to frequency c
@section Classes
The Classes used to generate control and audio signals.
@section Files
Files includes ready-to-use wave tables and samples which are in the Mozzi/tables and Mozzi/samples folders.
See the sample files themselves for documentation.
You can also convert your own sounds from a program like
Audacity to tables for Mozzi with a script called char2mozzi.py, in Mozzi/python.
@section Soundtables
Includes ready-to-use wave tables and a few example samples which are in
the Mozzi/tables and Mozzi/samples folders.
Read the char2mozzi.py file for instructions.
You can convert your own sounds from a program like Audacity to tables for Mozzi
with a script called char2mozzi.py, in Mozzi/python. Read the char2mozzi.py file for instructions.
*/


/** @defgroup Soundtables
Look-up-tables for audio waveforms, waveshaping, and control functions, and
python scripts to generate or convert them. Includes ready-to-use wave tables
and a few example samples which are in the Mozzi/tables and Mozzi/samples
folders. You can convert your own sounds from a program like Audacity to tables
for Mozzi with a script called char2mozzi.py, in Mozzi/python. Read the
char2mozzi.py file for instructions. Also check out the other scripts in the python
folder for templates to use if you want to do your own thing.
*/


/** @defgroup core Mozzi core definitions and functions
The bones of every Mozzi sketch.
*/
//@defgroup tables Mozzi look-up-tables for audio waveforms, waveshaping, and control functions.


/** @ingroup core
Mozzi's CONTROL_RATE sets how many times per second updateControl() is called.
It can be any power of 2 greater than 64, and the largest value where it starts to
become impractical is around 1024. 64, 128, 256 and sometimes 512 are all usable values.
Try to keep it as low as you can, for efficiency, though higher rates can sometimes give smoother results,
avoiding the need to interpolate sensitive variables at audio rate in updateAudio().
CONTROL_RATE has a default of 64 Hz, but it can be changed at the top of your sketch,
after the \#includes, for example:
\#define CONTROL_RATE 256
*/
#define CONTROL_RATE 64



/** @ingroup core
Use \#define AUDIO_MODE STANDARD in Mozzi/config.h to select Mozzi's original audio
Expand Down
13 changes: 10 additions & 3 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ Version 0.01.2c
Madetwi_initiateReadFrom() and twi_initiateWriteFrom() return their error states
and made twi_continueReadFrom() and twi_continueWriteFrom() return void.
- numbered the Examples category folders to give more sense of organisation and progression
- added Examples > _04_analog_input > Audio_Input, a minimal test of Mozzi audio input.


- added Examples > Mozzi > _04_analog_input > Audio_Input, a minimal test of Mozzi audio input.
- added Examples > Mozzi > _02_control > Control_Echo_Theremin, demonstrating ControlDelay()
- repaired hack for Teensy 2 in mozzi_analog.h so it compiles again
- moved default CONTROL_RATE definition to MozziGuts.h, it doesn't need to be in
a config file if you can change it in a sketch.
- changed sin1024_int8.h table to use full range signed 8 bit values - it was scaled down slightly for a forgotten project
- removed samples/TJBAnalogDisk and samples/thumbpiano, these will be available as a separate "Mozzi_Extras" download.
- removed samples/Bamboo1 and changed samples/Samples sketch to use samples/bamboo


Version 0.01.2b
- fixed some docs
- added thumbpiano samples
Expand Down
11 changes: 6 additions & 5 deletions Oscil.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@



/** Oscil plays a wavetable, cycling through the table to generate an audio or
/**
Oscil plays a wavetable, cycling through the table to generate an audio or
control signal. The frequency of the signal can be set or changed with
setFreq(), and the output of an Oscil can be produced with next() for a simple
cycling oscillator, or atIndex() for a particular sample in the table.
Expand Down Expand Up @@ -150,20 +151,20 @@ class Oscil


/** Get the phase of the Oscil in fractional format.
@param phase a position in the wavetable.
@return position in the wavetable, shifted left by OSCIL_F_BITS (which is 16 when this was written).
*/
unsigned long getPhaseFractional()
{
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
return phase_fractional;;
return phase_fractional;
}
}



/** Returns the next sample given a phase modulation value.
@param a phase modulation value given as a proportion of the wave. The
@param phmod_proportion a phase modulation value given as a proportion of the wave. The
phmod_proportion parameter is a Q15n16 fixed-point number where the fractional
n16 part represents -1 to 1, modulating the phase by one whole table length in
each direction.
Expand Down Expand Up @@ -256,7 +257,7 @@ class Oscil
}
*/
/** Returns the sample at the given table index.
@param atIndex table index between 0 and the table size.The
@param index between 0 and the table size.The
index rolls back around to 0 if it's larger than the table size.
@return the sample at the given table index.
*/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Mozzi
sound synthesis library for Arduino
------------------------------------

Version 0.01.2b
Version 0.01.2c
Tim Barrass 2010-13


Expand Down
2 changes: 1 addition & 1 deletion RecentAverage.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class


/** Give the average of the last NUM_READINGS.
@param a control signal such as an analog input which needs smoothing.
@param input a control signal such as an analog input which needs smoothing.
@return the smoothed result.
*/
T next(T input)
Expand Down
30 changes: 15 additions & 15 deletions Sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class Sample


/** Sets the starting position in samples.
@param offset position in samples.
@param startpos offset position in samples.
*/
inline
void setStart(unsigned int start)
void setStart(unsigned int startpos)
{
startpos_fractional = (unsigned long) start << SAMPLE_F_BITS;
}
Expand All @@ -122,7 +122,7 @@ class Sample


/** Sets the a new start position and sets the phase (the playhead) to that position.
@param start position in samples from the beginning of the sound.
@param startpos position in samples from the beginning of the sound.
*/
inline
void start(unsigned int startpos)
Expand All @@ -132,7 +132,7 @@ class Sample
}


/** Sets the end position in samples from the beginning of the sound..
/** Sets the end position in samples from the beginning of the sound.
@param end position in samples.
*/
inline
Expand Down Expand Up @@ -211,13 +211,13 @@ class Sample

// Not readjusted for arbitrary table length yet
//
// /** Returns the next sample given a phase modulation value.
// @param a phase modulation value given as a proportion of the wave. The
// Returns the next sample given a phase modulation value.
// @param phmod_proportion phase modulation value given as a proportion of the wave. The
// phmod_proportion parameter is a Q15n16 fixed-point number where to fractional
// n16 part represents -1 to 1, modulating the phase by one whole table length in
// each direction.
// @return a sample from the table.
// */
//
// inline
// char phMod(long phmod_proportion)
// {
Expand All @@ -227,15 +227,15 @@ class Sample



/** Set the oscillator frequency with an unsigned int. This is faster than using a
float, so it's useful when processor time is tight, but it can be tricky with
low and high frequencies, depending on the size of the wavetable being used. If
you're not getting the results you expect, try explicitly using a float, or try
setFreq_Q24n8.
/** Set the oscillator frequency with an unsigned int.
This is faster than using a float, so it's useful when processor time is tight,
but it can be tricky with low and high frequencies, depending on the size of the
wavetable being used. If you're not getting the results you expect, try
explicitly using a float, or try setFreq_Q24n8.
@param frequency to play the wave table.
*/
inline
void setFreq ( int frequency) {
void setFreq (int frequency) {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
phase_increment_fractional = ((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)*frequency)/UPDATE_RATE) << (SAMPLE_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS);
Expand All @@ -247,7 +247,7 @@ class Sample
way to set frequencies, -Might- be slower than using an int but you need either
this or setFreq_Q24n8 for fractional frequencies.
@param frequency to play the wave table.
*/
*/
inline
void setFreq(float frequency)
{ // 1 us - using float doesn't seem to incur measurable overhead with the oscilloscope
Expand Down Expand Up @@ -279,7 +279,7 @@ class Sample


/** Returns the sample at the given table index.
@param atIndex table index between 0 and the table size.The
@param index between 0 and the table size.The
index rolls back around to 0 if it's larger than the table size.
@return the sample at the given table index.
*/
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version 0.01.2b
Version 0.01.2c
Loading

0 comments on commit 76c6513

Please sign in to comment.