Hey @WillpowerStudios , you are running ubuntu 22.04, right? I’ve been following some of the previous threads in the forum. Could this be arising from another missing package? Maybe make sure that the RtAudio package has been installed. I’m not certain about the specifics, but maybe something related to librtaudio, or librtaudio-dev, etc.
Because of the previous threads, I put ubuntu 22.04 on a (very) old laptop and had a horrendous time with packages as they relate to both oF and Qt. I eventually gave up. When I’ve installed Mint in the past, everything has worked just fine. So I feel like this 22.04 release of ubuntu is particularly problematic and seems to be missing some of the typical linux packages for some reason.
Hi TimChi, thank you so much for your input ! Yes indeed, I have been having issues with QT and oF I never experienced prior to 22.04. I’m glad QT is now working ! I just installed librtaudio and although it says that it is already the newest version, the Audio Output example is now working ! The Audio Input on the other hand crashes immediately, so there is still something potentially missing…
I am getting this error for Audio Input projects:
I sat with a friend who helped me figure things out, it’s running and I can use Audio Input
These are the changes:
// or by name
// auto devices = soundStream.getMatchingDevices("default");
// if(!devices.empty()){
// settings.setInDevice(devices[0]);
// }
settings.setInListener(this);
// settings.sampleRate = 48000;
settings.numOutputChannels = 0;
settings.numInputChannels = 2;
// settings.bufferSize = bufferSize;
settings.setApi(ofSoundDevice::ALSA);
soundStream.setup(settings);
As you can see, we specified ALSA for the sound device.
maybe its unclear for oF which api to use if not specified ? unfortunately, it gives a weird error that I will share below.
I will mark this post as resolved but if anyone who is advanced knows how to fix it, please share if you can
[warning] ofSoundStreamSettings: Setting IN device with api: Unkown API will override the previously set: Alsa
RtAudio alsa: _NOT_ running realtime scheduling
i know that on my machine I have two audio devices, ALSA (0) and Pulseaudio (1), hence the 1 in the second line (I want to use PulseAudio). You can use the debugger to see what is in the vector, use soundStream.printDeviceList() or code some user input.
oF tries to set the soundstream to REALTIME. This didn’t work in your case. Is your user in the audio group?
I had a similar problem with PulseAudio that I fixed by editing the /etc/security/limits.conf file.
where the devices[1] corresponds to the 2nd device (starting from 0).
On GNU/Linux every user belongs to different groups.
In a terminal, type
groups
to see which. You should be logged in as the same user that runs your code (the one you logged in as) when you do this. What groups do you belong to? audio?
It is impossible for me to say where this error comes from, unfortunetaly. malloc() allocates memory. It might have to do with something else in your code?
It is a good idea to clean up the soundstream when exiting. I have this:
void ofApp::exit() {
ofSoundStreamClose();
}
And you have init’ed the settings? This is how it looks at my end:
ofSoundStreamSettings settings;
// soundStream.printDeviceList();
std::vector<ofSoundDevice> devices = soundStream.getDeviceList();
settings.setOutDevice(devices[1]);
settings.numOutputChannels = 2;
settings.sampleRate = DSTUDIO_SAMPLE_RATE; // 44100
settings.bufferSize = DSTUDIO_BUFFER_SIZE; // 512
settings.numBuffers = DSTUDIO_NUM_BUFFERS; // 4
// here have code that inits objects that creates the sound in the audiocallback
settings.setOutListener(this);
soundStream.setup(settings);
For ALSA to run realtime I think you need to be also in the audio group, which you don’t seem to be:
Yes, I have the settings initiated.
my code is in a different order. when I put it in the same order as you, it crashes on each attempt, whereas the way I had it before was running about half the time…
//
when entering
sudo usermod –a –G audio willpowerstudios
I get:
Usage: usermod [options] LOGIN
Options:
-b, --badnames allow bad names
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR new home directory for the user account
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP as new primary group
-G, --groups GROUPS new list of supplementary GROUPS
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
the user from other groups
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-R, --root CHROOT_DIR directory to chroot into
-P, --prefix PREFIX_DIR prefix directory where are located the /etc/* files
-s, --shell SHELL new login shell for the user account
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-v, --add-subuids FIRST-LAST add range of subordinate uids
-V, --del-subuids FIRST-LAST remove range of subordinate uids
-w, --add-subgids FIRST-LAST add range of subordinate gids
-W, --del-subgids FIRST-LAST remove range of subordinate gids
-Z, --selinux-user SEUSER new SELinux user mapping for the user account
The usermod should work if that is your username (willpowerstudios). Make sure you type the command, not copy and paste from the webpage as that might introduce some strange characters in the commandline. The dash before the characters might have been converted for example.
As for the other errors I think I need to see the whole of your code, if possible! One problem could be that the processing in the callback is not init’ed before it is started (which is done by the soundStream.setup(settings) call).