Audio library for FreeBasic - Features

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

Which version of Ubuntu do you have?
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

I tried with Lubuntu-22.04-amd64 and LinuxMint-21-xfce-64bit in VirtualBox.
Both can play wav-files only. Do you know a distribution without such frustrating problems?
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

hhr wrote: Aug 23, 2022 7:14 Both can play wav-files only.
What do you mean?
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

Lubuntu can play wave files with VLC media player. It cannot play midi files, so I installed timidity.

In Lubuntu I installed Ubuntu Studio: https://ubuntustudio.org/ubuntu-studio-installer/

It's a crowbar but now the sound feature of sfx works, as good as in Windows.

I do not need all the programs installed with Ubuntu Studio. The question is, how can I get sfx to work in Linux.

The midi feature has no sound in Linux yet.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

Does the command " pacat /dev/random" produce any sound? (it should produce white noise)
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

In a fresh Lubuntu, without Ubuntu Studio:
Yes, I hear noise.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

Is libasound installed?

If not, try installing it with:

Code: Select all

sudo apt-get install libasound2
Then try running the examples compiled with FreeBasic again
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

libasound is installed:
libasound2 is already the newest version (1.2.6.1-1ubuntu1).
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

What happens if you use padsp to launch your program? Does audio work?
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

No, padsp makes no sound.
I tried ...
padsp executable
padsp ./executable
padsp -n ./executable
padsp -m ./executable
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

Try to force OSS with the command, in your program

SoundControl 103,"OSS"

before any use of SoundSet

Then load your program with padsp
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

SoundControl 103,"OSS" has no effect. Thanks anyway.

Maybe it's a problem of Lubuntu in VirtualBox:
Installing carla-bridge-win64 helps.

Either with 'Muon Package Manager' or with 'sudo apt-get install carla-bridge-win64'.

The sound feature works good now.

The midi feature works, but not good.
With 'Ubuntu Studio' the midi feature works good. I do not know why, but it's enough now. Thank you for your help.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

I am glad to hear.
What do you mean that the midi works, but not good?
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Audio library for FreeBasic - Features

Post by hhr »

The sound of the midi part of sfx is mostly distorted at the beginning and then sometimes it get's clear. It behaves differently.

When Ubuntu Studio is installed, sfx works. So it is not a problem of sfx. Perhaps I have to install something else.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Audio library for FreeBasic - Features

Post by angros47 »

That is a known issue, on some distributions of Linux. It is caused by the calibration of the soft synthesizer included in my library. It occurs when no MIDI device is detected, neither hardware, nor software (that is the most common situation on a Linux installation, if Timidity is not installed). To be able to use MIDI features anyway, the sfx library includes a soft synthesizer. Such a synthesizer is activated only when a MIDI command is sent, so it starts working when you start playing a music, and it works by synthesizing the sound on the fly and sending it to the PCM output. The output of the synthesizer is queued, but the synthesizer tries to keep the queue as short as possible (otherwise, the sound would lag). On the other hand, if the queue is too short a buffer underrun would happen, and that would cause distortions, and stuttering sounds. The library tries to set the correct length for the queue, using a trial-and-error approach, and this means that at the beginning some buffer underruns may occur (and that explains the distortion you heard)
Post Reply