totally lost with audio !
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
the title says it all.
I'm trying to get my hands dirty with audio modules...
for a start, I wanted to start easy : an audio volume module with lots of gain followed by a soft clip algorithm...
but even if the module compiles OK, it sounds as if audio is going at modulation rate instead of audio rate.
I'm sure it is not that complicated to sort it out as I must have miss something, but what ???
looks like it is the "TPrecision" that is the problem
here the interesting bits
supabooster.h
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr audioInputs[AUDIO_INS_OUTS_MAX]; // audio input
UsineEventPtr audioOutputs[AUDIO_INS_OUTS_MAX]; // audio output
UsineEventPtr fdrGain;
UsineEventPtr switchMute;
TPrecision tempValue[AUDIO_INS_OUTS_MAX];
//-------------------------------------------------------------------------
static const int numOfParamAfterAudiotInOut = 2;
int queryIndex;
int numOfAudiotInsOuts;
////////////////////////////////////////////////
supabooster.cpp
void AudioVolumeExample::onProcess ()
{
for (int i = 0; i < numOfAudiotInsOuts; i++)
{
sdkCopyEvt (audioInputs, audioOutputs);
sdkMultEvt1 (coeffGain, audioOutputs);
//y = x / (1 + | x | ) softclipping formula
tempValue = sdkGetEvtData(audioOutputs) / (1 + abs(sdkGetEvtData(audioOutputs)));
sdkSetEvtData(audioOutputs, tempValue);
////////////////////////////////////////////////////////
also, is the audio values are between -1 and 1 ?
thanks for your help
Olivar
I'm trying to get my hands dirty with audio modules...
for a start, I wanted to start easy : an audio volume module with lots of gain followed by a soft clip algorithm...
but even if the module compiles OK, it sounds as if audio is going at modulation rate instead of audio rate.
I'm sure it is not that complicated to sort it out as I must have miss something, but what ???
looks like it is the "TPrecision" that is the problem
here the interesting bits
supabooster.h
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr audioInputs[AUDIO_INS_OUTS_MAX]; // audio input
UsineEventPtr audioOutputs[AUDIO_INS_OUTS_MAX]; // audio output
UsineEventPtr fdrGain;
UsineEventPtr switchMute;
TPrecision tempValue[AUDIO_INS_OUTS_MAX];
//-------------------------------------------------------------------------
static const int numOfParamAfterAudiotInOut = 2;
int queryIndex;
int numOfAudiotInsOuts;
////////////////////////////////////////////////
supabooster.cpp
void AudioVolumeExample::onProcess ()
{
for (int i = 0; i < numOfAudiotInsOuts; i++)
{
sdkCopyEvt (audioInputs, audioOutputs);
sdkMultEvt1 (coeffGain, audioOutputs);
//y = x / (1 + | x | ) softclipping formula
tempValue = sdkGetEvtData(audioOutputs) / (1 + abs(sdkGetEvtData(audioOutputs)));
sdkSetEvtData(audioOutputs, tempValue);
////////////////////////////////////////////////////////
also, is the audio values are between -1 and 1 ?
thanks for your help
Olivar
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
Thank you,
but "Don't Process = FALSE" by default so its not that...
can't wait it's working : I prepared a supaBooster with softclipping, another with hard insane clipping and a DC blocker, but still this problem with TPrecision...
but "Don't Process = FALSE" by default so its not that...
can't wait it's working : I prepared a supaBooster with softclipping, another with hard insane clipping and a DC blocker, but still this problem with TPrecision...
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
martignasse
- Site Admin
- Posts: 611
- Location: Lyon, FRANCE
- Contact:
hey oli_lab,
from the code you posted, you appli the soft clipping formula only to the first sample of each output sample block.
remember that an audio parameter contain the whole block of sample corresponding to the audio tick for this process call, so it's literally an array of size = usineblock.
the simplest implementation is to add a for loop to apply your softclipping algo to each samples
something like this (not tested)
from the code you posted, you appli the soft clipping formula only to the first sample of each output sample block.
//y = x / (1 + | x | ) softclipping formula
tempValue = sdkGetEvtData(audioOutputs) / (1 + abs(sdkGetEvtData(audioOutputs)));
sdkSetEvtData(audioOutputs, tempValue);
remember that an audio parameter contain the whole block of sample corresponding to the audio tick for this process call, so it's literally an array of size = usineblock.
the simplest implementation is to add a for loop to apply your softclipping algo to each samples
something like this (not tested)
Code: Select all
void AudioVolumeExample::onProcess ()
{
tempValue
for (int i = 0; i < numOfAudiotInsOuts; i++)
{
sdkCopyEvt (audioInputs[i], audioOutputs[i]);
sdkMultEvt1 (coeffGain, audioOutputs[i]);
//y = x / (1 + | x | ) softclipping formula
for (int j = 0; j < sdkGetEvtSize(audioOutputs[i]); j++)
{
tempValue[i] = sdkGetEvtArrayData(audioOutputs[i], j) / (1 + abs(sdkGetEvtArrayData(audioOutputs[i], j)));
sdkSetEvtArrayData(audioOutputs[i], j, tempValue[i]);
}
}
}Martin FLEURENT - Usine Developer - SDK maintainer
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
Thanx !
I'm not lost anymore.
I'll try that tonite !
Olivar
I'm not lost anymore.
I'll try that tonite !
Olivar
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
this "tempValue" could be as well a "tempValue" if I understand right
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
23fx23
- Member
- Posts: 2545
mm think nope because it indexes a different audio input in case you got several channels, that would be same only if manipulating a mono channel,
but if got 4 channels with differents audio content, have to check volumes and process so that they got their own processing, thus the array stuff if i well understood.
but if got 4 channels with differents audio content, have to check volumes and process so that they got their own processing, thus the array stuff if i well understood.
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
if there is many channel, each channel is process by block, so, as I understand it, the "tempValue" will be used by each channel in turn, don't need to be memorise from one block to another of the same channel.
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
ceasless
- Member
- Posts: 330
I think oli_lab is right. Since temp_value is only assigned and accessed within the innermost loop, you should be able to get away with a single placeholder variable. A small enhancement to the memory efficiency of your module.
Unless there is something I'm missing (and I've gotten used to that
).
The rest of the for-loop construct looks solid.
Unless there is something I'm missing (and I've gotten used to that
The rest of the for-loop construct looks solid.
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
the module is working fine and is on the addons page !
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
Clearscreen
- Member
- Posts: 482
- Location: Australia
- Contact:
Thanks for these.
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
no not yet !
I am totally lost (again) with this github
can't sort out how to upload files.
here they are :
http://we.tl/TE4MLuahoY
I am totally lost (again) with this github
can't sort out how to upload files.
here they are :
http://we.tl/TE4MLuahoY
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
