[LAD] Tutorial for programming with JACK

Paul Davis paul at linuxaudiosystems.com
Thu Mar 8 01:19:11 UTC 2012


there are many example clients in the JACK source code's
"example_clients" directory.

including, as luck would have it, jack_sine, which generates a sine
wave (based on MIDI input) and even simpler, jack_metro which outputs
a beep every 1/Nth of a second.

this list and google contain a wealth of information on JACK
programming, including at least one other thread on this same topic
recently that had some highly relevant links.

you are encouraged to explore the existing examples, tutorials and
other resources available online before asking people to explain it
all one more time. if you have questions once you've started with JACK
because some things are not clear, then please ask away.


On 3/7/12, kallipygos at inbox.lv <kallipygos at inbox.lv> wrote:
> Hi experts
>
> I have some more beginner questions about jack API.
> Long time ago i writed lil test program - sine signal generator with OSS
> output and TUI level indicators.
> http://martini.pudele.com/radio/demos/sin_gen-01.c
> It is possible with (curses-ansi escapes) TUI vary sine parameters -
> Frequency and amplitude.
>
> Program is so structured :
>
> int  main ( int argc, char *argv[] )
> {
>   open_sound_device();
>     for(;;)
>     {
>         // calc sine wave here
>         status = write(audio_fd,audio_buffer,BUFFA_SIZE*2);
>
>     } // for;;
>
>   close_sound_device();
> } // main
>
> Is it possible this program __as_is__ rewrite for jack output ?
> Sine values do no multiple with 32767.0
> and instead of
>   open_sound_device();
>   write(audio_fd,audio_buffer,BUFFA_SIZE*2);
>   close_sound_device();
> just call jack stuff ?
>
> ====
>
> Anyway - What is best (thread?, IPC?) program, structure, realtime-safe,
> for such simple jack-TUI program ?
>
> ====
>
> Normal 16 bit sound samples must be in range
> -0x8000 ... +0xFFFF  or dec  -32768 ... +32767 signed short
> but jack server works with samples normalized -1.0 ... +1.0 float
>
> (1/32768) x 32767 = 0.999969482
>
> Must be jack final output samples clipped in range
> -1.0 ... +0.999969482  ?
> If not, does jack clip anything to -1.0 and +0.999969482 ?
>
>
> Tnx in advace @ all
> Alfs Kurmis
>
>
>
>
>
>
> ----



More information about the Linux-audio-dev mailing list