10 using namespace Nsound;
41 Vocoder vocod(sr, 0.0050, 32, 4000);
49 output >>
"example5.wav";
58 cerr <<
"Could not play audio: " << e.
what() << endl;
80 pylab.
ylim(0.0, fmax);
81 pylab.
xlim(0.0, voice_dur);
83 pylab.
title(
"Voice input");
85 pylab.
subplot(2, 1, 2,
"", &ax1, &ax1);
94 pylab.
ylim(0.0, fmax);
95 pylab.
xlim(0.0, voice_dur);
97 pylab.
title(
"Voice output");
111 catch(std::exception & e)
113 cerr <<
"Exception: " << e.what() << endl;
static void show()
Acutally draw the plots to the screen.
float64 getDuration() const
Returns the number of seconds of audio data in the stream.
Buffer getTimeAxis() const
Nsound::Buffer generate(const float64 &duration, const float64 &grain_frequency, const float64 &waves_per_grain, const float64 &grains_per_second)
float64 getSampleRate() const
Returns the sample rate of the stream.
AudioStream getTranspose() const
Retuns a copy of the AudioStream transposed.
void figure(const std::string &kwargs="") const
Creates a new figure window to plot in.
A wrapper around a Matplotlib Axes object.
void title(const std::string &title, const std::string &kwargs="")
Add a title to the plot at the top and centered.
void xlim(const float64 &xmin, const float64 &xmax)
Sets the limit for the x & y axis.
const char * what() const
Axes subplot(const uint32 n_rows, const uint32 n_cols, const uint32 n, const std::string &kwargs="", Axes *sharex=NULL, Axes *sharey=NULL)
Creates a figure in a subplot, subplot(A, B, C, **kwargs)
void ylim(const float64 &ymin, const float64 &ymax)
void imagesc(const AudioStream &Z, const std::string &kwargs="")
Plots the AudioStream like a 2D matrix.
void normalize()
Multiplies the Buffer by a constant gain so the peak sample has magnitude 1.0.
Buffer getFrequencyAxis() const
A Buffer for storing audio samples.
AudioStream filter(const AudioStream &x)
static void setDefaultSampleRate(const int32 rate)
AudioStream getMagnitude() const
Buffer filter(const Buffer &voice, const Buffer &carrier)