How do you guys feel about the API for envelopes?  Currently, procedural 
sources are created like so: 
sine_wav = procedural.Sine(duration=1, frequency=220)

Since there could be more than one type of envelope, I'm thinking to add an 
additional "envelope" parameter to the procedural sources. This will 
default to a "flat" envelope, which will essentially do nothing (except 
maybe amplitude). If you want to pass a more advanced envelope, you will 
create an instance of it first and then pass it in. For example: 
adsr_envelope = procedural.ADSREnvelope(attack=0.05, decay=0.1, 
sustain_amplitude=0.7, release=0.3)
sine_wave = procedural.Sine(duration=1, frequency=220, envelope=
adsr_envelope)

Does that seem reasonable? 








On Tuesday, December 6, 2016 at 4:47:34 PM UTC+9, Benjamin Moran wrote:
>
> Those are great utilities. Some of those effects might be better suited on 
> top of the procedural model though. 
>
> At it's core, the procedural module just creates pure waveforms using 
> simple algorythms. It's not really a synthesizer, so there is no current 
> way to influence the input of the calculation. This rules out certain types 
> of effects, but doesn't rule out different types of envelopes.
>
> I think envelopes are needed for sure, as like you said there is no volume 
> control. Currently, all waves are an amplitude of "1.0", meaning full 
> volume. 
> Amplitude is something that is kind of part of envelopes anyhow, so it 
> makes the most sense to go that route with full blown envelopes. 
>
> The first envelope will be a "flat" envelope, which is esentially just a 
> volume control.
> Second, and simple linear decay envelope. This should have start and end 
> values. Default could be to start at 1.0, and end at 0.0 (or whatever flat 
> progression you want). 
> Third, an ADSR envelope which is described here: 
> https://en.wikipedia.org/wiki/Synthesizer#Attack_Decay_Sustain_Release_.28ADSR.29_envelope
> Fourth, I'd like to do some type of exponential decay envelope as 
> described here: https://en.wikipedia.org/wiki/Exponential_decay
>
> I think it would be great if you could take some simple music notation, 
> and make a little player that plays these using the procedural module. The 
> current waveforms are still just a bit too plain, so that's why I'm working 
> on this stuff. 
>
> Also, if anyone wants a little toy keyboard that uses this module, I've 
> make this quick demo: 
> https://bitbucket.org/treehousegames/pyglet/src/a446fd59aa3b248637d6198d25be9fafe52eb87c/examples/synthesizer.py?at=procedural_evolved&fileviewer=file-view-default
>
>
>
>
> On Tuesday, December 6, 2016 at 6:26:09 AM UTC+9, [email protected] wrote:
>>
>> Hmm, SFXR <http://www.drpetter.se/project_sfxr.html> and BFXR 
>> <http://www.bfxr.net/> might be good reference points. Perhaps 
>> pyglet.media.procedural could have assorted variables for controling attack 
>> time, volume, pitch, delta slide, etc, with a Randomize() function, boolean 
>> filters for wave type, a mutate() function, etc.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to