Matthew Mikolay | 1 Apr 2010 02:48
Picon
Favicon

Beginner JACK Coder's Volume Problem

Hello!

My name is Matt, and I recently began coding my first audio applications using JACK, as I've found its API
simpler than other Linux audio APIs.

I've started playing around with JACK in an attempt to create a simple square wave synthesizer. After
modifying bits and pieces of other people's code, I've managed to assemble a program that reads MIDI input
and outputs a square wave of the corresponding frequency. This was relatively simple, but I cannot seem to
figure out how to change the volume of the output.

The following is a section of my code from the process function. The variable names are pretty self-explanatory:

		samples_per_cycle = sample_rate / frequency;
		if(sample_counter > samples_per_cycle)
			sample_counter = 0;
		if(sample_counter < (samples_per_cycle / 2))
			sample_buffer[i] = 127.0 * noteon;
		else
			sample_buffer[i] = -127.0 * noteon;
		sample_counter++;

I thought that just multiplying the 127 by a smaller value (like 0.25) would produce a quieter output, but
this is not the case.

I appreciate any help that can be given to me!

Thanks!
-Matt
Jack O'Quin | 1 Apr 2010 04:27
Picon
Gravatar

Re: Beginner JACK Coder's Volume Problem

On Wed, Mar 31, 2010 at 7:48 PM, Matthew Mikolay <mikolaym <at> yahoo.com> wrote:
> Hello!
>
> My name is Matt, and I recently began coding my first audio applications using JACK, as I've found its API
simpler than other Linux audio APIs.
>
> I've started playing around with JACK in an attempt to create a simple square wave synthesizer. After
modifying bits and pieces of other people's code, I've managed to assemble a program that reads MIDI input
and outputs a square wave of the corresponding frequency. This was relatively simple, but I cannot seem to
figure out how to change the volume of the output.
>
> The following is a section of my code from the process function. The variable names are pretty self-explanatory:
>
>                samples_per_cycle = sample_rate / frequency;
>                if(sample_counter > samples_per_cycle)
>                        sample_counter = 0;
>                if(sample_counter < (samples_per_cycle / 2))
>                        sample_buffer[i] = 127.0 * noteon;
>                else
>                        sample_buffer[i] = -127.0 * noteon;
>                sample_counter++;
>
> I thought that just multiplying the 127 by a smaller value (like 0.25) would produce a quieter output, but
this is not the case.
>
> I appreciate any help that can be given to me!

JACK samples are in float format. The nominal range is -1.0 to 1.0.
Anything outside that range gets clipped in the playback driver when
converting to 24 or 16-bit integers.
(Continue reading)

torbenh | 1 Apr 2010 06:18
Picon
Picon

Re: Beginner JACK Coder's Volume Problem

On Wed, Mar 31, 2010 at 05:48:32PM -0700, Matthew Mikolay wrote:
> Hello!
> 
> My name is Matt, and I recently began coding my first audio applications using JACK, as I've found its API
simpler than other Linux audio APIs.
> 
> I've started playing around with JACK in an attempt to create a simple square wave synthesizer. After
modifying bits and pieces of other people's code, I've managed to assemble a program that reads MIDI input
and outputs a square wave of the corresponding frequency. This was relatively simple, but I cannot seem to
figure out how to change the volume of the output.
> 
> The following is a section of my code from the process function. The variable names are pretty self-explanatory:
> 
> 		samples_per_cycle = sample_rate / frequency;
> 		if(sample_counter > samples_per_cycle)
> 			sample_counter = 0;
> 		if(sample_counter < (samples_per_cycle / 2))
> 			sample_buffer[i] = 127.0 * noteon;
> 		else
> 			sample_buffer[i] = -127.0 * noteon;
> 		sample_counter++;
> 
> I thought that just multiplying the 127 by a smaller value (like 0.25) would produce a quieter output, but
this is not the case.
> 
> I appreciate any help that can be given to me!

[ -1.0 , 1.0 ] is the maximum volume.

a louder signal is clipped to this interval.
(Continue reading)

Fernando Lopez-Lezcano | 2 Apr 2010 05:19
Picon

Re: jack netone for osx?

On Sat, 2010-03-27 at 12:14 -0700, Fernando Lopez-Lezcano wrote:
> On Sat, 2010-03-27 at 08:54 +0100, Stéphane LETZ wrote:
> > Le 27 mars 2010 à 02:39, Fernando Lopez-Lezcano a écrit :
> > 
> > > Hi all... does anyone know of a binary for osx that includes netjack
> > > netone in it? Looks like the existing ones don't (and trying to build
> > > jack 1.9.5 on osx results in a "_whitespace" undefined symbol...). 
> > 
> > Yes building on OSX is a kind of art.... 
> > The Xcode project already builds "jack_netnone" and "jack_netsource",
> > so it is only a mater of testing a bit and including in the next
> > JackOSX package.
> 
> That would be really nice. 
[MUNCH]
> Any help appreciated (Jason - cc'ed - was trying to build on osx version
> yesterday on his laptop without having much success). 

Jason managed to get jack for osx compiled and working from the jack
1.9.5 tarball (including netone). But there are more components that are
part of the OSX package. Is the source for those available somewhere? I
could not find source in jackosx.com.

