1 Apr 2010 02:48
Beginner JACK Coder's Volume Problem
Matthew Mikolay <mikolaym <at> yahoo.com>
2010-04-01 00:48:32 GMT
2010-04-01 00:48:32 GMT
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
-- Fernando
_______________________________________________
Jack-Devel mailing list
Jack-Devel <at> lists.jackaudio.org
RSS Feed