Re: [go-nuts] Any keyboard players here?

2016-06-22 Thread Daniel Skinner
tgui-harm looks pretty interesting, I'll have to check it out this weekend.

> Go is a very neat programming language, but it is not particulary
fast. On my rather old computer a sampling frequency of 44100Hz caused
problems, but 24000Hz did work

my package dasa.cc/snd defaults to 44100 sample rate with a 256 sample
buffer and works well for fairly simple things on a cheap mobile device
(moto g2). Anything that gets too complex on cheap mobile needs to have
those parts prerendered (facilitated by the Freeze type in the package).

For the piano sound in the example gui app (which you'd probably need to
back up to one the first commits since i have pending changes that need to
be resolved and pushed), you can see my approach here (and how package snd
works):
https://github.com/dskinner/snd/blob/master/example/piano/key.go#L134

It's a sawtooth oscillator at a given note's frequency, modulated by a
synthesized square sine at half the frequency, and phased at touch-over
half by square, duplicated at +10 and -10 cents. All three of these are
mixed together and fed into two different ADSR envelopes, one with a quick
attack and decay and spends most time in sustain, the other with
near-instant attack and spends most time in decay. These two envelopes are
further mixed together and gain adjusted. At this point there's a global
reverb built from lowpass over comb filter over a tapped delay line and a
separate lowpass filter that sits right before speaker output which overall
provides a decent piano sound.

Now, at this point, live rendering can start experiencing frequent hiccups
with the default sample rate and buffer I mentioned, but only on my cheap
mobile device. That could be compensated with an increased buffer but that
also increases software latency which is already at 5.8ms (although, maybe
i'm being a pain now given *hardware* latency on many android devices is
greater than 100ms anyway!), so instead I chose to freeze portions of the
rendering that are mostly inconsequential to live playback. But on my
laptop, none of this is a problem and everything runs fast.

I guess the point of all this being, I'd like to challenge your notion of
"not particularly fast" :) as I know there's still room for improvement in
my own package.

On Wed, Jun 22, 2016 at 12:45 PM Seb Binet  wrote:

> On Wed, Jun 22, 2016 at 6:37 PM,  wrote:
>
>> Hello,
>>
>> I created a (kind of) organ or piano, to be played with a MIDI keyboard.
>> It has a GUI running in the terminal, thanks to the excellent termbox-go
>> library. It's only for Linux, but porting should not be too difficult.
>> PulseAudio is used for sound.
>>
>> In my humble opinion this software instrument sounds very good. You can
>> add new patches of your own, adding to the about 20 built-in patches. What
>> you play can be dumped into a WAVE file.
>>
>> You can get it here: https://github.com/wboeke/tgui
>>
>
> FYI, there was this Go challenge some time ago:
>  http://golang-challenge.org/go-challenge7/
> with these winners:
>  https://jamescscott.io/2015/11/03/my-golang-challenge-experience/
>  https://github.com/dskinner/snd/tree/master/example/piano
>
> I also know Andrew Gerrand is dabbling into sound related activities
> (during his "copious" free time :P)
> https://github.com/nf/sigourney
>
> hth,
> -s
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Any keyboard players here?

2016-06-22 Thread Seb Binet
On Wed, Jun 22, 2016 at 6:37 PM,  wrote:

> Hello,
>
> I created a (kind of) organ or piano, to be played with a MIDI keyboard.
> It has a GUI running in the terminal, thanks to the excellent termbox-go
> library. It's only for Linux, but porting should not be too difficult.
> PulseAudio is used for sound.
>
> In my humble opinion this software instrument sounds very good. You can
> add new patches of your own, adding to the about 20 built-in patches. What
> you play can be dumped into a WAVE file.
>
> You can get it here: https://github.com/wboeke/tgui
>

FYI, there was this Go challenge some time ago:
 http://golang-challenge.org/go-challenge7/
with these winners:
 https://jamescscott.io/2015/11/03/my-golang-challenge-experience/
 https://github.com/dskinner/snd/tree/master/example/piano

I also know Andrew Gerrand is dabbling into sound related activities
(during his "copious" free time :P)
https://github.com/nf/sigourney

hth,
-s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.