-- Fernando

_______________________________________________
Jack-Devel mailing list
Jack-Devel <at> lists.jackaudio.org
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
(Continue reading)

Stéphane LETZ | 2 Apr 2010 07:26
Picon
Favicon

Re: jack netone for osx?


Le 2 avr. 2010 à 05:19, Fernando Lopez-Lezcano a écrit :

> On Sat, 2010-03-27 at 12:14 -0700, Fernando Lopez-Lezcano wrote:
>> On Sat, 2010-03-27 at 08:54 +0100, Stéphane LETZ wrote:
>>> Le 27 mars 2010 à 02:39, Fernando Lopez-Lezcano a écrit :
>>> 
>>>> Hi all... does anyone know of a binary for osx that includes netjack
>>>> netone in it? Looks like the existing ones don't (and trying to build
>>>> jack 1.9.5 on osx results in a "_whitespace" undefined symbol...). 
>>> 
>>> Yes building on OSX is a kind of art.... 
>>> The Xcode project already builds "jack_netnone" and "jack_netsource",
>>> so it is only a mater of testing a bit and including in the next
>>> JackOSX package.
>> 
>> That would be really nice. 
> [MUNCH]
>> Any help appreciated (Jason - cc'ed - was trying to build on osx version
>> yesterday on his laptop without having much success). 
> 
> Jason managed to get jack for osx compiled and working from the jack
> 1.9.5 tarball (including netone). But there are more components that are
> part of the OSX package. Is the source for those available somewhere? I
> could not find source in jackosx.com.
> 
> -- Fernando
> 

Everything is available at jackosx.com, but I guess the simpler is to release a JackOSX 0.86 official
(Continue reading)

Stéphane Letz | 2 Apr 2010 17:44
Picon
Favicon

Re: jack netone for osx?


Le 2 avr. 2010 à 16:23, jason sadural a écrit :

> Hello Stephane,
> 
> The one thing that was missing from the package that I compiled with
> xcode was jackrouter.framework, or am I missing something?
> 
> thanks,
> jason

Get the new JackOSX 0.86 beta package here :

http://dl.free.fr/getfile.pl?file=/u4Ev8meI

Stéphane 
Fernando Lopez-Lezcano | 3 Apr 2010 00:04
Picon

Re: jack netone for osx?

On Fri, 2010-04-02 at 17:44 +0200, Stéphane Letz wrote:
> Le 2 avr. 2010 à 16:23, jason sadural a écrit :
> 
> > Hello Stephane,
> > 
> > The one thing that was missing from the package that I compiled with
> > xcode was jackrouter.framework, or am I missing something?
> > 
> > thanks,
> > jason
> 
> Get the new JackOSX 0.86 beta package here :
> 
> http://dl.free.fr/getfile.pl?file=/u4Ev8meI

Many thanks!!!! It does seem to work fine on Snow Leopard. 

To get everything in place (Rui?) we would also need a qjackctl build
that supports the "netone" driver, the one in sf is 0.9.5 and does not
show "netone" in the pop up menu for "Drivers"... :-)

-- Fernando

_______________________________________________
Jack-Devel mailing list
Jack-Devel <at> lists.jackaudio.org
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Stéphane LETZ | 3 Apr 2010 00:17
Picon
Favicon

Re: jack netone for osx?


Le 2 avr. 2010 à 20:35, jason sadural a écrit :

> Hello Stephane,
> 
> Can you please compile a version for Leopard?  This version is only
> for snowleopard.
> 
> thanks,
> jason
> 

New week only.

Stéphane 
Geoff Beasley | 3 Apr 2010 00:39

Re: jack netone for osx?

On Fri, 2010-04-02 at 15:04 -0700, Fernando Lopez-Lezcano wrote:
> To get everything in place (Rui?) we would also need a qjackctl build
> that supports the "netone" driver, the one in sf is 0.9.5 and does not
> show "netone" in the pop up menu for "Drivers"... :-) 

G'day Nando ! Long time... qjackctl-svn has had netone support for some
months now; works a treat :) Rui has also fixed a transport bug which
would be a real problem with netjack in particular;don't know if it's
available for available for osx tho, but the code work is done 

best,

g.
Fernando Lopez-Lezcano | 3 Apr 2010 04:57
Picon

Re: jack netone for osx?

On Sat, 2010-04-03 at 09:39 +1100, Geoff Beasley wrote:
> On Fri, 2010-04-02 at 15:04 -0700, Fernando Lopez-Lezcano wrote:
> > To get everything in place (Rui?) we would also need a qjackctl build
> > that supports the "netone" driver, the one in sf is 0.9.5 and does not
> > show "netone" in the pop up menu for "Drivers"... :-) 
> 
> G'day Nando ! Long time... qjackctl-svn has had netone support for some
> months now; works a treat :) Rui has also fixed a transport bug which
> would be a real problem with netjack in particular;don't know if it's
> available for available for osx tho, but the code work is done 

Yes, it works fine in linux in 0.3.6, but it is not available in the
current qjackctl build for osx. 

So far so good, I'm able to connect to our "mixer" through netjack (one
connection!) and play up to 24 channels through netone! It makes it easy
to use that studio for multichannel work. 

-- Fernando

Gmane